PageSourceSearch

https://miners4k-elm.pages.dev/public/dist/main.js

js miners4k-elm.pages.dev collected 2026-10-03 05:27:25 UTC 249,947 bytes, 9,649 lines download raw bytes

1(function(scope){
2'use strict';
3
4function F(arity, fun, wrapper) {
5  wrapper.a = arity;
6  wrapper.f = fun;
7  return wrapper;
8}
9
10function F2(fun) {
11  return F(2, fun, function(a) { return function(b) { return fun(a,b); }; })
12}
13function F3(fun) {
14  return F(3, fun, function(a) {
15    return function(b) { return function(c) { return fun(a, b, c); }; };
16  });
17}
18function F4(fun) {
19  return F(4, fun, function(a) { return function(b) { return function(c) {
20    return function(d) { return fun(a, b, c, d); }; }; };
21  });
22}
23function F5(fun) {
24  return F(5, fun, function(a) { return function(b) { return function(c) {
25    return function(d) { return function(e) { return fun(a, b, c, d, e); }; }; }; };
26  });
27}
28function F6(fun) {
29  return F(6, fun, function(a) { return function(b) { return function(c) {
30    return function(d) { return function(e) { return function(f) {
31    return fun(a, b, c, d, e, f); }; }; }; }; };
32  });
33}
34function F7(fun) {
35  return F(7, fun, function(a) { return function(b) { return function(c) {
36    return function(d) { return function(e) { return function(f) {
37    return function(g) { return fun(a, b, c, d, e, f, g); }; }; }; }; }; };
38  });
39}
40function F8(fun) {
41  return F(8, fun, function(a) { return function(b) { return function(c) {
42    return function(d) { return function(e) { return function(f) {
43    return function(g) { return function(h) {
44    return fun(a, b, c, d, e, f, g, h); }; }; }; }; }; }; };
45  });
46}
47function F9(fun) {
48  return F(9, fun, function(a) { return function(b) { return function(c) {
49    return function(d) { return function(e) { return function(f) {
50    return function(g) { return function(h) { return function(i) {
51    return fun(a, b, c, d, e, f, g, h, i); }; }; }; }; }; }; }; };
52  });
53}
54
55function A2(fun, a, b) {
56  return fun.a === 2 ? fun.f(a, b) : fun(a)(b);
57}
58function A3(fun, a, b, c) {
59  return fun.a === 3 ? fun.f(a, b, c) : fun(a)(b)(c);
60}
61function A4(fun, a, b, c, d) {
62  return fun.a === 4 ? fun.f(a, b, c, d) : fun(a)(b)(c)(d);
63}
64function A5(fun, a, b, c, d, e) {
65  return fun.a === 5 ? fun.f(a, b, c, d, e) : fun(a)(b)(c)(d)(e);
66}
67function A6(fun, a, b, c, d, e, f) {
68  return fun.a === 6 ? fun.f(a, b, c, d, e, f) : fun(a)(b)(c)(d)(e)(f);
69}
70function A7(fun, a, b, c, d, e, f, g) {
71  return fun.a === 7 ? fun.f(a, b, c, d, e, f, g) : fun(a)(b)(c)(d)(e)(f)(g);
72}
73function A8(fun, a, b, c, d, e, f, g, h) {
74  return fun.a === 8 ? fun.f(a, b, c, d, e, f, g, h) : fun(a)(b)(c)(d)(e)(f)(g)(h);
75}
76function A9(fun, a, b, c, d, e, f, g, h, i) {
77  return fun.a === 9 ? fun.f(a, b, c, d, e, f, g, h, i) : fun(a)(b)(c)(d)(e)(f)(g)(h)(i);
78}
79
80
81
82
83var _JsArray_empty = [];
84
85function _JsArray_singleton(value)
86{
87    return [value];
88}
89
90function _JsArray_length(array)
91{
92    return array.length;
93}
94
95var _JsArray_initialize = F3(function(size, offset, func)
96{
97    var result = new Array(size);
98
99    for (var i = 0; i < size; i++)
100    {
101        result[i] = func(offset + i);
102    }
103
104    return result;
105});
106
107var _JsArray_initializeFromList = F2(function (max, ls)
108{
109    var result = new Array(max);
110
111    for (var i = 0; i < max && ls.b; i++)
112    {
113        result[i] = ls.a;
114        ls = ls.b;
115    }
116
117    result.length = i;
118    return _Utils_Tuple2(result, ls);
119});
120
121var _JsArray_unsafeGet = F2(function(index, array)
122{
123    return array[index];
124});
125
126var _JsArray_unsafeSet = F3(function(index, value, array)
127{
128    var length = array.length;
129    var result = new Array(length);
130
131    for (var i = 0; i < length; i++)
132    {
133        result[i] = array[i];
134    }
135
136    result[index] = value;
137    return result;
138});
139
140var _JsArray_push = F2(function(value, array)
141{
142    var length = array.length;
143    var result = new Array(length + 1);
144
145    for (var i = 0; i < length; i++)
146    {
147        result[i] = array[i];
148    }
149
150    result[length] = value;
151    return result;
152});
153
154var _JsArray_foldl = F3(function(func, acc, array)
155{
156    var length = array.length;
157
158    for (var i = 0; i < length; i++)
159    {
160        acc = A2(func, array[i], acc);
161    }
162
163    return acc;
164});
165
166var _JsArray_foldr = F3(function(func, acc, array)
167{
168    for (var i = array.length - 1; i >= 0; i--)
169    {
170        acc = A2(func, array[i], acc);
171    }
172
173    return acc;
174});
175
176var _JsArray_map = F2(function(func, array)
177{
178    var length = array.length;
179    var result = new Array(length);
180
181    for (var i = 0; i < length; i++)
182    {
183        result[i] = func(array[i]);
184    }
185
186    return result;
187});
188
189var _JsArray_indexedMap = F3(function(func, offset, array)
190{
191    var length = array.length;
192    var result = new Array(length);
193
194    for (var i = 0; i < length; i++)
195    {
196        result[i] = A2(func, offset + i, array[i]);
197    }
198
199    return result;
200});
201
202var _JsArray_slice = F3(function(from, to, array)
203{
204    return array.slice(from, to);
205});
206
207var _JsArray_appendN = F3(function(n, dest, source)
208{
209    var destLen = dest.length;
210    var itemsToCopy = n - destLen;
211
212    if (itemsToCopy > source.length)
213    {
214        itemsToCopy = source.length;
215    }
216
217    var size = destLen + itemsToCopy;
218    var result = new Array(size);
219
220    for (var i = 0; i < destLen; i++)
221    {
222        result[i] = dest[i];
223    }
224
225    for (var i = 0; i < itemsToCopy; i++)
226    {
227        result[i + destLen] = source[i];
228    }
229
230    return result;
231});
232
233
234
235// LOG
236
237var _Debug_log = F2(function(tag, value)
238{
239	return value;
240});
241
242var _Debug_log_UNUSED = F2(function(tag, value)
243{
244	console.log(tag + ': ' + _Debug_toString(value));
245	return value;
246});
247
248
249// TODOS
250
251function _Debug_todo(moduleName, region)
252{
253	return function(message) {
254		_Debug_crash(8, moduleName, region, message);
255	};
256}
257
258function _Debug_todoCase(moduleName, region, value)
259{
260	return function(message) {
261		_Debug_crash(9, moduleName, region, value, message);
262	};
263}
264
265
266// TO STRING
267
268function _Debug_toString(value)
269{
270	return '<internals>';
271}
272
273function _Debug_toString_UNUSED(value)
274{
275	return _Debug_toAnsiString(false, value);
276}
277
278function _Debug_toAnsiString(ansi, value)
279{
280	if (typeof value === 'function')
281	{
282		return _Debug_internalColor(ansi, '<function>');
283	}
284
285	if (typeof value === 'boolean')
286	{
287		return _Debug_ctorColor(ansi, value ? 'True' : 'False');
288	}
289
290	if (typeof value === 'number')
291	{
292		return _Debug_numberColor(ansi, value + '');
293	}
294
295	if (value instanceof String)
296	{
297		return _Debug_charColor(ansi, "'" + _Debug_addSlashes(value, true) + "'");
298	}
299
300	if (typeof value === 'string')
301	{
302		return _Debug_stringColor(ansi, '"' + _Debug_addSlashes(value, false) + '"');
303	}
304
305	if (typeof value === 'object' && '$' in value)
306	{
307		var tag = value.$;
308
309		if (typeof tag === 'number')
310		{
311			return _Debug_internalColor(ansi, '<internals>');
312		}
313
314		if (tag[0] === '#')
315		{
316			var output = [];
317			for (var k in value)
318			{
319				if (k === '$') continue;
320				output.push(_Debug_toAnsiString(ansi, value[k]));
321			}
322			return '(' + output.join(',') + ')';
323		}
324
325		if (tag === 'Set_elm_builtin')
326		{
327			return _Debug_ctorColor(ansi, 'Set')
328				+ _Debug_fadeColor(ansi, '.fromList') + ' '
329				+ _Debug_toAnsiString(ansi, $elm$core$Set$toList(value));
330		}
331
332		if (tag === 'RBNode_elm_builtin' || tag === 'RBEmpty_elm_builtin')
333		{
334			return _Debug_ctorColor(ansi, 'Dict')
335				+ _Debug_fadeColor(ansi, '.fromList') + ' '
336				+ _Debug_toAnsiString(ansi, $elm$core$Dict$toList(value));
337		}
338
339		if (tag === 'Array_elm_builtin')
340		{
341			return _Debug_ctorColor(ansi, 'Array')
342				+ _Debug_fadeColor(ansi, '.fromList') + ' '
343				+ _Debug_toAnsiString(ansi, $elm$core$Array$toList(value));
344		}
345
346		if (tag === '::' || tag === '[]')
347		{
348			var output = '[';
349
350			value.b && (output += _Debug_toAnsiString(ansi, value.a), value = value.b)
351
352			for (; value.b; value = value.b) // WHILE_CONS
353			{
354				output += ',' + _Debug_toAnsiString(ansi, value.a);
355			}
356			return output + ']';
357		}
358
359		var output = '';
360		for (var i in value)
361		{
362			if (i === '$') continue;
363			var str = _Debug_toAnsiString(ansi, value[i]);
364			var c0 = str[0];
365			var parenless = c0 === '{' || c0 === '(' || c0 === '[' || c0 === '<' || c0 === '"' || str.indexOf(' ') < 0;
366			output += ' ' + (parenless ? str : '(' + str + ')');
367		}
368		return _Debug_ctorColor(ansi, tag) + output;
369	}
370
371	if (typeof DataView === 'function' && value instanceof DataView)
372	{
373		return _Debug_stringColor(ansi, '<' + value.byteLength + ' bytes>');
374	}
375
376	if (typeof File !== 'undefined' && value instanceof File)
377	{
378		return _Debug_internalColor(ansi, '<' + value.name + '>');
379	}
380
381	if (typeof value === 'object')
382	{
383		var output = [];
384		for (var key in value)
385		{
386			var field = key[0] === '_' ? key.slice(1) : key;
387			output.push(_Debug_fadeColor(ansi, field) + ' = ' + _Debug_toAnsiString(ansi, value[key]));
388		}
389		if (output.length === 0)
390		{
391			return '{}';
392		}
393		return '{ ' + output.join(', ') + ' }';
394	}
395
396	return _Debug_internalColor(ansi, '<internals>');
397}
398
399function _Debug_addSlashes(str, isChar)
400{
401	var s = str
402		.replace(/\\/g, '\\\\')
403		.replace(/\n/g, '\\n')
404		.replace(/\t/g, '\\t')
405		.replace(/\r/g, '\\r')
406		.replace(/\v/g, '\\v')
407		.replace(/\0/g, '\\0');
408
409	if (isChar)
410	{
411		return s.replace(/\'/g, '\\\'');
412	}
413	else
414	{
415		return s.replace(/\"/g, '\\"');
416	}
417}
418
419function _Debug_ctorColor(ansi, string)
420{
421	return ansi ? '\x1b[96m' + string + '\x1b[0m' : string;
422}
423
424function _Debug_numberColor(ansi, string)
425{
426	return ansi ? '\x1b[95m' + string + '\x1b[0m' : string;
427}
428
429function _Debug_stringColor(ansi, string)
430{
431	return ansi ? '\x1b[93m' + string + '\x1b[0m' : string;
432}
433
434function _Debug_charColor(ansi, string)
435{
436	return ansi ? '\x1b[92m' + string + '\x1b[0m' : string;
437}
438
439function _Debug_fadeColor(ansi, string)
440{
441	return ansi ? '\x1b[37m' + string + '\x1b[0m' : string;
442}
443
444function _Debug_internalColor(ansi, string)
445{
446	return ansi ? '\x1b[36m' + string + '\x1b[0m' : string;
447}
448
449function _Debug_toHexDigit(n)
450{
451	return String.fromCharCode(n < 10 ? 48 + n : 55 + n);
452}
453
454
455// CRASH
456
457
458function _Debug_crash(identifier)
459{
460	throw new Error('https://github.com/elm/core/blob/1.0.0/hints/' + identifier + '.md');
461}
462
463
464function _Debug_crash_UNUSED(identifier, fact1, fact2, fact3, fact4)
465{
466	switch(identifier)
467	{
468		case 0:
469			throw new Error('What node should I take over? In JavaScript I need something like:\n\n    Elm.Main.init({\n        node: document.getElementById("elm-node")\n    })\n\nYou need to do this with any Browser.sandbox or Browser.element program.');
470
471		case 1:
472			throw new Error('Browser.application programs cannot handle URLs like this:\n\n    ' + document.location.href + '\n\nWhat is the root? The root of your file system? Try looking at this program with `elm reactor` or some other server.');
473
474		case 2:
475			var jsonErrorString = fact1;
476			throw new Error('Problem with the flags given to your Elm program on initialization.\n\n' + jsonErrorString);
477
478		case 3:
479			var portName = fact1;
480			throw new Error('There can only be one port named `' + portName + '`, but your program has multiple.');
481
482		case 4:
483			var portName = fact1;
484			var problem = fact2;
485			throw new Error('Trying to send an unexpected type of value through port `' + portName + '`:\n' + problem);
486
487		case 5:
488			throw new Error('Trying to use `(==)` on functions.\nThere is no way to know if functions are "the same" in the Elm sense.\nRead more about this at https://package.elm-lang.org/packages/elm/core/latest/Basics#== which describes why it is this way and what the better version will look like.');
489
490		case 6:
491			var moduleName = fact1;
492			throw new Error('Your page is loading multiple Elm scripts with a module named ' + moduleName + '. Maybe a duplicate script is getting loaded accidentally? If not, rename one of them so I know which is which!');
493
494		case 8:
495			var moduleName = fact1;
496			var region = fact2;
497			var message = fact3;
498			throw new Error('TODO in module `' + moduleName + '` ' + _Debug_regionToString(region) + '\n\n' + message);
499
500		case 9:
501			var moduleName = fact1;
502			var region = fact2;
503			var value = fact3;
504			var message = fact4;
505			throw new Error(
506				'TODO in module `' + moduleName + '` from the `case` expression '
507				+ _Debug_regionToString(region) + '\n\nIt received the following value:\n\n    '
508				+ _Debug_toString(value).replace('\n', '\n    ')
509				+ '\n\nBut the branch that handles it says:\n\n    ' + message.replace('\n', '\n    ')
510			);
511
512		case 10:
513			throw new Error('Bug in https://github.com/elm/virtual-dom/issues');
514
515		case 11:
516			throw new Error('Cannot perform mod 0. Division by zero error.');
517	}
518}
519
520function _Debug_regionToString(region)
521{
522	if (region.a$.aE === region.a7.aE)
523	{
524		return 'on line ' + region.a$.aE;
525	}
526	return 'on lines ' + region.a$.aE + ' through ' + region.a7.aE;
527}
528
529
530
531// EQUALITY
532
533function _Utils_eq(x, y)
534{
535	for (
536		var pair, stack = [], isEqual = _Utils_eqHelp(x, y, 0, stack);
537		isEqual && (pair = stack.pop());
538		isEqual = _Utils_eqHelp(pair.a, pair.b, 0, stack)
539		)
540	{}
541
542	return isEqual;
543}
544
545function _Utils_eqHelp(x, y, depth, stack)
546{
547	if (x === y)
548	{
549		return true;
550	}
551
552	if (typeof x !== 'object' || x === null || y === null)
553	{
554		typeof x === 'function' && _Debug_crash(5);
555		return false;
556	}
557
558	if (depth > 100)
559	{
560		stack.push(_Utils_Tuple2(x,y));
561		return true;
562	}
563
564	/**_UNUSED/
565	if (x.$ === 'Set_elm_builtin')
566	{
567		x = $elm$core$Set$toList(x);
568		y = $elm$core$Set$toList(y);
569	}
570	if (x.$ === 'RBNode_elm_builtin' || x.$ === 'RBEmpty_elm_builtin')
571	{
572		x = $elm$core$Dict$toList(x);
573		y = $elm$core$Dict$toList(y);
574	}
575	//*/
576
577	/**/
578	if (x.$ < 0)
579	{
580		x = $elm$core$Dict$toList(x);
581		y = $elm$core$Dict$toList(y);
582	}
583	//*/
584
585	for (var key in x)
586	{
587		if (!_Utils_eqHelp(x[key], y[key], depth + 1, stack))
588		{
589			return false;
590		}
591	}
592	return true;
593}
594
595var _Utils_equal = F2(_Utils_eq);
596var _Utils_notEqual = F2(function(a, b) { return !_Utils_eq(a,b); });
597
598
599
600// COMPARISONS
601
602// Code in Generate/JavaScript.hs, Basics.js, and List.js depends on
603// the particular integer values assigned to LT, EQ, and GT.
604
605function _Utils_cmp(x, y, ord)
606{
607	if (typeof x !== 'object')
608	{
609		return x === y ? /*EQ*/ 0 : x < y ? /*LT*/ -1 : /*GT*/ 1;
610	}
611
612	/**_UNUSED/
613	if (x instanceof String)
614	{
615		var a = x.valueOf();
616		var b = y.valueOf();
617		return a === b ? 0 : a < b ? -1 : 1;
618	}
619	//*/
620
621	/**/
622	if (typeof x.$ === 'undefined')
623	//*/
624	/**_UNUSED/
625	if (x.$[0] === '#')
626	//*/
627	{
628		return (ord = _Utils_cmp(x.a, y.a))
629			? ord
630			: (ord = _Utils_cmp(x.b, y.b))
631				? ord
632				: _Utils_cmp(x.c, y.c);
633	}
634
635	// traverse conses until end of a list or a mismatch
636	for (; x.b && y.b && !(ord = _Utils_cmp(x.a, y.a)); x = x.b, y = y.b) {} // WHILE_CONSES
637	return ord || (x.b ? /*GT*/ 1 : y.b ? /*LT*/ -1 : /*EQ*/ 0);
638}
639
640var _Utils_lt = F2(function(a, b) { return _Utils_cmp(a, b) < 0; });
641var _Utils_le = F2(function(a, b) { return _Utils_cmp(a, b) < 1; });
642var _Utils_gt = F2(function(a, b) { return _Utils_cmp(a, b) > 0; });
643var _Utils_ge = F2(function(a, b) { return _Utils_cmp(a, b) >= 0; });
644
645var _Utils_compare = F2(function(x, y)
646{
647	var n = _Utils_cmp(x, y);
648	return n < 0 ? $elm$core$Basics$LT : n ? $elm$core$Basics$GT : $elm$core$Basics$EQ;
649});
650
651
652// COMMON VALUES
653
654var _Utils_Tuple0 = 0;
655var _Utils_Tuple0_UNUSED = { $: '#0' };
656
657function _Utils_Tuple2(a, b) { return { a: a, b: b }; }
658function _Utils_Tuple2_UNUSED(a, b) { return { $: '#2', a: a, b: b }; }
659
660function _Utils_Tuple3(a, b, c) { return { a: a, b: b, c: c }; }
661function _Utils_Tuple3_UNUSED(a, b, c) { return { $: '#3', a: a, b: b, c: c }; }
662
663function _Utils_chr(c) { return c; }
664function _Utils_chr_UNUSED(c) { return new String(c); }
665
666
667// RECORDS
668
669function _Utils_update(oldRecord, updatedFields)
670{
671	var newRecord = {};
672
673	for (var key in oldRecord)
674	{
675		newRecord[key] = oldRecord[key];
676	}
677
678	for (var key in updatedFields)
679	{
680		newRecord[key] = updatedFields[key];
681	}
682
683	return newRecord;
684}
685
686
687// APPEND
688
689var _Utils_append = F2(_Utils_ap);
690
691function _Utils_ap(xs, ys)
692{
693	// append Strings
694	if (typeof xs === 'string')
695	{
696		return xs + ys;
697	}
698
699	// append Lists
700	if (!xs.b)
701	{
702		return ys;
703	}
704	var root = _List_Cons(xs.a, ys);
705	xs = xs.b
706	for (var curr = root; xs.b; xs = xs.b) // WHILE_CONS
707	{
708		curr = curr.b = _List_Cons(xs.a, ys);
709	}
710	return root;
711}
712
713
714
715var _List_Nil = { $: 0 };
716var _List_Nil_UNUSED = { $: '[]' };
717
718function _List_Cons(hd, tl) { return { $: 1, a: hd, b: tl }; }
719function _List_Cons_UNUSED(hd, tl) { return { $: '::', a: hd, b: tl }; }
720
721
722var _List_cons = F2(_List_Cons);
723
724function _List_fromArray(arr)
725{
726	var out = _List_Nil;
727	for (var i = arr.length; i--; )
728	{
729		out = _List_Cons(arr[i], out);
730	}
731	return out;
732}
733
734function _List_toArray(xs)
735{
736	for (var out = []; xs.b; xs = xs.b) // WHILE_CONS
737	{
738		out.push(xs.a);
739	}
740	return out;
741}
742
743var _List_map2 = F3(function(f, xs, ys)
744{
745	for (var arr = []; xs.b && ys.b; xs = xs.b, ys = ys.b) // WHILE_CONSES
746	{
747		arr.push(A2(f, xs.a, ys.a));
748	}
749	return _List_fromArray(arr);
750});
751
752var _List_map3 = F4(function(f, xs, ys, zs)
753{
754	for (var arr = []; xs.b && ys.b && zs.b; xs = xs.b, ys = ys.b, zs = zs.b) // WHILE_CONSES
755	{
756		arr.push(A3(f, xs.a, ys.a, zs.a));
757	}
758	return _List_fromArray(arr);
759});
760
761var _List_map4 = F5(function(f, ws, xs, ys, zs)
762{
763	for (var arr = []; ws.b && xs.b && ys.b && zs.b; ws = ws.b, xs = xs.b, ys = ys.b, zs = zs.b) // WHILE_CONSES
764	{
765		arr.push(A4(f, ws.a, xs.a, ys.a, zs.a));
766	}
767	return _List_fromArray(arr);
768});
769
770var _List_map5 = F6(function(f, vs, ws, xs, ys, zs)
771{
772	for (var arr = []; vs.b && ws.b && xs.b && ys.b && zs.b; vs = vs.b, ws = ws.b, xs = xs.b, ys = ys.b, zs = zs.b) // WHILE_CONSES
773	{
774		arr.push(A5(f, vs.a, ws.a, xs.a, ys.a, zs.a));
775	}
776	return _List_fromArray(arr);
777});
778
779var _List_sortBy = F2(function(f, xs)
780{
781	return _List_fromArray(_List_toArray(xs).sort(function(a, b) {
782		return _Utils_cmp(f(a), f(b));
783	}));
784});
785
786var _List_sortWith = F2(function(f, xs)
787{
788	return _List_fromArray(_List_toArray(xs).sort(function(a, b) {
789		var ord = A2(f, a, b);
790		return ord === $elm$core$Basics$EQ ? 0 : ord === $elm$core$Basics$LT ? -1 : 1;
791	}));
792});
793
794
795
796// MATH
797
798var _Basics_add = F2(function(a, b) { return a + b; });
799var _Basics_sub = F2(function(a, b) { return a - b; });
800var _Basics_mul = F2(function(a, b) { return a * b; });
801var _Basics_fdiv = F2(function(a, b) { return a / b; });
802var _Basics_idiv = F2(function(a, b) { return (a / b) | 0; });
803var _Basics_pow = F2(Math.pow);
804
805var _Basics_remainderBy = F2(function(b, a) { return a % b; });
806
807// https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/divmodnote-letter.pdf
808var _Basics_modBy = F2(function(modulus, x)
809{
810	var answer = x % modulus;
811	return modulus === 0
812		? _Debug_crash(11)
813		:
814	((answer > 0 && modulus < 0) || (answer < 0 && modulus > 0))
815		? answer + modulus
816		: answer;
817});
818
819
820// TRIGONOMETRY
821
822var _Basics_pi = Math.PI;
823var _Basics_e = Math.E;
824var _Basics_cos = Math.cos;
825var _Basics_sin = Math.sin;
826var _Basics_tan = Math.tan;
827var _Basics_acos = Math.acos;
828var _Basics_asin = Math.asin;
829var _Basics_atan = Math.atan;
830var _Basics_atan2 = F2(Math.atan2);
831
832
833// MORE MATH
834
835function _Basics_toFloat(x) { return x; }
836function _Basics_truncate(n) { return n | 0; }
837function _Basics_isInfinite(n) { return n === Infinity || n === -Infinity; }
838
839var _Basics_ceiling = Math.ceil;
840var _Basics_floor = Math.floor;
841var _Basics_round = Math.round;
842var _Basics_sqrt = Math.sqrt;
843var _Basics_log = Math.log;
844var _Basics_isNaN = isNaN;
845
846
847// BOOLEANS
848
849function _Basics_not(bool) { return !bool; }
850var _Basics_and = F2(function(a, b) { return a && b; });
851var _Basics_or  = F2(function(a, b) { return a || b; });
852var _Basics_xor = F2(function(a, b) { return a !== b; });
853
854
855
856var _String_cons = F2(function(chr, str)
857{
858	return chr + str;
859});
860
861function _String_uncons(string)
862{
863	var word = string.charCodeAt(0);
864	return !isNaN(word)
865		? $elm$core$Maybe$Just(
866			0xD800 <= word && word <= 0xDBFF
867				? _Utils_Tuple2(_Utils_chr(string[0] + string[1]), string.slice(2))
868				: _Utils_Tuple2(_Utils_chr(string[0]), string.slice(1))
869		)
870		: $elm$core$Maybe$Nothing;
871}
872
873var _String_append = F2(function(a, b)
874{
875	return a + b;
876});
877
878function _String_length(str)
879{
880	return str.length;
881}
882
883var _String_map = F2(function(func, string)
884{
885	var len = string.length;
886	var array = new Array(len);
887	var i = 0;
888	while (i < len)
889	{
890		var word = string.charCodeAt(i);
891		if (0xD800 <= word && word <= 0xDBFF)
892		{
893			array[i] = func(_Utils_chr(string[i] + string[i+1]));
894			i += 2;
895			continue;
896		}
897		array[i] = func(_Utils_chr(string[i]));
898		i++;
899	}
900	return array.join('');
901});
902
903var _String_filter = F2(function(isGood, str)
904{
905	var arr = [];
906	var len = str.length;
907	var i = 0;
908	while (i < len)
909	{
910		var char = str[i];
911		var word = str.charCodeAt(i);
912		i++;
913		if (0xD800 <= word && word <= 0xDBFF)
914		{
915			char += str[i];
916			i++;
917		}
918
919		if (isGood(_Utils_chr(char)))
920		{
921			arr.push(char);
922		}
923	}
924	return arr.join('');
925});
926
927function _String_reverse(str)
928{
929	var len = str.length;
930	var arr = new Array(len);
931	var i = 0;
932	while (i < len)
933	{
934		var word = str.charCodeAt(i);
935		if (0xD800 <= word && word <= 0xDBFF)
936		{
937			arr[len - i] = str[i + 1];
938			i++;
939			arr[len - i] = str[i - 1];
940			i++;
941		}
942		else
943		{
944			arr[len - i] = str[i];
945			i++;
946		}
947	}
948	return arr.join('');
949}
950
951var _String_foldl = F3(function(func, state, string)
952{
953	var len = string.length;
954	var i = 0;
955	while (i < len)
956	{
957		var char = string[i];
958		var word = string.charCodeAt(i);
959		i++;
960		if (0xD800 <= word && word <= 0xDBFF)
961		{
962			char += string[i];
963			i++;
964		}
965		state = A2(func, _Utils_chr(char), state);
966	}
967	return state;
968});
969
970var _String_foldr = F3(function(func, state, string)
971{
972	var i = string.length;
973	while (i--)
974	{
975		var char = string[i];
976		var word = string.charCodeAt(i);
977		if (0xDC00 <= word && word <= 0xDFFF)
978		{
979			i--;
980			char = string[i] + char;
981		}
982		state = A2(func, _Utils_chr(char), state);
983	}
984	return state;
985});
986
987var _String_split = F2(function(sep, str)
988{
989	return str.split(sep);
990});
991
992var _String_join = F2(function(sep, strs)
993{
994	return strs.join(sep);
995});
996
997var _String_slice = F3(function(start, end, str) {
998	return str.slice(start, end);
999});
1000
1001function _String_trim(str)
1002{
1003	return str.trim();
1004}
1005
1006function _String_trimLeft(str)
1007{
1008	return str.replace(/^\s+/, '');
1009}
1010
1011function _String_trimRight(str)
1012{
1013	return str.replace(/\s+$/, '');
1014}
1015
1016function _String_words(str)
1017{
1018	return _List_fromArray(str.trim().split(/\s+/g));
1019}
1020
1021function _String_lines(str)
1022{
1023	return _List_fromArray(str.split(/\r\n|\r|\n/g));
1024}
1025
1026function _String_toUpper(str)
1027{
1028	return str.toUpperCase();
1029}
1030
1031function _String_toLower(str)
1032{
1033	return str.toLowerCase();
1034}
1035
1036var _String_any = F2(function(isGood, string)
1037{
1038	var i = string.length;
1039	while (i--)
1040	{
1041		var char = string[i];
1042		var word = string.charCodeAt(i);
1043		if (0xDC00 <= word && word <= 0xDFFF)
1044		{
1045			i--;
1046			char = string[i] + char;
1047		}
1048		if (isGood(_Utils_chr(char)))
1049		{
1050			return true;
1051		}
1052	}
1053	return false;
1054});
1055
1056var _String_all = F2(function(isGood, string)
1057{
1058	var i = string.length;
1059	while (i--)
1060	{
1061		var char = string[i];
1062		var word = string.charCodeAt(i);
1063		if (0xDC00 <= word && word <= 0xDFFF)
1064		{
1065			i--;
1066			char = string[i] + char;
1067		}
1068		if (!isGood(_Utils_chr(char)))
1069		{
1070			return false;
1071		}
1072	}
1073	return true;
1074});
1075
1076var _String_contains = F2(function(sub, str)
1077{
1078	return str.indexOf(sub) > -1;
1079});
1080
1081var _String_startsWith = F2(function(sub, str)
1082{
1083	return str.indexOf(sub) === 0;
1084});
1085
1086var _String_endsWith = F2(function(sub, str)
1087{
1088	return str.length >= sub.length &&
1089		str.lastIndexOf(sub) === str.length - sub.length;
1090});
1091
1092var _String_indexes = F2(function(sub, str)
1093{
1094	var subLen = sub.length;
1095
1096	if (subLen < 1)
1097	{
1098		return _List_Nil;
1099	}
1100
1101	var i = 0;
1102	var is = [];
1103
1104	while ((i = str.indexOf(sub, i)) > -1)
1105	{
1106		is.push(i);
1107		i = i + subLen;
1108	}
1109
1110	return _List_fromArray(is);
1111});
1112
1113
1114// TO STRING
1115
1116function _String_fromNumber(number)
1117{
1118	return number + '';
1119}
1120
1121
1122// INT CONVERSIONS
1123
1124function _String_toInt(str)
1125{
1126	var total = 0;
1127	var code0 = str.charCodeAt(0);
1128	var start = code0 == 0x2B /* + */ || code0 == 0x2D /* - */ ? 1 : 0;
1129
1130	for (var i = start; i < str.length; ++i)
1131	{
1132		var code = str.charCodeAt(i);
1133		if (code < 0x30 || 0x39 < code)
1134		{
1135			return $elm$core$Maybe$Nothing;
1136		}
1137		total = 10 * total + code - 0x30;
1138	}
1139
1140	return i == start
1141		? $elm$core$Maybe$Nothing
1142		: $elm$core$Maybe$Just(code0 == 0x2D ? -total : total);
1143}
1144
1145
1146// FLOAT CONVERSIONS
1147
1148function _String_toFloat(s)
1149{
1150	// check if it is a hex, octal, or binary number
1151	if (s.length === 0 || /[\sxbo]/.test(s))
1152	{
1153		return $elm$core$Maybe$Nothing;
1154	}
1155	var n = +s;
1156	// faster isNaN check
1157	return n === n ? $elm$core$Maybe$Just(n) : $elm$core$Maybe$Nothing;
1158}
1159
1160function _String_fromList(chars)
1161{
1162	return _List_toArray(chars).join('');
1163}
1164
1165
1166
1167
1168function _Char_toCode(char)
1169{
1170	var code = char.charCodeAt(0);
1171	if (0xD800 <= code && code <= 0xDBFF)
1172	{
1173		return (code - 0xD800) * 0x400 + char.charCodeAt(1) - 0xDC00 + 0x10000
1174	}
1175	return code;
1176}
1177
1178function _Char_fromCode(code)
1179{
1180	return _Utils_chr(
1181		(code < 0 || 0x10FFFF < code)
1182			? '\uFFFD'
1183			:
1184		(code <= 0xFFFF)
1185			? String.fromCharCode(code)
1186			:
1187		(code -= 0x10000,
1188			String.fromCharCode(Math.floor(code / 0x400) + 0xD800, code % 0x400 + 0xDC00)
1189		)
1190	);
1191}
1192
1193function _Char_toUpper(char)
1194{
1195	return _Utils_chr(char.toUpperCase());
1196}
1197
1198function _Char_toLower(char)
1199{
1200	return _Utils_chr(char.toLowerCase());
1201}
1202
1203function _Char_toLocaleUpper(char)
1204{
1205	return _Utils_chr(char.toLocaleUpperCase());
1206}
1207
1208function _Char_toLocaleLower(char)
1209{
1210	return _Utils_chr(char.toLocaleLowerCase());
1211}
1212
1213
1214
1215/**_UNUSED/
1216function _Json_errorToString(error)
1217{
1218	return $elm$json$Json$Decode$errorToString(error);
1219}
1220//*/
1221
1222
1223// CORE DECODERS
1224
1225function _Json_succeed(msg)
1226{
1227	return {
1228		$: 0,
1229		a: msg
1230	};
1231}
1232
1233function _Json_fail(msg)
1234{
1235	return {
1236		$: 1,
1237		a: msg
1238	};
1239}
1240
1241function _Json_decodePrim(decoder)
1242{
1243	return { $: 2, b: decoder };
1244}
1245
1246var _Json_decodeInt = _Json_decodePrim(function(value) {
1247	return (typeof value !== 'number')
1248		? _Json_expecting('an INT', value)
1249		:
1250	(-2147483647 < value && value < 2147483647 && (value | 0) === value)
1251		? $elm$core$Result$Ok(value)
1252		:
1253	(isFinite(value) && !(value % 1))
1254		? $elm$core$Result$Ok(value)
1255		: _Json_expecting('an INT', value);
1256});
1257
1258var _Json_decodeBool = _Json_decodePrim(function(value) {
1259	return (typeof value === 'boolean')
1260		? $elm$core$Result$Ok(value)
1261		: _Json_expecting('a BOOL', value);
1262});
1263
1264var _Json_decodeFloat = _Json_decodePrim(function(value) {
1265	return (typeof value === 'number')
1266		? $elm$core$Result$Ok(value)
1267		: _Json_expecting('a FLOAT', value);
1268});
1269
1270var _Json_decodeValue = _Json_decodePrim(function(value) {
1271	return $elm$core$Result$Ok(_Json_wrap(value));
1272});
1273
1274var _Json_decodeString = _Json_decodePrim(function(value) {
1275	return (typeof value === 'string')
1276		? $elm$core$Result$Ok(value)
1277		: (value instanceof String)
1278			? $elm$core$Result$Ok(value + '')
1279			: _Json_expecting('a STRING', value);
1280});
1281
1282function _Json_decodeList(decoder) { return { $: 3, b: decoder }; }
1283function _Json_decodeArray(decoder) { return { $: 4, b: decoder }; }
1284
1285function _Json_decodeNull(value) { return { $: 5, c: value }; }
1286
1287var _Json_decodeField = F2(function(field, decoder)
1288{
1289	return {
1290		$: 6,
1291		d: field,
1292		b: decoder
1293	};
1294});
1295
1296var _Json_decodeIndex = F2(function(index, decoder)
1297{
1298	return {
1299		$: 7,
1300		e: index,
1301		b: decoder
1302	};
1303});
1304
1305function _Json_decodeKeyValuePairs(decoder)
1306{
1307	return {
1308		$: 8,
1309		b: decoder
1310	};
1311}
1312
1313function _Json_mapMany(f, decoders)
1314{
1315	return {
1316		$: 9,
1317		f: f,
1318		g: decoders
1319	};
1320}
1321
1322var _Json_andThen = F2(function(callback, decoder)
1323{
1324	return {
1325		$: 10,
1326		b: decoder,
1327		h: callback
1328	};
1329});
1330
1331function _Json_oneOf(decoders)
1332{
1333	return {
1334		$: 11,
1335		g: decoders
1336	};
1337}
1338
1339
1340// DECODING OBJECTS
1341
1342var _Json_map1 = F2(function(f, d1)
1343{
1344	return _Json_mapMany(f, [d1]);
1345});
1346
1347var _Json_map2 = F3(function(f, d1, d2)
1348{
1349	return _Json_mapMany(f, [d1, d2]);
1350});
1351
1352var _Json_map3 = F4(function(f, d1, d2, d3)
1353{
1354	return _Json_mapMany(f, [d1, d2, d3]);
1355});
1356
1357var _Json_map4 = F5(function(f, d1, d2, d3, d4)
1358{
1359	return _Json_mapMany(f, [d1, d2, d3, d4]);
1360});
1361
1362var _Json_map5 = F6(function(f, d1, d2, d3, d4, d5)
1363{
1364	return _Json_mapMany(f, [d1, d2, d3, d4, d5]);
1365});
1366
1367var _Json_map6 = F7(function(f, d1, d2, d3, d4, d5, d6)
1368{
1369	return _Json_mapMany(f, [d1, d2, d3, d4, d5, d6]);
1370});
1371
1372var _Json_map7 = F8(function(f, d1, d2, d3, d4, d5, d6, d7)
1373{
1374	return _Json_mapMany(f, [d1, d2, d3, d4, d5, d6, d7]);
1375});
1376
1377var _Json_map8 = F9(function(f, d1, d2, d3, d4, d5, d6, d7, d8)
1378{
1379	return _Json_mapMany(f, [d1, d2, d3, d4, d5, d6, d7, d8]);
1380});
1381
1382
1383// DECODE
1384
1385var _Json_runOnString = F2(function(decoder, string)
1386{
1387	try
1388	{
1389		var value = JSON.parse(string);
1390		return _Json_runHelp(decoder, value);
1391	}
1392	catch (e)
1393	{
1394		return $elm$core$Result$Err(A2($elm$json$Json$Decode$Failure, 'This is not val
1394id JSON! ' + e.message, _Json_wrap(string)));
1395	}
1396});
1397
1398var _Json_run = F2(function(decoder, value)
1399{
1400	return _Json_runHelp(decoder, _Json_unwrap(value));
1401});
1402
1403function _Json_runHelp(decoder, value)
1404{
1405	switch (decoder.$)
1406	{
1407		case 2:
1408			return decoder.b(value);
1409
1410		case 5:
1411			return (value === null)
1412				? $elm$core$Result$Ok(decoder.c)
1413				: _Json_expecting('null', value);
1414
1415		case 3:
1416			if (!_Json_isArray(value))
1417			{
1418				return _Json_expecting('a LIST', value);
1419			}
1420			return _Json_runArrayDecoder(decoder.b, value, _List_fromArray);
1421
1422		case 4:
1423			if (!_Json_isArray(value))
1424			{
1425				return _Json_expecting('an ARRAY', value);
1426			}
1427			return _Json_runArrayDecoder(decoder.b, value, _Json_toElmArray);
1428
1429		case 6:
1430			var field = decoder.d;
1431			if (typeof value !== 'object' || value === null || !(field in value))
1432			{
1433				return _Json_expecting('an OBJECT with a field named `' + field + '`', value);
1434			}
1435			var result = _Json_runHelp(decoder.b, value[field]);
1436			return ($elm$core$Result$isOk(result)) ? result : $elm$core$Result$Err(A2($elm$json$Json$Decode$Field, field, result.a));
1437
1438		case 7:
1439			var index = decoder.e;
1440			if (!_Json_isArray(value))
1441			{
1442				return _Json_expecting('an ARRAY', value);
1443			}
1444			if (index >= value.length)
1445			{
1446				return _Json_expecting('a LONGER array. Need index ' + index + ' but only see ' + value.length + ' entries', value);
1447			}
1448			var result = _Json_runHelp(decoder.b, value[index]);
1449			return ($elm$core$Result$isOk(result)) ? result : $elm$core$Result$Err(A2($elm$json$Json$Decode$Index, index, result.a));
1450
1451		case 8:
1452			if (typeof value !== 'object' || value === null || _Json_isArray(value))
1453			{
1454				return _Json_expecting('an OBJECT', value);
1455			}
1456
1457			var keyValuePairs = _List_Nil;
1458			// TODO test perf of Object.keys and switch when support is good enough
1459			for (var key in value)
1460			{
1461				if (value.hasOwnProperty(key))
1462				{
1463					var result = _Json_runHelp(decoder.b, value[key]);
1464					if (!$elm$core$Result$isOk(result))
1465					{
1466						return $elm$core$Result$Err(A2($elm$json$Json$Decode$Field, key, result.a));
1467					}
1468					keyValuePairs = _List_Cons(_Utils_Tuple2(key, result.a), keyValuePairs);
1469				}
1470			}
1471			return $elm$core$Result$Ok($elm$core$List$reverse(keyValuePairs));
1472
1473		case 9:
1474			var answer = decoder.f;
1475			var decoders = decoder.g;
1476			for (var i = 0; i < decoders.length; i++)
1477			{
1478				var result = _Json_runHelp(decoders[i], value);
1479				if (!$elm$core$Result$isOk(result))
1480				{
1481					return result;
1482				}
1483				answer = answer(result.a);
1484			}
1485			return $elm$core$Result$Ok(answer);
1486
1487		case 10:
1488			var result = _Json_runHelp(decoder.b, value);
1489			return (!$elm$core$Result$isOk(result))
1490				? result
1491				: _Json_runHelp(decoder.h(result.a), value);
1492
1493		case 11:
1494			var errors = _List_Nil;
1495			for (var temp = decoder.g; temp.b; temp = temp.b) // WHILE_CONS
1496			{
1497				var result = _Json_runHelp(temp.a, value);
1498				if ($elm$core$Result$isOk(result))
1499				{
1500					return result;
1501				}
1502				errors = _List_Cons(result.a, errors);
1503			}
1504			return $elm$core$Result$Err($elm$json$Json$Decode$OneOf($elm$core$List$reverse(errors)));
1505
1506		case 1:
1507			return $elm$core$Result$Err(A2($elm$json$Json$Decode$Failure, decoder.a, _Json_wrap(value)));
1508
1509		case 0:
1510			return $elm$core$Result$Ok(decoder.a);
1511	}
1512}
1513
1514function _Json_runArrayDecoder(decoder, value, toElmValue)
1515{
1516	var len = value.length;
1517	var array = new Array(len);
1518	for (var i = 0; i < len; i++)
1519	{
1520		var result = _Json_runHelp(decoder, value[i]);
1521		if (!$elm$core$Result$isOk(result))
1522		{
1523			return $elm$core$Result$Err(A2($elm$json$Json$Decode$Index, i, result.a));
1524		}
1525		array[i] = result.a;
1526	}
1527	return $elm$core$Result$Ok(toElmValue(array));
1528}
1529
1530function _Json_isArray(value)
1531{
1532	return Array.isArray(value) || (typeof FileList !== 'undefined' && value instanceof FileList);
1533}
1534
1535function _Json_toElmArray(array)
1536{
1537	return A2($elm$core$Array$initialize, array.length, function(i) { return array[i]; });
1538}
1539
1540function _Json_expecting(type, value)
1541{
1542	return $elm$core$Result$Err(A2($elm$json$Json$Decode$Failure, 'Expecting ' + type, _Json_wrap(value)));
1543}
1544
1545
1546// EQUALITY
1547
1548function _Json_equality(x, y)
1549{
1550	if (x === y)
1551	{
1552		return true;
1553	}
1554
1555	if (x.$ !== y.$)
1556	{
1557		return false;
1558	}
1559
1560	switch (x.$)
1561	{
1562		case 0:
1563		case 1:
1564			return x.a === y.a;
1565
1566		case 2:
1567			return x.b === y.b;
1568
1569		case 5:
1570			return x.c === y.c;
1571
1572		case 3:
1573		case 4:
1574		case 8:
1575			return _Json_equality(x.b, y.b);
1576
1577		case 6:
1578			return x.d === y.d && _Json_equality(x.b, y.b);
1579
1580		case 7:
1581			return x.e === y.e && _Json_equality(x.b, y.b);
1582
1583		case 9:
1584			return x.f === y.f && _Json_listEquality(x.g, y.g);
1585
1586		case 10:
1587			return x.h === y.h && _Json_equality(x.b, y.b);
1588
1589		case 11:
1590			return _Json_listEquality(x.g, y.g);
1591	}
1592}
1593
1594function _Json_listEquality(aDecoders, bDecoders)
1595{
1596	var len = aDecoders.length;
1597	if (len !== bDecoders.length)
1598	{
1599		return false;
1600	}
1601	for (var i = 0; i < len; i++)
1602	{
1603		if (!_Json_equality(aDecoders[i], bDecoders[i]))
1604		{
1605			return false;
1606		}
1607	}
1608	return true;
1609}
1610
1611
1612// ENCODE
1613
1614var _Json_encode = F2(function(indentLevel, value)
1615{
1616	return JSON.stringify(_Json_unwrap(value), null, indentLevel) + '';
1617});
1618
1619function _Json_wrap_UNUSED(value) { return { $: 0, a: value }; }
1620function _Json_unwrap_UNUSED(value) { return value.a; }
1621
1622function _Json_wrap(value) { return value; }
1623function _Json_unwrap(value) { return value; }
1624
1625function _Json_emptyArray() { return []; }
1626function _Json_emptyObject() { return {}; }
1627
1628var _Json_addField = F3(function(key, value, object)
1629{
1630	object[key] = _Json_unwrap(value);
1631	return object;
1632});
1633
1634function _Json_addEntry(func)
1635{
1636	return F2(function(entry, array)
1637	{
1638		array.push(_Json_unwrap(func(entry)));
1639		return array;
1640	});
1641}
1642
1643var _Json_encodeNull = _Json_wrap(null);
1644
1645
1646
1647// TASKS
1648
1649function _Scheduler_succeed(value)
1650{
1651	return {
1652		$: 0,
1653		a: value
1654	};
1655}
1656
1657function _Scheduler_fail(error)
1658{
1659	return {
1660		$: 1,
1661		a: error
1662	};
1663}
1664
1665function _Scheduler_binding(callback)
1666{
1667	return {
1668		$: 2,
1669		b: callback,
1670		c: null
1671	};
1672}
1673
1674var _Scheduler_andThen = F2(function(callback, task)
1675{
1676	return {
1677		$: 3,
1678		b: callback,
1679		d: task
1680	};
1681});
1682
1683var _Scheduler_onError = F2(function(callback, task)
1684{
1685	return {
1686		$: 4,
1687		b: callback,
1688		d: task
1689	};
1690});
1691
1692function _Scheduler_receive(callback)
1693{
1694	return {
1695		$: 5,
1696		b: callback
1697	};
1698}
1699
1700
1701// PROCESSES
1702
1703var _Scheduler_guid = 0;
1704
1705function _Scheduler_rawSpawn(task)
1706{
1707	var proc = {
1708		$: 0,
1709		e: _Scheduler_guid++,
1710		f: task,
1711		g: null,
1712		h: []
1713	};
1714
1715	_Scheduler_enqueue(proc);
1716
1717	return proc;
1718}
1719
1720function _Scheduler_spawn(task)
1721{
1722	return _Scheduler_binding(function(callback) {
1723		callback(_Scheduler_succeed(_Scheduler_rawSpawn(task)));
1724	});
1725}
1726
1727function _Scheduler_rawSend(proc, msg)
1728{
1729	proc.h.push(msg);
1730	_Scheduler_enqueue(proc);
1731}
1732
1733var _Scheduler_send = F2(function(proc, msg)
1734{
1735	return _Scheduler_binding(function(callback) {
1736		_Scheduler_rawSend(proc, msg);
1737		callback(_Scheduler_succeed(_Utils_Tuple0));
1738	});
1739});
1740
1741function _Scheduler_kill(proc)
1742{
1743	return _Scheduler_binding(function(callback) {
1744		var task = proc.f;
1745		if (task.$ === 2 && task.c)
1746		{
1747			task.c();
1748		}
1749
1750		proc.f = null;
1751
1752		callback(_Scheduler_succeed(_Utils_Tuple0));
1753	});
1754}
1755
1756
1757/* STEP PROCESSES
1758
1759type alias Process =
1760  { $ : tag
1761  , id : unique_id
1762  , root : Task
1763  , stack : null | { $: SUCCEED | FAIL, a: callback, b: stack }
1764  , mailbox : [msg]
1765  }
1766
1767*/
1768
1769
1770var _Scheduler_working = false;
1771var _Scheduler_queue = [];
1772
1773
1774function _Scheduler_enqueue(proc)
1775{
1776	_Scheduler_queue.push(proc);
1777	if (_Scheduler_working)
1778	{
1779		return;
1780	}
1781	_Scheduler_working = true;
1782	while (proc = _Scheduler_queue.shift())
1783	{
1784		_Scheduler_step(proc);
1785	}
1786	_Scheduler_working = false;
1787}
1788
1789
1790function _Scheduler_step(proc)
1791{
1792	while (proc.f)
1793	{
1794		var rootTag = proc.f.$;
1795		if (rootTag === 0 || rootTag === 1)
1796		{
1797			while (proc.g && proc.g.$ !== rootTag)
1798			{
1799				proc.g = proc.g.i;
1800			}
1801			if (!proc.g)
1802			{
1803				return;
1804			}
1805			proc.f = proc.g.b(proc.f.a);
1806			proc.g = proc.g.i;
1807		}
1808		else if (rootTag === 2)
1809		{
1810			proc.f.c = proc.f.b(function(newRoot) {
1811				proc.f = newRoot;
1812				_Scheduler_enqueue(proc);
1813			});
1814			return;
1815		}
1816		else if (rootTag === 5)
1817		{
1818			if (proc.h.length === 0)
1819			{
1820				return;
1821			}
1822			proc.f = proc.f.b(proc.h.shift());
1823		}
1824		else // if (rootTag === 3 || rootTag === 4)
1825		{
1826			proc.g = {
1827				$: rootTag === 3 ? 0 : 1,
1828				b: proc.f.b,
1829				i: proc.g
1830			};
1831			proc.f = proc.f.d;
1832		}
1833	}
1834}
1835
1836
1837
1838function _Process_sleep(time)
1839{
1840	return _Scheduler_binding(function(callback) {
1841		var id = setTimeout(function() {
1842			callback(_Scheduler_succeed(_Utils_Tuple0));
1843		}, time);
1844
1845		return function() { clearTimeout(id); };
1846	});
1847}
1848
1849
1850
1851
1852// PROGRAMS
1853
1854
1855var _Platform_worker = F4(function(impl, flagDecoder, debugMetadata, args)
1856{
1857	return _Platform_initialize(
1858		flagDecoder,
1859		args,
1860		impl.bR,
1861		impl.b8,
1862		impl.b5,
1863		function() { return function() {} }
1864	);
1865});
1866
1867
1868
1869// INITIALIZE A PROGRAM
1870
1871
1872function _Platform_initialize(flagDecoder, args, init, update, subscriptions, stepperBuilder)
1873{
1874	var result = A2(_Json_run, flagDecoder, _Json_wrap(args ? args['flags'] : undefined));
1875	$elm$core$Result$isOk(result) || _Debug_crash(2 /**_UNUSED/, _Json_errorToString(result.a) /**/);
1876	var managers = {};
1877	var initPair = init(result.a);
1878	var model = initPair.a;
1879	var stepper = stepperBuilder(sendToApp, model);
1880	var ports = _Platform_setupEffects(managers, sendToApp);
1881
1882	function sendToApp(msg, viewMetadata)
1883	{
1884		var pair = A2(update, msg, model);
1885		stepper(model = pair.a, viewMetadata);
1886		_Platform_enqueueEffects(managers, pair.b, subscriptions(model));
1887	}
1888
1889	_Platform_enqueueEffects(managers, initPair.b, subscriptions(model));
1890
1891	return ports ? { ports: ports } : {};
1892}
1893
1894
1895
1896// TRACK PRELOADS
1897//
1898// This is used by code in elm/browser and elm/http
1899// to register any HTTP requests that are triggered by init.
1900//
1901
1902
1903var _Platform_preload;
1904
1905
1906function _Platform_registerPreload(url)
1907{
1908	_Platform_preload.add(url);
1909}
1910
1911
1912
1913// EFFECT MANAGERS
1914
1915
1916var _Platform_effectManagers = {};
1917
1918
1919function _Platform_setupEffects(managers, sendToApp)
1920{
1921	var ports;
1922
1923	// setup all necessary effect managers
1924	for (var key in _Platform_effectManagers)
1925	{
1926		var manager = _Platform_effectManagers[key];
1927
1928		if (manager.a)
1929		{
1930			ports = ports || {};
1931			ports[key] = manager.a(key, sendToApp);
1932		}
1933
1934		managers[key] = _Platform_instantiateManager(manager, sendToApp);
1935	}
1936
1937	return ports;
1938}
1939
1940
1941function _Platform_createManager(init, onEffects, onSelfMsg, cmdMap, subMap)
1942{
1943	return {
1944		b: init,
1945		c: onEffects,
1946		d: onSelfMsg,
1947		e: cmdMap,
1948		f: subMap
1949	};
1950}
1951
1952
1953function _Platform_instantiateManager(info, sendToApp)
1954{
1955	var router = {
1956		g: sendToApp,
1957		h: undefined
1958	};
1959
1960	var onEffects = info.c;
1961	var onSelfMsg = info.d;
1962	var cmdMap = info.e;
1963	var subMap = info.f;
1964
1965	function loop(state)
1966	{
1967		return A2(_Scheduler_andThen, loop, _Scheduler_receive(function(msg)
1968		{
1969			var value = msg.a;
1970
1971			if (msg.$ === 0)
1972			{
1973				return A3(onSelfMsg, router, value, state);
1974			}
1975
1976			return cmdMap && subMap
1977				? A4(onEffects, router, value.i, value.j, state)
1978				: A3(onEffects, router, cmdMap ? value.i : value.j, state);
1979		}));
1980	}
1981
1982	return router.h = _Scheduler_rawSpawn(A2(_Scheduler_andThen, loop, info.b));
1983}
1984
1985
1986
1987// ROUTING
1988
1989
1990var _Platform_sendToApp = F2(function(router, msg)
1991{
1992	return _Scheduler_binding(function(callback)
1993	{
1994		router.g(msg);
1995		callback(_Scheduler_succeed(_Utils_Tuple0));
1996	});
1997});
1998
1999
2000var _Platform_sendToSelf = F2(function(router, msg)
2001{
2002	return A2(_Scheduler_send, router.h, {
2003		$: 0,
2004		a: msg
2005	});
2006});
2007
2008
2009
2010// BAGS
2011
2012
2013function _Platform_leaf(home)
2014{
2015	return function(value)
2016	{
2017		return {
2018			$: 1,
2019			k: home,
2020			l: value
2021		};
2022	};
2023}
2024
2025
2026function _Platform_batch(list)
2027{
2028	return {
2029		$: 2,
2030		m: list
2031	};
2032}
2033
2034
2035var _Platform_map = F2(function(tagger, bag)
2036{
2037	return {
2038		$: 3,
2039		n: tagger,
2040		o: bag
2041	}
2042});
2043
2044
2045
2046// PIPE BAGS INTO EFFECT MANAGERS
2047//
2048// Effects must be queued!
2049//
2050// Say your init contains a synchronous command, like Time.now or Time.here
2051//
2052//   - This will produce a batch of effects (FX_1)
2053//   - The synchronous task triggers the subsequent `update` call
2054//   - This will produce a batch of effects (FX_2)
2055//
2056// If we just start dispatching FX_2, subscriptions from FX_2 can be processed
2057// before subscriptions from FX_1. No good! Earlier versions of this code had
2058// this problem, leading to these reports:
2059//
2060//   https://github.com/elm/core/issues/980
2061//   https://github.com/elm/core/pull/981
2062//   https://github.com/elm/compiler/issues/1776
2063//
2064// The queue is necessary to avoid ordering issues for synchronous commands.
2065
2066
2067// Why use true/false here? Why not just check the length of the queue?
2068// The goal is to detect "are we currently dispatching effects?" If we
2069// are, we need to bail and let the ongoing while loop handle things.
2070//
2071// Now say the queue has 1 element. When we dequeue the final element,
2072// the queue will be empty, but we are still actively dispatching effects.
2073// So you could get queue jumping in a really tricky category of cases.
2074//
2075var _Platform_effectsQueue = [];
2076var _Platform_effectsActive = false;
2077
2078
2079function _Platform_enqueueEffects(managers, cmdBag, subBag)
2080{
2081	_Platform_effectsQueue.push({ p: managers, q: cmdBag, r: subBag });
2082
2083	if (_Platform_effectsActive) return;
2084
2085	_Platform_effectsActive = true;
2086	for (var fx; fx = _Platform_effectsQueue.shift(); )
2087	{
2088		_Platform_dispatchEffects(fx.p, fx.q, fx.r);
2089	}
2090	_Platform_effectsActive = false;
2091}
2092
2093
2094function _Platform_dispatchEffects(managers, cmdBag, subBag)
2095{
2096	var effectsDict = {};
2097	_Platform_gatherEffects(true, cmdBag, effectsDict, null);
2098	_Platform_gatherEffects(false, subBag, effectsDict, null);
2099
2100	for (var home in managers)
2101	{
2102		_Scheduler_rawSend(managers[home], {
2103			$: 'fx',
2104			a: effectsDict[home] || { i: _List_Nil, j: _List_Nil }
2105		});
2106	}
2107}
2108
2109
2110function _Platform_gatherEffects(isCmd, bag, effectsDict, taggers)
2111{
2112	switch (bag.$)
2113	{
2114		case 1:
2115			var home = bag.k;
2116			var effect = _Platform_toEffect(isCmd, home, taggers, bag.l);
2117			effectsDict[home] = _Platform_insert(isCmd, effect, effectsDict[home]);
2118			return;
2119
2120		case 2:
2121			for (var list = bag.m; list.b; list = list.b) // WHILE_CONS
2122			{
2123				_Platform_gatherEffects(isCmd, list.a, effectsDict, taggers);
2124			}
2125			return;
2126
2127		case 3:
2128			_Platform_gatherEffects(isCmd, bag.o, effectsDict, {
2129				s: bag.n,
2130				t: taggers
2131			});
2132			return;
2133	}
2134}
2135
2136
2137function _Platform_toEffect(isCmd, home, taggers, value)
2138{
2139	function applyTaggers(x)
2140	{
2141		for (var temp = taggers; temp; temp = temp.t)
2142		{
2143			x = temp.s(x);
2144		}
2145		return x;
2146	}
2147
2148	var map = isCmd
2149		? _Platform_effectManagers[home].e
2150		: _Platform_effectManagers[home].f;
2151
2152	return A2(map, applyTaggers, value)
2153}
2154
2155
2156function _Platform_insert(isCmd, newEffect, effects)
2157{
2158	effects = effects || { i: _List_Nil, j: _List_Nil };
2159
2160	isCmd
2161		? (effects.i = _List_Cons(newEffect, effects.i))
2162		: (effects.j = _List_Cons(newEffect, effects.j));
2163
2164	return effects;
2165}
2166
2167
2168
2169// PORTS
2170
2171
2172function _Platform_checkPortName(name)
2173{
2174	if (_Platform_effectManagers[name])
2175	{
2176		_Debug_crash(3, name)
2177	}
2178}
2179
2180
2181
2182// OUTGOING PORTS
2183
2184
2185function _Platform_outgoingPort(name, converter)
2186{
2187	_Platform_checkPortName(name);
2188	_Platform_effectManagers[name] = {
2189		e: _Platform_outgoingPortMap,
2190		u: converter,
2191		a: _Platform_setupOutgoingPort
2192	};
2193	return _Platform_leaf(name);
2194}
2195
2196
2197var _Platform_outgoingPortMap = F2(function(tagger, value) { return value; });
2198
2199
2200function _Platform_setupOutgoingPort(name)
2201{
2202	var subs = [];
2203	var converter = _Platform_effectManagers[name].u;
2204
2205	// CREATE MANAGER
2206
2207	var init = _Process_sleep(0);
2208
2209	_Platform_effectManagers[name].b = init;
2210	_Platform_effectManagers[name].c = F3(function(router, cmdList, state)
2211	{
2212		for ( ; cmdList.b; cmdList = cmdList.b) // WHILE_CONS
2213		{
2214			// grab a separate reference to subs in case unsubscribe is called
2215			var currentSubs = subs;
2216			var value = _Json_unwrap(converter(cmdList.a));
2217			for (var i = 0; i < currentSubs.length; i++)
2218			{
2219				currentSubs[i](value);
2220			}
2221		}
2222		return init;
2223	});
2224
2225	// PUBLIC API
2226
2227	function subscribe(callback)
2228	{
2229		subs.push(callback);
2230	}
2231
2232	function unsubscribe(callback)
2233	{
2234		// copy subs into a new array in case unsubscribe is called within a
2235		// subscribed callback
2236		subs = subs.slice();
2237		var index = subs.indexOf(callback);
2238		if (index >= 0)
2239		{
2240			subs.splice(index, 1);
2241		}
2242	}
2243
2244	return {
2245		subscribe: subscribe,
2246		unsubscribe: unsubscribe
2247	};
2248}
2249
2250
2251
2252// INCOMING PORTS
2253
2254
2255function _Platform_incomingPort(name, converter)
2256{
2257	_Platform_checkPortName(name);
2258	_Platform_effectManagers[name] = {
2259		f: _Platform_incomingPortMap,
2260		u: converter,
2261		a: _Platform_setupIncomingPort
2262	};
2263	return _Platform_leaf(name);
2264}
2265
2266
2267var _Platform_incomingPortMap = F2(function(tagger, finalTagger)
2268{
2269	return function(value)
2270	{
2271		return tagger(finalTagger(value));
2272	};
2273});
2274
2275
2276function _Platform_setupIncomingPort(name, sendToApp)
2277{
2278	var subs = _List_Nil;
2279	var converter = _Platform_effectManagers[name].u;
2280
2281	// CREATE MANAGER
2282
2283	var init = _Scheduler_succeed(null);
2284
2285	_Platform_effectManagers[name].b = init;
2286	_Platform_effectManagers[name].c = F3(function(router, subList, state)
2287	{
2288		subs = subList;
2289		return init;
2290	});
2291
2292	// PUBLIC API
2293
2294	function send(incomingValue)
2295	{
2296		var result = A2(_Json_run, converter, _Json_wrap(incomingValue));
2297
2298		$elm$core$Result$isOk(result) || _Debug_crash(4, name, result.a);
2299
2300		var value = result.a;
2301		for (var temp = subs; temp.b; temp = temp.b) // WHILE_CONS
2302		{
2303			sendToApp(temp.a(value));
2304		}
2305	}
2306
2307	return { send: send };
2308}
2309
2310
2311
2312// EXPORT ELM MODULES
2313//
2314// Have DEBUG and PROD versions so that we can (1) give nicer errors in
2315// debug mode and (2) not pay for the bits needed for that in prod mode.
2316//
2317
2318
2319function _Platform_export(exports)
2320{
2321	scope['Elm']
2322		? _Platform_mergeExportsProd(scope['Elm'], exports)
2323		: scope['Elm'] = exports;
2324}
2325
2326
2327function _Platform_mergeExportsProd(obj, exports)
2328{
2329	for (var name in exports)
2330	{
2331		(name in obj)
2332			? (name == 'init')
2333				? _Debug_crash(6)
2334				: _Platform_mergeExportsProd(obj[name], exports[name])
2335			: (obj[name] = exports[name]);
2336	}
2337}
2338
2339
2340function _Platform_export_UNUSED(exports)
2341{
2342	scope['Elm']
2343		? _Platform_mergeExportsDebug('Elm', scope['Elm'], exports)
2344		: scope['Elm'] = exports;
2345}
2346
2347
2348function _Platform_mergeExportsDebug(moduleName, obj, exports)
2349{
2350	for (var name in exports)
2351	{
2352		(name in obj)
2353			? (name == 'init')
2354				? _Debug_crash(6, moduleName)
2355				: _Platform_mergeExportsDebug(moduleName + '.' + name, obj[name], exports[name])
2356			: (obj[name] = exports[name]);
2357	}
2358}
2359
2360
2361
2362
2363// HELPERS
2364
2365
2366var _VirtualDom_divertHrefToApp;
2367
2368var _VirtualDom_doc = typeof document !== 'undefined' ? document : {};
2369
2370
2371function _VirtualDom_appendChild(parent, child)
2372{
2373	parent.appendChild(child);
2374}
2375
2376var _VirtualDom_init = F4(function(virtualNode, flagDecoder, debugMetadata, args)
2377{
2378	// NOTE: this function needs _Platform_export available to work
2379
2380	/**/
2381	var node = args['node'];
2382	//*/
2383	/**_UNUSED/
2384	var node = args && args['node'] ? args['node'] : _Debug_crash(0);
2385	//*/
2386
2387	node.parentNode.replaceChild(
2388		_VirtualDom_render(virtualNode, function() {}),
2389		node
2390	);
2391
2392	return {};
2393});
2394
2395
2396
2397// TEXT
2398
2399
2400function _VirtualDom_text(string)
2401{
2402	return {
2403		$: 0,
2404		a: string
2405	};
2406}
2407
2408
2409
2410// NODE
2411
2412
2413var _VirtualDom_nodeNS = F2(function(namespace, tag)
2414{
2415	return F2(function(factList, kidList)
2416	{
2417		for (var kids = [], descendantsCount = 0; kidList.b; kidList = kidList.b) // WHILE_CONS
2418		{
2419			var kid = kidList.a;
2420			descendantsCount += (kid.b || 0);
2421			kids.push(kid);
2422		}
2423		descendantsCount += kids.length;
2424
2425		return {
2426			$: 1,
2427			c: tag,
2428			d: _VirtualDom_organizeFacts(factList),
2429			e: kids,
2430			f: namespace,
2431			b: descendantsCount
2432		};
2433	});
2434});
2435
2436
2437var _VirtualDom_node = _VirtualDom_nodeNS(undefined);
2438
2439
2440
2441// KEYED NODE
2442
2443
2444var _VirtualDom_keyedNodeNS = F2(function(namespace, tag)
2445{
2446	return F2(function(factList, kidList)
2447	{
2448		for (var kids = [], descendantsCount = 0; kidList.b; kidList = kidList.b) // WHILE_CONS
2449		{
2450			var kid = kidList.a;
2451			descendantsCount += (kid.b.b || 0);
2452			kids.push(kid);
2453		}
2454		descendantsCount += kids.length;
2455
2456		return {
2457			$: 2,
2458			c: tag,
2459			d: _VirtualDom_organizeFacts(factList),
2460			e: kids,
2461			f: namespace,
2462			b: descendantsCount
2463		};
2464	});
2465});
2466
2467
2468var _VirtualDom_keyedNode = _VirtualDom_keyedNodeNS(undefined);
2469
2470
2471
2472// CUSTOM
2473
2474
2475function _VirtualDom_custom(factList, model, render, diff)
2476{
2477	return {
2478		$: 3,
2479		d: _VirtualDom_organizeFacts(factList),
2480		g: model,
2481		h: render,
2482		i: diff
2483	};
2484}
2485
2486
2487
2488// MAP
2489
2490
2491var _VirtualDom_map = F2(function(tagger, node)
2492{
2493	return {
2494		$: 4,
2495		j: tagger,
2496		k: node,
2497		b: 1 + (node.b || 0)
2498	};
2499});
2500
2501
2502
2503// LAZY
2504
2505
2506function _VirtualDom_thunk(refs, thunk)
2507{
2508	return {
2509		$: 5,
2510		l: refs,
2511		m: thunk,
2512		k: undefined
2513	};
2514}
2515
2516var _VirtualDom_lazy = F2(function(func, a)
2517{
2518	return _VirtualDom_thunk([func, a], function() {
2519		return func(a);
2520	});
2521});
2522
2523var _VirtualDom_lazy2 = F3(function(func, a, b)
2524{
2525	return _VirtualDom_thunk([func, a, b], function() {
2526		return A2(func, a, b);
2527	});
2528});
2529
2530var _VirtualDom_lazy3 = F4(function(func, a, b, c)
2531{
2532	return _VirtualDom_thunk([func, a, b, c], function() {
2533		return A3(func, a, b, c);
2534	});
2535});
2536
2537var _VirtualDom_lazy4 = F5(function(func, a, b, c, d)
2538{
2539	return _VirtualDom_thunk([func, a, b, c, d], function() {
2540		return A4(func, a, b, c, d);
2541	});
2542});
2543
2544var _VirtualDom_lazy5 = F6(function(func, a, b, c, d, e)
2545{
2546	return _VirtualDom_thunk([func, a, b, c, d, e], function() {
2547		return A5(func, a, b, c, d, e);
2548	});
2549});
2550
2551var _VirtualDom_lazy6 = F7(function(func, a, b, c, d, e, f)
2552{
2553	return _VirtualDom_thunk([func, a, b, c, d, e, f], function() {
2554		return A6(func, a, b, c, d, e, f);
2555	});
2556});
2557
2558var _VirtualDom_lazy7 = F8(function(func, a, b, c, d, e, f, g)
2559{
2560	return _VirtualDom_thunk([func, a, b, c, d, e, f, g], function() {
2561		return A7(func, a, b, c, d, e, f, g);
2562	});
2563});
2564
2565var _VirtualDom_lazy8 = F9(function(func, a, b, c, d, e, f, g, h)
2566{
2567	return _VirtualDom_thunk([func, a, b, c, d, e, f, g, h], function() {
2568		return A8(func, a, b, c, d, e, f, g, h);
2569	});
2570});
2571
2572
2573
2574// FACTS
2575
2576
2577var _VirtualDom_on = F2(function(key, handler)
2578{
2579	return {
2580		$: 'a0',
2581		n: key,
2582		o: handler
2583	};
2584});
2585var _VirtualDom_style = F2(function(key, value)
2586{
2587	return {
2588		$: 'a1',
2589		n: key,
2590		o: value
2591	};
2592});
2593var _VirtualDom_property = F2(function(key, value)
2594{
2595	return {
2596		$: 'a2',
2597		n: key,
2598		o: value
2599	};
2600});
2601var _VirtualDom_attribute = F2(function(key, value)
2602{
2603	return {
2604		$: 'a3',
2605		n: key,
2606		o: value
2607	};
2608});
2609var _VirtualDom_attributeNS = F3(function(namespace, key, value)
2610{
2611	return {
2612		$: 'a4',
2613		n: key,
2614		o: { f: namespace, o: value }
2615	};
2616});
2617
2618
2619
2620// XSS ATTACK VECTOR CHECKS
2621//
2622// For some reason, tabs can appear in href protocols and it still works.
2623// So '\tjava\tSCRIPT:alert("!!!")' and 'javascript:alert("!!!")' are the same
2624// in practice. That is why _VirtualDom_RE_js and _VirtualDom_RE_js_html look
2625// so freaky.
2626//
2627// Pulling the regular expressions out to the top level gives a slight speed
2628// boost in small benchmarks (4-10%) but hoisting values to reduce allocation
2629// can be unpredictable in large programs where JIT may have a harder time with
2630// functions are not fully self-contained. The benefit is more that the js and
2631// js_html ones are so weird that I prefer to see them near each other.
2632
2633
2634var _VirtualDom_RE_script = /^script$/i;
2635var _VirtualDom_RE_on_formAction = /^(on|formAction$)/i;
2636var _VirtualDom_RE_js = /^\s*j\s*a\s*v\s*a\s*s\s*c\s*r\s*i\s*p\s*t\s*:/i;
2637var _VirtualDom_RE_js_html = /^\s*(j\s*a\s*v\s*a\s*s\s*c\s*r\s*i\s*p\s*t\s*:|d\s*a\s*t\s*a\s*:\s*t\s*e\s*x\s*t\s*\/\s*h\s*t\s*m\s*l\s*(,|;))/i;
2638
2639
2640function _VirtualDom_noScript(tag)
2641{
2642	return _VirtualDom_RE_script.test(tag) ? 'p' : tag;
2643}
2644
2645function _VirtualDom_noOnOrFormAction(key)
2646{
2647	return _VirtualDom_RE_on_formAction.test(key) ? 'data-' + key : key;
2648}
2649
2650function _VirtualDom_noInnerHtmlOrFormAction(key)
2651{
2652	return key == 'innerHTML' || key == 'formAction' ? 'data-' + key : key;
2653}
2654
2655function _VirtualDom_noJavaScriptUri(value)
2656{
2657	return _VirtualDom_RE_js.test(value)
2658		? /**/''//*//**_UNUSED/'javascript:alert("This is an XSS vector. Please use ports or web components instead.")'//*/
2659		: value;
2660}
2661
2662function _VirtualDom_noJavaScriptOrHtmlUri(value)
2663{
2664	return _VirtualDom_RE_js_html.test(value)
2665		? /**/''//*//**_UNUSED/'javascript:alert("This is an XSS vector. Please use ports or web components instead.")'//*/
2666		: value;
2667}
2668
2669function _VirtualDom_noJavaScriptOrHtmlJson(value)
2670{
2671	return (typeof _Json_unwrap(value) === 'string' && _VirtualDom_RE_js_html.test(_Json_unwrap(value)))
2672		? _Json_wrap(
2673			/**/''//*//**_UNUSED/'javascript:alert("This is an XSS vector. Please use ports or web components instead.")'//*/
2674		) : value;
2675}
2676
2677
2678
2679// MAP FACTS
2680
2681
2682var _VirtualDom_mapAttribute = F2(function(func, attr)
2683{
2684	return (attr.$ === 'a0')
2685		? A2(_VirtualDom_on, attr.n, _VirtualDom_mapHandler(func, attr.o))
2686		: attr;
2687});
2688
2689function _VirtualDom_mapHandler(func, handler)
2690{
2691	var tag = $elm$virtual_dom$VirtualDom$toHandlerInt(handler);
2692
2693	// 0 = Normal
2694	// 1 = MayStopPropagation
2695	// 2 = MayPreventDefault
2696	// 3 = Custom
2697
2698	return {
2699		$: handler.$,
2700		a:
2701			!tag
2702				? A2($elm$json$Json$Decode$map, func, handler.a)
2703				:
2704			A3($elm$json$Json$Decode$map2,
2705				tag < 3
2706					? _VirtualDom_mapEventTuple
2707					: _VirtualDom_mapEventRecord,
2708				$elm$json$Json$Decode$succeed(func),
2709				handler.a
2710			)
2711	};
2712}
2713
2714var _VirtualDom_mapEventTuple = F2(function(func, tuple)
2715{
2716	return _Utils_Tuple2(func(tuple.a), tuple.b);
2717});
2718
2719var _VirtualDom_mapEventRecord = F2(function(func, record)
2720{
2721	return {
2722		Z: func(record.Z),
2723		a0: record.a0,
2724		aY: record.aY
2725	}
2726});
2727
2728
2729
2730// ORGANIZE FACTS
2731
2732
2733function _VirtualDom_organizeFacts(factList)
2734{
2735	for (var facts = {}; factList.b; factList = factList.b) // WHILE_CONS
2736	{
2737		var entry = factList.a;
2738
2739		var tag = entry.$;
2740		var key = entry.n;
2741		var value = entry.o;
2742
2743		if (tag === 'a2')
2744		{
2745			(key === 'className')
2746				? _VirtualDom_addClass(facts, key, _Json_unwrap(value))
2747				: facts[key] = _Json_unwrap(value);
2748
2749			continue;
2750		}
2751
2752		var subFacts = facts[tag] || (facts[tag] = {});
2753		(tag === 'a3' && key === 'class')
2754			? _VirtualDom_addClass(subFacts, key, value)
2755			: subFacts[key] = value;
2756	}
2757
2758	return facts;
2759}
2760
2761function _VirtualDom_addClass(object, key, newClass)
2762{
2763	var classes = object[key];
2764	object[key] = classes ? classes + ' ' + newClass : newClass;
2765}
2766
2767
2768
2769// RENDER
2770
2771
2772function _VirtualDom_render(vNode, eventNode)
2773{
2774	var tag = vNode.$;
2775
2776	if (tag === 5)
2777	{
2778		return _VirtualDom_render(vNode.k || (vNode.k = vNode.m()), eventNode);
2779	}
2780
2781	if (tag === 0)
2782	{
2783		return _VirtualDom_doc.createTextNode(vNode.a);
2784	}
2785
2786	if (tag === 4)
2787	{
2788		var subNode = vNode.k;
2789		var tagger = vNode.j;
2790
2791		while (subNode.$ === 4)
2792		{
2793			typeof tagger !== 'object'
2794				? tagger = [tagger, subNode.j]
2795				: tagger.push(subNode.j);
2796
2797			subNode = subNode.k;
2798		}
2799
2800		var subEventRoot = { j: tagger, p: eventNode };
2801		var domNode = _VirtualDom_render(subNode, subEventRoot);
2802		domNode.elm_event_node_ref = subEventRoot;
2803		return domNode;
2804	}
2805
2806	if (tag === 3)
2807	{
2808		var domNode = vNode.h(vNode.g);
2809		_VirtualDom_applyFacts(domNode, eventNode, vNode.d);
2810		return domNode;
2811	}
2812
2813	// at this point `tag` must be 1 or 2
2814
2815	var domNode = vNode.f
2816		? _VirtualDom_doc.createElementNS(vNode.f, vNode.c)
2817		: _VirtualDom_doc.createElement(vNode.c);
2818
2819	if (_VirtualDom_divertHrefToApp && vNode.c == 'a')
2820	{
2821		domNode.addEventListener('click', _VirtualDom_divertHrefToApp(domNode));
2822	}
2823
2824	_VirtualDom_applyFacts(domNode, eventNode, vNode.d);
2825
2826	for (var kids = vNode.e, i = 0; i < kids.length; i++)
2827	{
2828		_VirtualDom_appendChild(domNode, _VirtualDom_render(tag === 1 ? kids[i] : kids[i].b, eventNode));
2829	}
2830
2831	return domNode;
2832}
2833
2834
2835
2836// APPLY FACTS
2837
2838
2839function _VirtualDom_applyFacts(domNode, eventNode, facts)
2840{
2841	for (var key in facts)
2842	{
2843		var value = facts[key];
2844
2845		key === 'a1'
2846			? _VirtualDom_applyStyles(domNode, value)
2847			:
2848		key === 'a0'
2849			? _VirtualDom_applyEvents(domNode, eventNode, value)
2850			:
2851		key === 'a3'
2852			? _VirtualDom_applyAttrs(domNode, value)
2853			:
2854		key === 'a4'
2855			? _VirtualDom_applyAttrsNS(domNode, value)
2856			:
2857		((key !== 'value' && key !== 'checked') || domNode[key] !== value) && (domNode[key] = value);
2858	}
2859}
2860
2861
2862
2863// APPLY STYLES
2864
2865
2866function _VirtualDom_applyStyles(domNode, styles)
2867{
2868	var domNodeStyle = domNode.style;
2869
2870	for (var key in styles)
2871	{
2872		domNodeStyle[key] = styles[key];
2873	}
2874}
2875
2876
2877
2878// APPLY ATTRS
2879
2880
2881function _VirtualDom_applyAttrs(domNode, attrs)
2882{
2883	for (var key in attrs)
2884	{
2885		var value = attrs[key];
2886		typeof value !== 'undefined'
2887			? domNode.setAttribute(key, value)
2888			: domNode.removeAttribute(key);
2889	}
2890}
2891
2892
2893
2894// APPLY NAMESPACED ATTRS
2895
2896
2897function _VirtualDom_applyAttrsNS(domNode, nsAttrs)
2898{
2899	for (var key in nsAttrs)
2900	{
2901		var pair = nsAttrs[key];
2902		var namespace = pair.f;
2903		var value = pair.o;
2904
2905		typeof value !== 'undefined'
2906			? domNode.setAttributeNS(namespace, key, value)
2907			: domNode.removeAttributeNS(namespace, key);
2908	}
2909}
2910
2911
2912
2913// APPLY EVENTS
2914
2915
2916function _VirtualDom_applyEvents(domNode, eventNode, events)
2917{
2918	var allCallbacks = domNode.elmFs || (domNode.elmFs = {});
2919
2920	for (var key in events)
2921	{
2922		var newHandler = events[key];
2923		var oldCallback = allCallbacks[key];
2924
2925		if (!newHandler)
2926		{
2927			domNode.removeEventListener(key, oldCallback);
2928			allCallbacks[key] = undefined;
2929			continue;
2930		}
2931
2932		if (oldCallback)
2933		{
2934			var oldHandler = oldCallback.q;
2935			if (oldHandler.$ === newHandler.$)
2936			{
2937				oldCallback.q = newHandler;
2938				continue;
2939			}
2940			domNode.removeEventListener(key, oldCallback);
2941		}
2942
2943		oldCallback = _VirtualDom_makeCallback(eventNode, newHandler);
2944		domNode.addEventListener(key, oldCallback,
2945			_VirtualDom_passiveSupported
2946			&& { passive: $elm$virtual_dom$VirtualDom$toHandlerInt(newHandler) < 2 }
2947		);
2948		allCallbacks[key] = oldCallback;
2949	}
2950}
2951
2952
2953
2954// PASSIVE EVENTS
2955
2956
2957var _VirtualDom_passiveSupported;
2958
2959try
2960{
2961	window.addEventListener('t', null, Object.defineProperty({}, 'passive', {
2962		get: function() { _VirtualDom_passiveSupported = true; }
2963	}));
2964}
2965catch(e) {}
2966
2967
2968
2969// EVENT HANDLERS
2970
2971
2972function _VirtualDom_makeCallback(eventNode, initialHandler)
2973{
2974	function callback(event)
2975	{
2976		var handler = callback.q;
2977		var result = _Json_runHelp(handler.a, event);
2978
2979		if (!$elm$core$Result$isOk(result))
2980		{
2981			return;
2982		}
2983
2984		var tag = $elm$virtual_dom$VirtualDom$toHandlerInt(handler);
2985
2986		// 0 = Normal
2987		// 1 = MayStopPropagation
2988		// 2 = MayPreventDefault
2989		// 3 = Custom
2990
2991		var value = result.a;
2992		var message = !tag ? value : tag < 3 ? value.a : value.Z;
2993		var stopPropagation = tag == 1 ? value.b : tag == 3 && value.a0;
2994		var currentEventNode = (
2995			stopPropagation && event.stopPropagation(),
2996			(tag == 2 ? value.b : tag == 3 && value.aY) && event.preventDefault(),
2997			eventNode
2998		);
2999		var tagger;
3000		var i;
3001		while (tagger = currentEventNode.j)
3002		{
3003			if (typeof tagger == 'function')
3004			{
3005				message = tagger(message);
3006			}
3007			else
3008			{
3009				for (var i = tagger.length; i--; )
3010				{
3011					message = tagger[i](message);
3012				}
3013			}
3014			currentEventNode = currentEventNode.p;
3015		}
3016		currentEventNode(message, stopPropagation); // stopPropagation implies isSync
3017	}
3018
3019	callback.q = initialHandler;
3020
3021	return callback;
3022}
3023
3024function _VirtualDom_equalEvents(x, y)
3025{
3026	return x.$ == y.$ && _Json_equality(x.a, y.a);
3027}
3028
3029
3030
3031// DIFF
3032
3033
3034// TODO: Should we do patches like in iOS?
3035//
3036// type Patch
3037//   = At Int Patch
3038//   | Batch (List Patch)
3039//   | Change ...
3040//
3041// How could it not be better?
3042//
3043function _VirtualDom_diff(x, y)
3044{
3045	var patches = [];
3046	_VirtualDom_diffHelp(x, y, patches, 0);
3047	return patches;
3048}
3049
3050
3051function _VirtualDom_pushPatch(patches, type, index, data)
3052{
3053	var patch = {
3054		$: type,
3055		r: index,
3056		s: data,
3057		t: undefined,
3058		u: undefined
3059	};
3060	patches.push(patch);
3061	return patch;
3062}
3063
3064
3065function _VirtualDom_diffHelp(x, y, patches, index)
3066{
3067	if (x === y)
3068	{
3069		return;
3070	}
3071
3072	var xType = x.$;
3073	var yType = y.$;
3074
3075	// Bail if you run into different types of nodes. Implies that the
3076	// structure has changed significantly and it's not worth a diff.
3077	if (xType !== yType)
3078	{
3079		if (xType === 1 && yType === 2)
3080		{
3081			y = _VirtualDom_dekey(y);
3082			yType = 1;
3083		}
3084		else
3085		{
3086			_VirtualDom_pushPatch(patches, 0, index, y);
3087			return;
3088		}
3089	}
3090
3091	// Now we know that both nodes are the same $.
3092	switch (yType)
3093	{
3094		case 5:
3095			var xRefs = x.l;
3096			var yRefs = y.l;
3097			var i = xRefs.length;
3098			var same = i === yRefs.length;
3099			while (same && i--)
3100			{
3101				same = xRefs[i] === yRefs[i];
3102			}
3103			if (same)
3104			{
3105				y.k = x.k;
3106				return;
3107			}
3108			y.k = y.m();
3109			var subPatches = [];
3110			_VirtualDom_diffHelp(x.k, y.k, subPatches, 0);
3111			subPatches.length > 0 && _VirtualDom_pushPatch(patches, 1, index, subPatches);
3112			return;
3113
3114		case 4:
3115			// gather nested taggers
3116			var xTaggers = x.j;
3117			var yTaggers = y.j;
3118			var nesting = false;
3119
3120			var xSubNode = x.k;
3121			while (xSubNode.$ === 4)
3122			{
3123				nesting = true;
3124
3125				typeof xTaggers !== 'object'
3126					? xTaggers = [xTaggers, xSubNode.j]
3127					: xTaggers.push(xSubNode.j);
3128
3129				xSubNode = xSubNode.k;
3130			}
3131
3132			var ySubNode = y.k;
3133			while (ySubNode.$ === 4)
3134			{
3135				nesting = true;
3136
3137				typeof yTaggers !== 'object'
3138					? yTaggers = [yTaggers, ySubNode.j]
3139					: yTaggers.push(ySubNode.j);
3140
3141				ySubNode = ySubNode.k;
3142			}
3143
3144			// Just bail if different numbers of taggers. This implies the
3145			// structure of the virtual DOM has changed.
3146			if (nesting && xTaggers.length !== yTaggers.length)
3147			{
3148				_VirtualDom_pushPatch(patches, 0, index, y);
3149				return;
3150			}
3151
3152			// check if taggers are "the same"
3153			if (nesting ? !_VirtualDom_pairwiseRefEqual(xTaggers, yTaggers) : xTaggers !== yTaggers)
3154			{
3155				_VirtualDom_pushPatch(patches, 2, index, yTaggers);
3156			}
3157
3158			// diff everything below the taggers
3159			_VirtualDom_diffHelp(xSubNode, ySubNode, patches, index + 1);
3160			return;
3161
3162		case 0:
3163			if (x.a !== y.a)
3164			{
3165				_VirtualDom_pushPatch(patches, 3, index, y.a);
3166			}
3167			return;
3168
3169		case 1:
3170			_VirtualDom_diffNodes(x, y, patches, index, _VirtualDom_diffKids);
3171			return;
3172
3173		case 2:
3174			_VirtualDom_diffNodes(x, y, patches, index, _VirtualDom_diffKeyedKids);
3175			return;
3176
3177		case 3:
3178			if (x.h !== y.h)
3179			{
3180				_VirtualDom_pushPatch(patches, 0, index, y);
3181				return;
3182			}
3183
3184			var factsDiff = _VirtualDom_diffFacts(x.d, y.d);
3185			factsDiff && _VirtualDom_pushPatch(patches, 4, index, factsDiff);
3186
3187			var patch = y.i(x.g, y.g);
3188			patch && _VirtualDom_pushPatch(patches, 5, index, patch);
3189
3190			return;
3191	}
3192}
3193
3194// assumes the incoming arrays are the same length
3195function _VirtualDom_pairwiseRefEqual(as, bs)
3196{
3197	for (var i = 0; i < as.length; i++)
3198	{
3199		if (as[i] !== bs[i])
3200		{
3201			return false;
3202		}
3203	}
3204
3205	return true;
3206}
3207
3208function _VirtualDom_diffNodes(x, y, patches, index, diffKids)
3209{
3210	// Bail if obvious indicators have changed. Implies more serious
3211	// structural changes such that it's not worth it to diff.
3212	if (x.c !== y.c || x.f !== y.f)
3213	{
3214		_VirtualDom_pushPatch(patches, 0, index, y);
3215		return;
3216	}
3217
3218	var factsDiff = _VirtualDom_diffFacts(x.d, y.d);
3219	factsDiff && _VirtualDom_pushPatch(patches, 4, index, factsDiff);
3220
3221	diffKids(x, y, patches, index);
3222}
3223
3224
3225
3226// DIFF FACTS
3227
3228
3229// TODO Instead of creating a new diff object, it's possible to just test if
3230// there *is* a diff. During the actual patch, do the diff again and make the
3231// modifications directly. This way, there's no new allocations. Worth it?
3232function _VirtualDom_diffFacts(x, y, category)
3233{
3234	var diff;
3235
3236	// look for changes and removals
3237	for (var xKey in x)
3238	{
3239		if (xKey === 'a1' || xKey === 'a0' || xKey === 'a3' || xKey === 'a4')
3240		{
3241			var subDiff = _VirtualDom_diffFacts(x[xKey], y[xKey] || {}, xKey);
3242			if (subDiff)
3243			{
3244				diff = diff || {};
3245				diff[xKey] = subDiff;
3246			}
3247			continue;
3248		}
3249
3250		// remove if not in the new facts
3251		if (!(xKey in y))
3252		{
3253			diff = diff || {};
3254			diff[xKey] =
3255				!category
3256					? (typeof x[xKey] === 'string' ? '' : null)
3257					:
3258				(category === 'a1')
3259					? ''
3260					:
3261				(category === 'a0' || category === 'a3')
3262					? undefined
3263					:
3264				{ f: x[xKey].f, o: undefined };
3265
3266			continue;
3267		}
3268
3269		var xValue = x[xKey];
3270		var yValue = y[xKey];
3271
3272		// reference equal, so don't worry about it
3273		if (xValue === yValue && xKey !== 'value' && xKey !== 'checked'
3274			|| category === 'a0' && _VirtualDom_equalEvents(xValue, yValue))
3275		{
3276			continue;
3277		}
3278
3279		diff = diff || {};
3280		diff[xKey] = yValue;
3281	}
3282
3283	// add new stuff
3284	for (var yKey in y)
3285	{
3286		if (!(yKey in x))
3287		{
3288			diff = diff || {};
3289			diff[yKey] = y[yKey];
3290		}
3291	}
3292
3293	return diff;
3294}
3295
3296
3297
3298// DIFF KIDS
3299
3300
3301function _VirtualDom_diffKids(xParent, yParent, patches, index)
3302{
3303	var xKids = xParent.e;
3304	var yKids = yParent.e;
3305
3306	var xLen = xKids.length;
3307	var yLen = yKids.length;
3308
3309	// FIGURE OUT IF THERE ARE INSERTS OR REMOVALS
3310
3311	if (xLen > yLen)
3312	{
3313		_VirtualDom_pushPatch(patches, 6, index, {
3314			v: yLen,
3315			i: xLen - yLen
3316		});
3317	}
3318	else if (xLen < yLen)
3319	{
3320		_VirtualDom_pushPatch(patches, 7, index, {
3321			v: xLen,
3322			e: yKids
3323		});
3324	}
3325
3326	// PAIRWISE DIFF EVERYTHING ELSE
3327
3328	for (var minLen = xLen < yLen ? xLen : yLen, i = 0; i < minLen; i++)
3329	{
3330		var xKid = xKids[i];
3331		_VirtualDom_diffHelp(xKid, yKids[i], patches, ++index);
3332		index += xKid.b || 0;
3333	}
3334}
3335
3336
3337
3338// KEYED DIFF
3339
3340
3341function _VirtualDom_diffKeyedKids(xParent, yParent, patches, rootIndex)
3342{
3343	var localPatches = [];
3344
3345	var changes = {}; // Dict String Entry
3346	var inserts = []; // Array { index : Int, entry : Entry }
3347	// type Entry = { tag : String, vnode : VNode, index : Int, data : _ }
3348
3349	var xKids = xParent.e;
3350	var yKids = yParent.e;
3351	var xLen = xKids.length;
3352	var yLen = yKids.length;
3353	var xIndex = 0;
3354	var yIndex = 0;
3355
3356	var index = rootIndex;
3357
3358	while (xIndex < xLen && yIndex < yLen)
3359	{
3360		var x = xKids[xIndex];
3361		var y = yKids[yIndex];
3362
3363		var xKey = x.a;
3364		var yKey = y.a;
3365		var xNode = x.b;
3366		var yNode = y.b;
3367
3368		var newMatch = undefined;
3369		var oldMatch = undefined;
3370
3371		// check if keys match
3372
3373		if (xKey === yKey)
3374		{
3375			index++;
3376			_VirtualDom_diffHelp(xNode, yNode, localPatches, index);
3377			index += xNode.b || 0;
3378
3379			xIndex++;
3380			yIndex++;
3381			continue;
3382		}
3383
3384		// look ahead 1 to detect insertions and removals.
3385
3386		var xNext = xKids[xIndex + 1];
3387		var yNext = yKids[yIndex + 1];
3388
3389		if (xNext)
3390		{
3391			var xNextKey = xNext.a;
3392			var xNextNode = xNext.b;
3393			oldMatch = yKey === xNextKey;
3394		}
3395
3396		if (yNext)
3397		{
3398			var yNextKey = yNext.a;
3399			var yNextNode = yNext.b;
3400			newMatch = xKey === yNextKey;
3401		}
3402
3403
3404		// swap x and y
3405		if (newMatch && oldMatch)
3406		{
3407			index++;
3408			_VirtualDom_diffHelp(xNode, yNextNode, localPatches, index);
3409			_VirtualDom_insertNode(changes, localPatches, xKey, yNode, yIndex, inserts);
3410			index += xNode.b || 0;
3411
3412			index++;
3413			_VirtualDom_removeNode(changes, localPatches, xKey, xNextNode, index);
3414			index += xNextNode.b || 0;
3415
3416			xIndex += 2;
3417			yIndex += 2;
3418			continue;
3419		}
3420
3421		// insert y
3422		if (newMatch)
3423		{
3424			index++;
3425			_VirtualDom_insertNode(changes, localPatches, yKey, yNode, yIndex, inserts);
3426			_VirtualDom_diffHelp(xNode, yNextNode, localPatches, index);
3427			index += xNode.b || 0;
3428
3429			xIndex += 1;
3430			yIndex += 2;
3431			continue;
3432		}
3433
3434		// remove x
3435		if (oldMatch)
3436		{
3437			index++;
3438			_VirtualDom_removeNode(changes, localPatches, xKey, xNode, index);
3439			index += xNode.b || 0;
3440
3441			index++;
3442			_VirtualDom_diffHelp(xNextNode, yNode, localPatches, index);
3443			index += xNextNode.b || 0;
3444
3445			xIndex += 2;
3446			yIndex += 1;
3447			continue;
3448		}
3449
3450		// remove x, insert y
3451		if (xNext && xNextKey === yNextKey)
3452		{
3453			index++;
3454			_VirtualDom_removeNode(changes, localPatches, xKey, xNode, index);
3455			_VirtualDom_insertNode(changes, localPatches, yKey, yNode, yIndex, inserts);
3456			index += xNode.b || 0;
3457
3458			index++;
3459			_VirtualDom_diffHelp(xNextNode, yNextNode, localPatches, index);
3460			index += xNextNode.b || 0;
3461
3462			xIndex += 2;
3463			yIndex += 2;
3464			continue;
3465		}
3466
3467		break;
3468	}
3469
3470	// eat up any remaining nodes with removeNode and insertNode
3471
3472	while (xIndex < xLen)
3473	{
3474		index++;
3475		var x = xKids[xIndex];
3476		var xNode = x.b;
3477		_VirtualDom_removeNode(changes, localPatches, x.a, xNode, index);
3478		index += xNode.b || 0;
3479		xIndex++;
3480	}
3481
3482	while (yIndex < yLen)
3483	{
3484		var endInserts = endInserts || [];
3485		var y = yKids[yIndex];
3486		_VirtualDom_insertNode(changes, localPatches, y.a, y.b, undefined, endInserts);
3487		yIndex++;
3488	}
3489
3490	if (localPatches.length > 0 || inserts.length > 0 || endInserts)
3491	{
3492		_VirtualDom_pushPatch(patches, 8, rootIndex, {
3493			w: localPatches,
3494			x: inserts,
3495			y: endInserts
3496		});
3497	}
3498}
3499
3500
3501
3502// CHANGES FROM KEYED DIFF
3503
3504
3505var _VirtualDom_POSTFIX = '_elmW6BL';
3506
3507
3508function _VirtualDom_insertNode(changes, localPatches, key, vnode, yIndex, inserts)
3509{
3510	var entry = changes[key];
3511
3512	// never seen this key before
3513	if (!entry)
3514	{
3515		entry = {
3516			c: 0,
3517			z: vnode,
3518			r: yIndex,
3519			s: undefined
3520		};
3521
3522		inserts.push({ r: yIndex, A: entry });
3523		changes[key] = entry;
3524
3525		return;
3526	}
3527
3528	// this key was removed earlier, a match!
3529	if (entry.c === 1)
3530	{
3531		inserts.push({ r: yIndex, A: entry });
3532
3533		entry.c = 2;
3534		var subPatches = [];
3535		_VirtualDom_diffHelp(entry.z, vnode, subPatches, entry.r);
3536		entry.r = yIndex;
3537		entry.s.s = {
3538			w: subPatches,
3539			A: entry
3540		};
3541
3542		return;
3543	}
3544
3545	// this key has already been inserted or moved, a duplicate!
3546	_VirtualDom_insertNode(changes, localPatches, key + _VirtualDom_POSTFIX, vnode, yIndex, inserts);
3547}
3548
3549
3550function _VirtualDom_removeNode(changes, localPatches, key, vnode, index)
3551{
3552	var entry = changes[key];
3553
3554	// never seen this key before
3555	if (!entry)
3556	{
3557		var patch = _VirtualDom_pushPatch(localPatches, 9, index, undefined);
3558
3559		changes[key] = {
3560			c: 1,
3561			z: vnode,
3562			r: index,
3563			s: patch
3564		};
3565
3566		return;
3567	}
3568
3569	// this key was inserted earlier, a match!
3570	if (entry.c === 0)
3571	{
3572		entry.c = 2;
3573		var subPatches = [];
3574		_VirtualDom_diffHelp(vnode, entry.z, subPatches, index);
3575
3576		_VirtualDom_pushPatch(localPatches, 9, index, {
3577			w: subPatches,
3578			A: entry
3579		});
3580
3581		return;
3582	}
3583
3584	// this key has already been removed or moved, a duplicate!
3585	_VirtualDom_removeNode(changes, localPatches, key + _VirtualDom_POSTFIX, vnode, index);
3586}
3587
3588
3589
3590// ADD DOM NODES
3591//
3592// Each DOM node has an "index" assigned in order of traversal. It is important
3593// to minimize our crawl over the actual DOM, so these indexes (along with the
3594// descendantsCount of virtual nodes) let us skip touching entire subtrees of
3595// the DOM if we know there are no patches there.
3596
3597
3598function _VirtualDom_addDomNodes(domNode, vNode, patches, eventNode)
3599{
3600	_VirtualDom_addDomNodesHelp(domNode, vNode, patches, 0, 0, vNode.b, eventNode);
3601}
3602
3603
3604// assumes `patches` is non-empty and indexes increase monotonically.
3605function _VirtualDom_addDomNodesHelp(domNode, vNode, patches, i, low, high, eventNode)
3606{
3607	var patch = patches[i];
3608	var index = patch.r;
3609
3610	while (index === low)
3611	{
3612		var patchType = patch.$;
3613
3614		if (patchType === 1)
3615		{
3616			_VirtualDom_addDomNodes(domNode, vNode.k, patch.s, eventNode);
3617		}
3618		else if (patchType === 8)
3619		{
3620			patch.t = domNode;
3621			patch.u = eventNode;
3622
3623			var subPatches = patch.s.w;
3624			if (subPatches.length > 0)
3625			{
3626				_VirtualDom_addDomNodesHelp(domNode, vNode, subPatches, 0, low, high, eventNode);
3627			}
3628		}
3629		else if (patchType === 9)
3630		{
3631			patch.t = domNode;
3632			patch.u = eventNode;
3633
3634			var data = patch.s;
3635			if (data)
3636			{
3637				data.A.s = domNode;
3638				var subPatches = data.w;
3639				if (subPatches.length > 0)
3640				{
3641					_VirtualDom_addDomNodesHelp(domNode, vNode, subPatches, 0, low, high, eventNode);
3642				}
3643			}
3644		}
3645		else
3646		{
3647			patch.t = domNode;
3648			patch.u = eventNode;
3649		}
3650
3651		i++;
3652
3653		if (!(patch = patches[i]) || (index = patch.r) > high)
3654		{
3655			return i;
3656		}
3657	}
3658
3659	var tag = vNode.$;
3660
3661	if (tag === 4)
3662	{
3663		var subNode = vNode.k;
3664
3665		while (subNode.$ === 4)
3666		{
3667			subNode = subNode.k;
3668		}
3669
3670		return _VirtualDom_addDomNodesHelp(domNode, subNode, patches, i, low + 1, high, domNode.elm_event_node_ref);
3671	}
3672
3673	// tag must be 1 or 2 at this point
3674
3675	var vKids = vNode.e;
3676	var childNodes = domNode.childNodes;
3677	for (var j = 0; j < vKids.length; j++)
3678	{
3679		low++;
3680		var vKid = tag === 1 ? vKids[j] : vKids[j].b;
3681		var nextLow = low + (vKid.b || 0);
3682		if (low <= index && index <= nextLow)
3683		{
3684			i = _VirtualDom_addDomNodesHelp(childNodes[j], vKid, patches, i, low, nextLow, eventNode);
3685			if (!(patch = patches[i]) || (index = patch.r) > high)
3686			{
3687				return i;
3688			}
3689		}
3690		low = nextLow;
3691	}
3692	return i;
3693}
3694
3695
3696
3697// APPLY PATCHES
3698
3699
3700function _VirtualDom_applyPatches(rootDomNode, oldVirtualNode, patches, eventNode)
3701{
3702	if (patches.length === 0)
3703	{
3704		return rootDomNode;
3705	}
3706
3707	_VirtualDom_addDomNodes(rootDomNode, oldVirtualNode, patches, eventNode);
3708	return _VirtualDom_applyPatchesHelp(rootDomNode, patches);
3709}
3710
3711function _VirtualDom_applyPatchesHelp(rootDomNode, patches)
3712{
3713	for (var i = 0; i < patches.length; i++)
3714	{
3715		var patch = patches[i];
3716		var localDomNode = patch.t
3717		var newNode = _VirtualDom_applyPatch(localDomNode, patch);
3718		if (localDomNode === rootDomNode)
3719		{
3720			rootDomNode = newNode;
3721		}
3722	}
3723	return rootDomNode;
3724}
3725
3726function _VirtualDom_applyPatch(domNode, patch)
3727{
3728	switch (patch.$)
3729	{
3730		case 0:
3731			return _VirtualDom_applyPatchRedraw(domNode, patch.s, patch.u);
3732
3733		case 4:
3734			_VirtualDom_applyFacts(domNode, patch.u, patch.s);
3735			return domNode;
3736
3737		case 3:
3738			domNode.replaceData(0, domNode.length, patch.s);
3739			return domNode;
3740
3741		case 1:
3742			return _VirtualDom_applyPatchesHelp(domNode, patch.s);
3743
3744		case 2:
3745			if (domNode.elm_event_node_ref)
3746			{
3747				domNode.elm_event_node_ref.j = patch.s;
3748			}
3749			else
3750			{
3751				domNode.elm_event_node_ref = { j: patch.s, p: patch.u };
3752			}
3753			return domNode;
3754
3755		case 6:
3756			var data = patch.s;
3757			for (var i = 0; i < data.i; i++)
3758			{
3759				domNode.removeChild(domNode.childNodes[data.v]);
3760			}
3761			return domNode;
3762
3763		case 7:
3764			var data = patch.s;
3765			var kids = data.e;
3766			var i = data.v;
3767			var theEnd = domNode.childNodes[i];
3768			for (; i < kids.length; i++)
3769			{
3770				domNode.insertBefore(_VirtualDom_render(kids[i], patch.u), theEnd);
3771			}
3772			return domNode;
3773
3774		case 9:
3775			var data = patch.s;
3776			if (!data)
3777			{
3778				domNode.parentNode.removeChild(domNode);
3779				return domNode;
3780			}
3781			var entry = data.A;
3782			if (typeof entry.r !== 'undefined')
3783			{
3784				domNode.parentNode.removeChild(domNode);
3785			}
3786			entry.s = _VirtualDom_applyPatchesHelp(domNode, data.w);
3787			return domNode;
3788
3789		case 8:
3790			return _VirtualDom_applyPatchReorder(domNode, patch);
3791
3792		case 5:
3793			return patch.s(domNode);
3794
3795		default:
3796			_Debug_crash(10); // 'Ran into an unknown patch!'
3797	}
3798}
3799
3800
3801function _VirtualDom_applyPatchRedraw(domNode, vNode, eventNode)
3802{
3803	var parentNode = domNode.parentNode;
3804	var newNode = _VirtualDom_render(vNode, eventNode);
3805
3806	if (!newNode.elm_event_node_ref)
3807	{
3808		newNode.elm_event_node_ref = domNode.elm_event_node_ref;
3809	}
3810
3811	if (parentNode && newNode !== domNode)
3812	{
3813		parentNode.replaceChild(newNode, domNode);
3814	}
3815	return newNode;
3816}
3817
3818
3819function _VirtualDom_applyPatchReorder(domNode, patch)
3820{
3821	var data = patch.s;
3822
3823	// remove end inserts
3824	var frag = _VirtualDom_applyPatchReorderEndInsertsHelp(data.y, patch);
3825
3826	// removals
3827	domNode = _VirtualDom_applyPatchesHelp(domNode, data.w);
3828
3829	// inserts
3830	var inserts = data.x;
3831	for (var i = 0; i < inserts.length; i++)
3832	{
3833		var insert = inserts[i];
3834		var entry = insert.A;
3835		var node = entry.c === 2
3836			? entry.s
3837			: _VirtualDom_render(entry.z, patch.u);
3838		domNode.insertBefore(node, domNode.childNodes[insert.r]);
3839	}
3840
3841	// add end inserts
3842	if (frag)
3843	{
3844		_VirtualDom_appendChild(domNode, frag);
3845	}
3846
3847	return domNode;
3848}
3849
3850
3851function _VirtualDom_applyPatchReorderEndInsertsHelp(endInserts, patch)
3852{
3853	if (!endInserts)
3854	{
3855		return;
3856	}
3857
3858	var frag = _VirtualDom_doc.createDocumentFragment();
3859	for (var i = 0; i < endInserts.length; i++)
3860	{
3861		var insert = endInserts[i];
3862		var entry = insert.A;
3863		_VirtualDom_appendChild(frag, entry.c === 2
3864			? entry.s
3865			: _VirtualDom_render(entry.z, patch.u)
3866		);
3867	}
3868	return frag;
3869}
3870
3871
3872function _VirtualDom_virtualize(node)
3873{
3874	// TEXT NODES
3875
3876	if (node.nodeType === 3)
3877	{
3878		return _VirtualDom_text(node.textContent);
3879	}
3880
3881
3882	// WEIRD NODES
3883
3884	if (node.nodeType !== 1)
3885	{
3886		return _VirtualDom_text('');
3887	}
3888
3889
3890	// ELEMENT NODES
3891
3892	var attrList = _List_Nil;
3893	var attrs = node.attributes;
3894	for (var i = attrs.length; i--; )
3895	{
3896		var attr = attrs[i];
3897		var name = attr.name;
3898		var value = attr.value;
3899		attrList = _List_Cons( A2(_VirtualDom_attribute, name, value), attrList );
3900	}
3901
3902	var tag = node.tagName.toLowerCase();
3903	var kidList = _List_Nil;
3904	var kids = node.childNodes;
3905
3906	for (var i = kids.length; i--; )
3907	{
3908		kidList = _List_Cons(_VirtualDom_virtualize(kids[i]), kidList);
3909	}
3910	return A3(_VirtualDom_node, tag, attrList, kidList);
3911}
3912
3913function _VirtualDom_dekey(keyedNode)
3914{
3915	var keyedKids = keyedNode.e;
3916	var len = keyedKids.length;
3917	var kids = new Array(len);
3918	for (var i = 0; i < len; i++)
3919	{
3920		kids[i] = keyedKids[i].b;
3921	}
3922
3923	return {
3924		$: 1,
3925		c: keyedNode.c,
3926		d: keyedNode.d,
3927		e: kids,
3928		f: keyedNode.f,
3929		b: keyedNode.b
3930	};
3931}
3932
3933
3934
3935
3936// ELEMENT
3937
3938
3939var _Debugger_element;
3940
3941var _Browser_element = _Debugger_element || F4(function(impl, flagDecoder, debugMetadata, args)
3942{
3943	return _Platform_initialize(
3944		flagDecoder,
3945		args,
3946		impl.bR,
3947		impl.b8,
3948		impl.b5,
3949		function(sendToApp, initialModel) {
3950			var view = impl.b9;
3951			/**/
3952			var domNode = args['node'];
3953			//*/
3954			/**_UNUSED/
3955			var domNode = args && args['node'] ? args['node'] : _Debug_crash(0);
3956			//*/
3957			var currNode = _VirtualDom_virtualize(domNode);
3958
3959			return _Browser_makeAnimator(initialModel, function(model)
3960			{
3961				var nextNode = view(model);
3962				var patches = _VirtualDom_diff(currNode, nextNode);
3963				domNode = _VirtualDom_applyPatches(domNode, currNode, patches, sendToApp);
3964				currNode = nextNode;
3965			});
3966		}
3967	);
3968});
3969
3970
3971
3972// DOCUMENT
3973
3974
3975var _Debugger_document;
3976
3977var _Browser_document = _Debugger_document || F4(function(impl, flagDecoder, debugMetadata, args)
3978{
3979	return _Platform_initialize(
3980		flagDecoder,
3981		args,
3982		impl.bR,
3983		impl.b8,
3984		impl.b5,
3985		function(sendToApp, initialModel) {
3986			var divertHrefToApp = impl.a_ && impl.a_(sendToApp)
3987			var view = impl.b9;
3988			var title = _VirtualDom_doc.title;
3989			var bodyNode = _VirtualDom_doc.body;
3990			var currNode = _VirtualDom_virtualize(bodyNode);
3991			return _Browser_makeAnimator(initialModel, function(model)
3992			{
3993				_VirtualDom_divertHrefToApp = divertHrefToApp;
3994				var doc = view(model);
3995				var nextNode = _VirtualDom_node('body')(_List_Nil)(doc.bE);
3996				var patches = _VirtualDom_diff(currNode, nextNode);
3997				bodyNode = _VirtualDom_applyPatches(bodyNode, currNode, patches, sendToApp);
3998				currNode = nextNode;
3999				_VirtualDom_divertHrefToApp = 0;
4000				(title !== doc.b7) && (_VirtualDom_doc.title = title = doc.b7);
4001			});
4002		}
4003	);
4004});
4005
4006
4007
4008// ANIMATION
4009
4010
4011var _Browser_cancelAnimationFrame =
4012	typeof cancelAnimationFrame !== 'undefined'
4013		? cancelAnimationFrame
4014		: function(id) { clearTimeout(id); };
4015
4016var _Browser_requestAnimationFrame =
4017	typeof requestAnimationFrame !== 'undefined'
4018		? requestAnimationFrame
4019		: function(callback) { return setTimeout(callback, 1000 / 60); };
4020
4021
4022function _Browser_makeAnimator(model, draw)
4023{
4024	draw(model);
4025
4026	var state = 0;
4027
4028	function updateIfNeeded()
4029	{
4030		state = state === 1
4031			? 0
4032			: ( _Browser_requestAnimationFrame(updateIfNeeded), draw(model), 1 );
4033	}
4034
4035	return function(nextModel, isSync)
4036	{
4037		model = nextModel;
4038
4039		isSync
4040			? ( draw(model),
4041				state === 2 && (state = 1)
4042				)
4043			: ( state === 0 && _Browser_requestAnimationFrame(updateIfNeeded),
4044				state = 2
4045				);
4046	};
4047}
4048
4049
4050
4051// APPLICATION
4052
4053
4054function _Browser_application(impl)
4055{
4056	var onUrlChange = impl.bY;
4057	var onUrlRequest = impl.bZ;
4058	var key = function() { key.a(onUrlChange(_Browser_getUrl())); };
4059
4060	return _Browser_document({
4061		a_: function(sendToApp)
4062		{
4063			key.a = sendToApp;
4064			_Browser_window.addEventListener('popstate', key);
4065			_Browser_window.navigator.userAgent.indexOf('Trident') < 0 || _Browser_window.addEventListener('hashchange', key);
4066
4067			return F2(function(domNode, event)
4068			{
4069				if (!event.ctrlKey && !event.metaKey && !event.shiftKey && event.button < 1 && !domNode.target && !domNode.hasAttribute('download'))
4070				{
4071					event.preventDefault();
4072					var href = domNode.href;
4073					var curr = _Browser_getUrl();
4074					var next = $elm$url$Url$fromString(href).a;
4075					sendToApp(onUrlRequest(
4076						(next
4077							&& curr.bn === next.bn
4078							&& curr.bb === next.bb
4079							&& curr.bk.a === next.bk.a
4080						)
4081							? $elm$browser$Browser$Internal(next)
4082							: $elm$browser$Browser$External(href)
4083					));
4084				}
4085			});
4086		},
4087		bR: function(flags)
4088		{
4089			return A3(impl.bR, flags, _Browser_getUrl(), key);
4090		},
4091		b9: impl.b9,
4092		b8: impl.b8,
4093		b5: impl.b5
4094	});
4095}
4096
4097function _Browser_getUrl()
4098{
4099	return $elm$url$Url$fromString(_VirtualDom_doc.location.href).a || _Debug_crash(1);
4100}
4101
4102var _Browser_go = F2(function(key, n)
4103{
4104	return A2($elm$core$Task$perform, $elm$core$Basics$never, _Scheduler_binding(function() {
4105		n && history.go(n);
4106		key();
4107	}));
4108});
4109
4110var _Browser_pushUrl = F2(function(key, url)
4111{
4112	return A2($elm$core$Task$perform, $elm$core$Basics$never, _Scheduler_binding(function() {
4113		history.pushState({}, '', url);
4114		key();
4115	}));
4116});
4117
4118var _Browser_replaceUrl = F2(function(key, url)
4119{
4120	return A2($elm$core$Task$perform, $elm$core$Basics$never, _Scheduler_binding(function() {
4121		history.replaceState({}, '', url);
4122		key();
4123	}));
4124});
4125
4126
4127
4128// GLOBAL EVENTS
4129
4130
4131var _Browser_fakeNode = { addEventListener: function() {}, removeEventListener: function() {} };
4132var _Browser_doc = typeof document !== 'undefined' ? document : _Browser_fakeNode;
4133var _Browser_window = typeof window !== 'undefined' ? window : _Browser_fakeNode;
4134
4135var _Browser_on = F3(function(node, eventName, sendToSelf)
4136{
4137	return _Scheduler_spawn(_Scheduler_binding(function(callback)
4138	{
4139		function handler(event)	{ _Scheduler_rawSpawn(sendToSelf(event)); }
4140		node.addEventListener(eventName, handler, _VirtualDom_passiveSupported && { passive: true });
4141		return function() { node.removeEventListener(eventName, handler); };
4142	}));
4143});
4144
4145var _Browser_decodeEvent = F2(function(decoder, event)
4146{
4147	var result = _Json_runHelp(decoder, event);
4148	return $elm$core$Result$isOk(result) ? $elm$core$Maybe$Just(result.a) : $elm$core$Maybe$Nothing;
4149});
4150
4151
4152
4153// PAGE VISIBILITY
4154
4155
4156function _Browser_visibilityInfo()
4157{
4158	return (typeof _VirtualDom_doc.hidden !== 'undefined')
4159		? { bP: 'hidden', bF: 'visibilitychange' }
4160		:
4161	(typeof _VirtualDom_doc.mozHidden !== 'undefined')
4162		? { bP: 'mozHidden', bF: 'mozvisibilitychange' }
4163		:
4164	(typeof _VirtualDom_doc.msHidden !== 'undefined')
4165		? { bP: 'msHidden', bF: 'msvisibilitychange' }
4166		:
4167	(typeof _VirtualDom_doc.webkitHidden !== 'undefined')
4168		? { bP: 'webkitHidden', bF: 'webkitvisibilitychange' }
4169		: { bP: 'hidden', bF: 'visibilitychange' };
4170}
4171
4172
4173
4174// ANIMATION FRAMES
4175
4176
4177function _Browser_rAF()
4178{
4179	return _Scheduler_binding(function(callback)
4180	{
4181		var id = _Browser_requestAnimationFrame(function() {
4182			callback(_Scheduler_succeed(Date.now()));
4183		});
4184
4185		return function() {
4186			_Browser_cancelAnimationFrame(id);
4187		};
4188	});
4189}
4190
4191
4192function _Browser_now()
4193{
4194	return _Scheduler_binding(function(callback)
4195	{
4196		callback(_Scheduler_succeed(Date.now()));
4197	});
4198}
4199
4200
4201
4202// DOM STUFF
4203
4204
4205function _Browser_withNode(id, doStuff)
4206{
4207	return _Scheduler_binding(function(callback)
4208	{
4209		_Browser_requestAnimationFrame(function() {
4210			var node = document.getElementById(id);
4211			callback(node
4212				? _Scheduler_succeed(doStuff(node))
4213				: _Scheduler_fail($elm$browser$Browser$Dom$NotFound(id))
4214			);
4215		});
4216	});
4217}
4218
4219
4220function _Browser_withWindow(doStuff)
4221{
4222	return _Scheduler_binding(function(callback)
4223	{
4224		_Browser_requestAnimationFrame(function() {
4225			callback(_Scheduler_succeed(doStuff()));
4226		});
4227	});
4228}
4229
4230
4231// FOCUS and BLUR
4232
4233
4234var _Browser_call = F2(function(functionName, id)
4235{
4236	return _Browser_withNode(id, function(node) {
4237		node[functionName]();
4238		return _Utils_Tuple0;
4239	});
4240});
4241
4242
4243
4244// WINDOW VIEWPORT
4245
4246
4247function _Browser_getViewport()
4248{
4249	return {
4250		bu: _Browser_getScene(),
4251		bA: {
4252			a: _Browser_window.pageXOffset,
4253			b: _Browser_window.pageYOffset,
4254			ad: _Browser_doc.documentElement.clientWidth,
4255			X: _Browser_doc.documentElement.clientHeight
4256		}
4257	};
4258}
4259
4260function _Browser_getScene()
4261{
4262	var body = _Browser_doc.body;
4263	var elem = _Browser_doc.documentElement;
4264	return {
4265		ad: Math.max(body.scrollWidth, body.offsetWidth, elem.scrollWidth, elem.offsetWidth, elem.clientWidth),
4266		X: Math.max(body.scrollHeight, body.offsetHeight, elem.scrollHeight, elem.offsetHeight, elem.clientHeight)
4267	};
4268}
4269
4270var _Browser_setViewport = F2(function(x, y)
4271{
4272	return _Browser_withWindow(function()
4273	{
4274		_Browser_window.scroll(x, y);
4275		return _Utils_Tuple0;
4276	});
4277});
4278
4279
4280
4281// ELEMENT VIEWPORT
4282
4283
4284function _Browser_getViewportOf(id)
4285{
4286	return _Browser_withNode(id, function(node)
4287	{
4288		return {
4289			bu: {
4290				ad: node.scrollWidth,
4291				X: node.scrollHeight
4292			},
4293			bA: {
4294				a: node.scrollLeft,
4295				b: node.scrollTop,
4296				ad: node.clientWidth,
4297				X: node.clientHeight
4298			}
4299		};
4300	});
4301}
4302
4303
4304var _Browser_setViewportOf = F3(function(id, x, y)
4305{
4306	return _Browser_withNode(id, function(node)
4307	{
4308		node.scrollLeft = x;
4309		node.scrollTop = y;
4310		return _Utils_Tuple0;
4311	});
4312});
4313
4314
4315
4316// ELEMENT
4317
4318
4319function _Browser_getElement(id)
4320{
4321	return _Browser_withNode(id, function(node)
4322	{
4323		var rect = node.getBoundingClientRect();
4324		var x = _Browser_window.pageXOffset;
4325		var y = _Browser_window.pageYOffset;
4326		return {
4327			bu: _Browser_getScene(),
4328			bA: {
4329				a: x,
4330				b: y,
4331				ad: _Browser_doc.documentElement.clientWidth,
4332				X: _Browser_doc.documentElement.clientHeight
4333			},
4334			bK: {
4335				a: x + rect.left,
4336				b: y + rect.top,
4337				ad: rect.width,
4338				X: rect.height
4339			}
4340		};
4341	});
4342}
4343
4344
4345
4346// LOAD and RELOAD
4347
4348
4349function _Browser_reload(skipCache)
4350{
4351	return A2($elm$core$Task$perform, $elm$core$Basics$never, _Scheduler_binding(function(callback)
4352	{
4353		_VirtualDom_doc.location.reload(skipCache);
4354	}));
4355}
4356
4357function _Browser_load(url)
4358{
4359	return A2($elm$core$Task$perform, $elm$core$Basics$never, _Scheduler_binding(function(callback)
4360	{
4361		try
4362		{
4363			_Browser_window.location = url;
4364		}
4365		catch(err)
4366		{
4367			// Only Firefox can throw a NS_ERROR_MALFORMED_URI exception here.
4368			// Other browsers reload the page, so let's be consistent about that.
4369			_VirtualDom_doc.location.reload(false);
4370		}
4371	}));
4372}
4373
4374
4375
4376var _Bitwise_and = F2(function(a, b)
4377{
4378	return a & b;
4379});
4380
4381var _Bitwise_or = F2(function(a, b)
4382{
4383	return a | b;
4384});
4385
4386var _Bitwise_xor = F2(function(a, b)
4387{
4388	return a ^ b;
4389});
4390
4391function _Bitwise_complement(a)
4392{
4393	return ~a;
4394};
4395
4396var _Bitwise_shiftLeftBy = F2(function(offset, a)
4397{
4398	return a << offset;
4399});
4400
4401var _Bitwise_shiftRightBy = F2(function(offset, a)
4402{
4403	return a >> offset;
4404});
4405
4406var _Bitwise_shiftRightZfBy = F2(function(offset, a)
4407{
4408	return a >>> offset;
4409});
4410
4411
4412
4413function _Time_now(millisToPosix)
4414{
4415	return _Scheduler_binding(function(callback)
4416	{
4417		callback(_Scheduler_succeed(millisToPosix(Date.now())));
4418	});
4419}
4420
4421var _Time_setInterval = F2(function(interval, task)
4422{
4423	return _Scheduler_binding(function(callback)
4424	{
4425		var id = setInterval(function() { _Scheduler_rawSpawn(task); }, interval);
4426		return function() { clearInterval(id); };
4427	});
4428});
4429
4430function _Time_here()
4431{
4432	return _Scheduler_binding(function(callback)
4433	{
4434		callback(_Scheduler_succeed(
4435			A2($elm$time$Time$customZone, -(new Date().getTimezoneOffset()), _List_Nil)
4436		));
4437	});
4438}
4439
4440
4441function _Time_getZoneName()
4442{
4443	return _Scheduler_binding(function(callback)
4444	{
4445		try
4446		{
4447			var name = $elm$time$Time$Name(Intl.DateTimeFormat().resolvedOptions().timeZone);
4448		}
4449		catch (e)
4450		{
4451			var name = $elm$time$Time$Offset(new Date().getTimezoneOffset());
4452		}
4453		callback(_Scheduler_succeed(name));
4454	});
4455}
4456var $elm$core$List$cons = _List_cons;
4457var $elm$core$Elm$JsArray$foldr = _JsArray_foldr;
4458var $elm$core$Array$foldr = F3(
4459	function (func, baseCase, _v0) {
4460		var tree = _v0.c;
4461		var tail = _v0.d;
4462		var helper = F2(
4463			function (node, acc) {
4464				if (!node.$) {
4465					var subTree = node.a;
4466					return A3($elm$core$Elm$JsArray$foldr, helper, acc, subTree);
4467				} else {
4468					var values = node.a;
4469					return A3($elm$core$Elm$JsArray$foldr, func, acc, values);
4470				}
4471			});
4472		return A3(
4473			$elm$core$Elm$JsArray$foldr,
4474			helper,
4475			A3($elm$core$Elm$JsArray$foldr, func, baseCase, tail),
4476			tree);
4477	});
4478var $elm$core$Array$toList = function (array) {
4479	return A3($elm$core$Array$foldr, $elm$core$List$cons, _List_Nil, array);
4480};
4481var $elm$core$Dict$foldr = F3(
4482	function (func, acc, t) {
4483		foldr:
4484		while (true) {
4485			if (t.$ === -2) {
4486				return acc;
4487			} else {
4488				var key = t.b;
4489				var value = t.c;
4490				var left = t.d;
4491				var right = t.e;
4492				var $temp$func = func,
4493					$temp$acc = A3(
4494					func,
4495					key,
4496					value,
4497					A3($elm$core$Dict$foldr, func, acc, right)),
4498					$temp$t = left;
4499				func = $temp$func;
4500				acc = $temp$acc;
4501				t = $temp$t;
4502				continue foldr;
4503			}
4504		}
4505	});
4506var $elm$core$Dict$toList = function (dict) {
4507	return A3(
4508		$elm$core$Dict$foldr,
4509		F3(
4510			function (key, value, list) {
4511				return A2(
4512					$elm$core$List$cons,
4513					_Utils_Tuple2(key, value),
4514					list);
4515			}),
4516		_List_Nil,
4517		dict);
4518};
4519var $elm$core$Dict$keys = function (dict) {
4520	return A3(
4521		$elm$core$Dict$foldr,
4522		F3(
4523			function (key, value, keyList) {
4524				return A2($elm$core$List$cons, key, keyList);
4525			}),
4526		_List_Nil,
4527		dict);
4528};
4529var $elm$core$Set$toList = function (_v0) {
4530	var dict = _v0;
4531	return $elm$core$Dict$keys(dict);
4532};
4533var $elm$core$Basics$EQ = 1;
4534var $elm$core$Basics$GT = 2;
4535var $elm$core$Basics$LT = 0;
4536var $author$project$Main$LinkClicked = function (a) {
4537	return {$: 13, a: a};
4538};
4539var $author$project$Main$UrlChanged = function (a) {
4540	return {$: 14, a: a};
4541};
4542var $elm$core$Basics$add = _Basics_add;
4543var $elm$core$Basics$append = _Utils_append;
4544var $elm$core$Result$Err = function (a) {
4545	return {$: 1, a: a};
4546};
4547var $elm$json$Json$Decode$Failure = F2(
4548	function (a, b) {
4549		return {$: 3, a: a, b: b};
4550	});
4551var $elm$json$Json$Decode$Field = F2(
4552	function (a, b) {
4553		return {$: 0, a: a, b: b};
4554	});
4555var $elm$json$Json$Decode$Index = F2(
4556	function (a, b) {
4557		return {$: 1, a: a, b: b};
4558	});
4559var $elm$core$Result$Ok = function (a) {
4560	return {$: 0, a: a};
4561};
4562var $elm$json$Json$Decode$OneOf = function (a) {
4563	return {$: 2, a: a};
4564};
4565var $elm$core$Basics$False = 1;
4566var $elm$core$Maybe$Just = function (a) {
4567	return {$: 0, a: a};
4568};
4569var $elm$core$Maybe$Nothing = {$: 1};
4570var $elm$core$String$all = _String_all;
4571var $elm$core$Basics$and = _Basics_and;
4572var $elm$json$Json$Encode$encode = _Json_encode;
4573var $elm$core$String$fromInt = _String_fromNumber;
4574var $elm$core$String$join = F2(
4575	function (sep, chunks) {
4576		return A2(
4577			_String_join,
4578			sep,
4579			_List_toArray(chunks));
4580	});
4581var $elm$core$String$split = F2(
4582	function (sep, string) {
4583		return _List_fromArray(
4584			A2(_String_split, sep, string));
4585	});
4586var $elm$json$Json$Decode$indent = function (str) {
4587	return A2(
4588		$elm$core$String$join,
4589		'\n    ',
4590		A2($elm$core$String$split, '\n', str));
4591};
4592var $elm$core$List$foldl = F3(
4593	function (func, acc, list) {
4594		foldl:
4595		while (true) {
4596			if (!list.b) {
4597				return acc;
4598			} else {
4599				var x = list.a;
4600				var xs = list.b;
4601				var $temp$func = func,
4602					$temp$acc = A2(func, x, acc),
4603					$temp$list = xs;
4604				func = $temp$func;
4605				acc = $temp$acc;
4606				list = $temp$list;
4607				continue foldl;
4608			}
4609		}
4610	});
4611var $elm$core$List$length = function (xs) {
4612	return A3(
4613		$elm$core$List$foldl,
4614		F2(
4615			function (_v0, i) {
4616				return i + 1;
4617			}),
4618		0,
4619		xs);
4620};
4621var $elm$core$List$map2 = _List_map2;
4622var $elm$core$Basics$le = _Utils_le;
4623var $elm$core$Basics$sub = _Basics_sub;
4624var $elm$core$List$rangeHelp = F3(
4625	function (lo, hi, list) {
4626		rangeHelp:
4627		while (true) {
4628			if (_Utils_cmp(lo, hi) < 1) {
4629				var $temp$lo = lo,
4630					$temp$hi = hi - 1,
4631					$temp$list = A2($elm$core$List$cons, hi, list);
4632				lo = $temp$lo;
4633				hi = $temp$hi;
4634				list = $temp$list;
4635				continue rangeHelp;
4636			} else {
4637				return list;
4638			}
4639		}
4640	});
4641var $elm$core$List$range = F2(
4642	function (lo, hi) {
4643		return A3($elm$core$List$rangeHelp, lo, hi, _List_Nil);
4644	});
4645var $elm$core$List$indexedMap = F2(
4646	function (f, xs) {
4647		return A3(
4648			$elm$core$List$map2,
4649			f,
4650			A2(
4651				$elm$core$List$range,
4652				0,
4653				$elm$core$List$length(xs) - 1),
4654			xs);
4655	});
4656var $elm$core$Char$toCode = _Char_toCode;
4657var $elm$core$Char$isLower = function (_char) {
4658	var code = $elm$core$Char$toCode(_char);
4659	return (97 <= code) && (code <= 122);
4660};
4661var $elm$core$Char$isUpper = function (_char) {
4662	var code = $elm$core$Char$toCode(_char);
4663	return (code <= 90) && (65 <= code);
4664};
4665var $elm$core$Basics$or = _Basics_or;
4666var $elm$core$Char$isAlpha = function (_char) {
4667	return $elm$core$Char$isLower(_char) || $elm$core$Char$isUpper(_char);
4668};
4669var $elm$core$Char$isDigit = function (_char) {
4670	var code = $elm$core$Char$toCode(_char);
4671	return (code <= 57) && (48 <= code);
4672};
4673var $elm$core$Char$isAlphaNum = function (_char) {
4674	return $elm$core$Char$isLower(_char) || ($elm$core$Char$isUpper(_char) || $elm$core$Char$isDigit(_char));
4675};
4676var $elm$core$List$reverse = function (list) {
4677	return A3($elm$core$List$foldl, $elm$core$List$cons, _List_Nil, list);
4678};
4679var $elm$core$String$uncons = _String_uncons;
4680var $elm$json$Json$Decode$errorOneOf = F2(
4681	function (i, error) {
4682		return '\n\n(' + ($elm$core$String$fromInt(i + 1) + (') ' + $elm$json$Json$Decode$indent(
4683			$elm$json$Json$Decode$errorToString(error))));
4684	});
4685var $elm$json$Json$Decode$errorToString = function (error) {
4686	return A2($elm$json$Json$Decode$errorToStringHelp, error, _List_Nil);
4687};
4688var $elm$json$Json$Decode$errorToStringHelp = F2(
4689	function (error, context) {
4690		errorToStringHelp:
4691		while (true) {
4692			switch (error.$) {
4693				case 0:
4694					var f = error.a;
4695					var err = error.b;
4696					var isSimple = function () {
4697						var _v1 = $elm$core$String$uncons(f);
4698						if (_v1.$ === 1) {
4699							return false;
4700						} else {
4701							var _v2 = _v1.a;
4702							var _char = _v2.a;
4703							var rest = _v2.b;
4704							return $elm$core$Char$isAlpha(_char) && A2($elm$core$String$all, $elm$core$Char$isAlphaNum, rest);
4705						}
4706					}();
4707					var fieldName = isSimple ? ('.' + f) : ('[\'' + (f + '\']'));
4708					var $temp$error = err,
4709						$temp$context = A2($elm$core$List$cons, fieldName, context);
4710					error = $temp$error;
4711					context = $temp$context;
4712					continue errorToStringHelp;
4713				case 1:
4714					var i = error.a;
4715					var err = error.b;
4716					var indexName = '[' + ($elm$core$String$fromInt(i) + ']');
4717					var $temp$error = err,
4718						$temp$context = A2($elm$core$List$cons, indexName, context);
4719					error = $temp$error;
4720					context = $temp$context;
4721					continue errorToStringHelp;
4722				case 2:
4723					var errors = error.a;
4724					if (!errors.b) {
4725						return 'Ran into a Json.Decode.oneOf with no possibilities' + function () {
4726							if (!context.b) {
4727								return '!';
4728							} else {
4729								return ' at json' + A2(
4730									$elm$core$String$join,
4731									'',
4732									$elm$core$List$reverse(context));
4733							}
4734						}();
4735					} else {
4736						if (!errors.b.b) {
4737							var err = errors.a;
4738							var $temp$error = err,
4739								$temp$context = context;
4740							error = $temp$error;
4741							context = $temp$context;
4742							continue errorToStringHelp;
4743						} else {
4744							var starter = function () {
4745								if (!context.b) {
4746									return 'Json.Decode.oneOf';
4747								} else {
4748									return 'The Json.Decode.oneOf at json' + A2(
4749										$elm$core$String$join,
4750										'',
4751										$elm$core$List$reverse(context));
4752								}
4753							}();
4754							var introduction = starter + (' failed in the following ' + ($elm$core$String$fromInt(
4755								$elm$core$List$length(errors)) + ' ways:'));
4756							return A2(
4757								$elm$core$String$join,
4758								'\n\n',
4759								A2(
4760									$elm$core$List$cons,
4761									introduction,
4762									A2($elm$core$List$indexedMap, $elm$json$Json$Decode$errorOneOf, errors)));
4763						}
4764					}
4765				default:
4766					var msg = error.a;
4767					var json = error.b;
4768					var introduction = function () {
4769						if (!context.b) {
4770							return 'Problem with the given value:\n\n';
4771						} else {
4772							return 'Problem with the value at json' + (A2(
4773								$elm$core$String$join,
4774								'',
4775								$elm$core$List$reverse(context)) + ':\n\n    ');
4776						}
4777					}();
4778					return introduction + ($elm$json$Json$Decode$indent(
4779						A2($elm$json$Json$Encode$encode, 4, json)) + ('\n\n' + msg));
4780			}
4781		}
4782	});
4783var $elm$core$Array$branchFactor = 32;
4784var $elm$core$Array$Array_elm_builtin = F4(
4785	function (a, b, c, d) {
4786		return {$: 0, a: a, b: b, c: c, d: d};
4787	});
4788var $elm$core$Elm$JsArray$empty = _JsArray_empty;
4789var $elm$core$Basics$ceiling = _Basics_ceiling;
4790var $elm$core$Basics$fdiv = _Basics_fdiv;
4791var $elm$core$Basics$logBase = F2(
4792	function (base, number) {
4793		return _Basics_log(number) / _Basics_log(base);
4794	});
4795var $elm$core$Basics$toFloat = _Basics_toFloat;
4796var $elm$core$Array$shiftStep = $elm$core$Basics$ceiling(
4797	A2($elm$core$Basics$logBase, 2, $elm$core$Array$branchFactor));
4798var $elm$core$Array$empty = A4($elm$core$Array$Array_elm_builtin, 0, $elm$core$Array$shiftStep, $elm$core$Elm$JsArray$empty, $elm$core$Elm$JsArray$empty);
4799var $elm$core$Elm$JsArray$initialize = _JsArray_initialize;
4800var $elm$core$Array$Leaf = function (a) {
4801	return {$: 1, a: a};
4802};
4803var $elm$core$Basics$apL = F2(
4804	function (f, x) {
4805		return f(x);
4806	});
4807var $elm$core$Basics$apR = F2(
4808	function (x, f) {
4809		return f(x);
4810	});
4811var $elm$core$Basics$eq = _Utils_equal;
4812var $elm$core$Basics$floor = _Basics_floor;
4813var $elm$core$Elm$JsArray$length = _JsArray_length;
4814var $elm$core$Basics$gt = _Utils_gt;
4815var $elm$core$Basics$max = F2(
4816	function (x, y) {
4817		return (_Utils_cmp(x, y) > 0) ? x : y;
4818	});
4819var $elm$core$Basics$mul = _Basics_mul;
4820var $elm$core$Array$SubTree = function (a) {
4821	return {$: 0, a: a};
4822};
4823var $elm$core$Elm$JsArray$initializeFromList = _JsArray_initializeFromList;
4824var $elm$core$Array$compressNodes = F2(
4825	function (nodes, acc) {
4826		compressNodes:
4827		while (true) {
4828			var _v0 = A2($elm$core$Elm$JsArray$initializeFromList, $elm$core$Array$branchFactor, nodes);
4829			var node = _v0.a;
4830			var remainingNodes = _v0.b;
4831			var newAcc = A2(
4832				$elm$core$List$cons,
4833				$elm$core$Array$SubTree(node),
4834				acc);
4835			if (!remainingNodes.b) {
4836				return $elm$core$List$reverse(newAcc);
4837			} else {
4838				var $temp$nodes = remainingNodes,
4839					$temp$acc = newAcc;
4840				nodes = $temp$nodes;
4841				acc = $temp$acc;
4842				continue compressNodes;
4843			}
4844		}
4845	});
4846var $elm$core$Tuple$first = function (_v0) {
4847	var x = _v0.a;
4848	return x;
4849};
4850var $elm$core$Array$treeFromBuilder = F2(
4851	function (nodeList, nodeListSize) {
4852		treeFromBuilder:
4853		while (true) {
4854			var newNodeSize = $elm$core$Basics$ceiling(nodeListSize / $elm$core$Array$branchFactor);
4855			if (newNodeSize === 1) {
4856				return A2($elm$core$Elm$JsArray$initializeFromList, $elm$core$Array$branchFactor, nodeList).a;
4857			} else {
4858				var $temp$nodeList = A2($elm$core$Array$compressNodes, nodeList, _List_Nil),
4859					$temp$nodeListSize = newNodeSize;
4860				nodeList = $temp$nodeList;
4861				nodeListSize = $temp$nodeListSize;
4862				continue treeFromBuilder;
4863			}
4864		}
4865	});
4866var $elm$core$Array$builderToArray = F2(
4867	function (reverseNodeList, builder) {
4868		if (!builder.k) {
4869			return A4(
4870				$elm$core$Array$Array_elm_builtin,
4871				$elm$core$Elm$JsArray$length(builder.m),
4872				$elm$core$Array$shiftStep,
4873				$elm$core$Elm$JsArray$empty,
4874				builder.m);
4875		} else {
4876			var treeLen = builder.k * $elm$core$Array$branchFactor;
4877			var depth = $elm$core$Basics$floor(
4878				A2($elm$core$Basics$logBase, $elm$core$Array$branchFactor, treeLen - 1));
4879			var correctNodeList = reverseNodeList ? $elm$core$List$reverse(builder.n) : builder.n;
4880			var tree = A2($elm$core$Array$treeFromBuilder, correctNodeList, builder.k);
4881			return A4(
4882				$elm$core$Array$Array_elm_builtin,
4883				$elm$core$Elm$JsArray$length(builder.m) + treeLen,
4884				A2($elm$core$Basics$max, 5, depth * $elm$core$Array$shiftStep),
4885				tree,
4886				builder.m);
4887		}
4888	});
4889var $elm$core$Basics$idiv = _Basics_idiv;
4890var $elm$core$Basics$lt = _Utils_lt;
4891var $elm$core$Array$initializeHelp = F5(
4892	function (fn, fromIndex, len, nodeList, tail) {
4893		initializeHelp:
4894		while (true) {
4895			if (fromIndex < 0) {
4896				return A2(
4897					$elm$core$Array$builderToArray,
4898					false,
4899					{n: nodeList, k: (len / $elm$core$Array$branchFactor) | 0, m: tail});
4900			} else {
4901				var leaf = $elm$core$Array$Leaf(
4902					A3($elm$core$Elm$JsArray$initialize, $elm$core$Array$branchFactor, fromIndex, fn));
4903				var $temp$fn = fn,
4904					$temp$fromIndex = fromIndex - $elm$core$Array$branchFactor,
4905					$temp$len = len,
4906					$temp$nodeList = A2($elm$core$List$cons, leaf, nodeList),
4907					$temp$tail = tail;
4908				fn = $temp$fn;
4909				fromIndex = $temp$fromIndex;
4910				len = $temp$len;
4911				nodeList = $temp$nodeList;
4912				tail = $temp$tail;
4913				continue initializeHelp;
4914			}
4915		}
4916	});
4917var $elm$core$Basics$remainderBy = _Basics_remainderBy;
4918var $elm$core$Array$initialize = F2(
4919	function (len, fn) {
4920		if (len <= 0) {
4921			return $elm$core$Array$empty;
4922		} else {
4923			var tailLen = len % $elm$core$Array$branchFactor;
4924			var tail = A3($elm$core$Elm$JsArray$initialize, tailLen, len - tail
4924Len, fn);
4925			var initialFromIndex = (len - tailLen) - $elm$core$Array$branchFactor;
4926			return A5($elm$core$Array$initializeHelp, fn, initialFromIndex, len, _List_Nil, tail);
4927		}
4928	});
4929var $elm$core$Basics$True = 0;
4930var $elm$core$Result$isOk = function (result) {
4931	if (!result.$) {
4932		return true;
4933	} else {
4934		return false;
4935	}
4936};
4937var $elm$json$Json$Decode$map = _Json_map1;
4938var $elm$json$Json$Decode$map2 = _Json_map2;
4939var $elm$json$Json$Decode$succeed = _Json_succeed;
4940var $elm$virtual_dom$VirtualDom$toHandlerInt = function (handler) {
4941	switch (handler.$) {
4942		case 0:
4943			return 0;
4944		case 1:
4945			return 1;
4946		case 2:
4947			return 2;
4948		default:
4949			return 3;
4950	}
4951};
4952var $elm$browser$Browser$External = function (a) {
4953	return {$: 1, a: a};
4954};
4955var $elm$browser$Browser$Internal = function (a) {
4956	return {$: 0, a: a};
4957};
4958var $elm$core$Basics$identity = function (x) {
4959	return x;
4960};
4961var $elm$browser$Browser$Dom$NotFound = $elm$core$Basics$identity;
4962var $elm$url$Url$Http = 0;
4963var $elm$url$Url$Https = 1;
4964var $elm$url$Url$Url = F6(
4965	function (protocol, host, port_, path, query, fragment) {
4966		return {a9: fragment, bb: host, bh: path, bk: port_, bn: protocol, bo: query};
4967	});
4968var $elm$core$String$contains = _String_contains;
4969var $elm$core$String$length = _String_length;
4970var $elm$core$String$slice = _String_slice;
4971var $elm$core$String$dropLeft = F2(
4972	function (n, string) {
4973		return (n < 1) ? string : A3(
4974			$elm$core$String$slice,
4975			n,
4976			$elm$core$String$length(string),
4977			string);
4978	});
4979var $elm$core$String$indexes = _String_indexes;
4980var $elm$core$String$isEmpty = function (string) {
4981	return string === '';
4982};
4983var $elm$core$String$left = F2(
4984	function (n, string) {
4985		return (n < 1) ? '' : A3($elm$core$String$slice, 0, n, string);
4986	});
4987var $elm$core$String$toInt = _String_toInt;
4988var $elm$url$Url$chompBeforePath = F5(
4989	function (protocol, path, params, frag, str) {
4990		if ($elm$core$String$isEmpty(str) || A2($elm$core$String$contains, '@', str)) {
4991			return $elm$core$Maybe$Nothing;
4992		} else {
4993			var _v0 = A2($elm$core$String$indexes, ':', str);
4994			if (!_v0.b) {
4995				return $elm$core$Maybe$Just(
4996					A6($elm$url$Url$Url, protocol, str, $elm$core$Maybe$Nothing, path, params, frag));
4997			} else {
4998				if (!_v0.b.b) {
4999					var i = _v0.a;
5000					var _v1 = $elm$core$String$toInt(
5001						A2($elm$core$String$dropLeft, i + 1, str));
5002					if (_v1.$ === 1) {
5003						return $elm$core$Maybe$Nothing;
5004					} else {
5005						var port_ = _v1;
5006						return $elm$core$Maybe$Just(
5007							A6(
5008								$elm$url$Url$Url,
5009								protocol,
5010								A2($elm$core$String$left, i, str),
5011								port_,
5012								path,
5013								params,
5014								frag));
5015					}
5016				} else {
5017					return $elm$core$Maybe$Nothing;
5018				}
5019			}
5020		}
5021	});
5022var $elm$url$Url$chompBeforeQuery = F4(
5023	function (protocol, params, frag, str) {
5024		if ($elm$core$String$isEmpty(str)) {
5025			return $elm$core$Maybe$Nothing;
5026		} else {
5027			var _v0 = A2($elm$core$String$indexes, '/', str);
5028			if (!_v0.b) {
5029				return A5($elm$url$Url$chompBeforePath, protocol, '/', params, frag, str);
5030			} else {
5031				var i = _v0.a;
5032				return A5(
5033					$elm$url$Url$chompBeforePath,
5034					protocol,
5035					A2($elm$core$String$dropLeft, i, str),
5036					params,
5037					frag,
5038					A2($elm$core$String$left, i, str));
5039			}
5040		}
5041	});
5042var $elm$url$Url$chompBeforeFragment = F3(
5043	function (protocol, frag, str) {
5044		if ($elm$core$String$isEmpty(str)) {
5045			return $elm$core$Maybe$Nothing;
5046		} else {
5047			var _v0 = A2($elm$core$String$indexes, '?', str);
5048			if (!_v0.b) {
5049				return A4($elm$url$Url$chompBeforeQuery, protocol, $elm$core$Maybe$Nothing, frag, str);
5050			} else {
5051				var i = _v0.a;
5052				return A4(
5053					$elm$url$Url$chompBeforeQuery,
5054					protocol,
5055					$elm$core$Maybe$Just(
5056						A2($elm$core$String$dropLeft, i + 1, str)),
5057					frag,
5058					A2($elm$core$String$left, i, str));
5059			}
5060		}
5061	});
5062var $elm$url$Url$chompAfterProtocol = F2(
5063	function (protocol, str) {
5064		if ($elm$core$String$isEmpty(str)) {
5065			return $elm$core$Maybe$Nothing;
5066		} else {
5067			var _v0 = A2($elm$core$String$indexes, '#', str);
5068			if (!_v0.b) {
5069				return A3($elm$url$Url$chompBeforeFragment, protocol, $elm$core$Maybe$Nothing, str);
5070			} else {
5071				var i = _v0.a;
5072				return A3(
5073					$elm$url$Url$chompBeforeFragment,
5074					protocol,
5075					$elm$core$Maybe$Just(
5076						A2($elm$core$String$dropLeft, i + 1, str)),
5077					A2($elm$core$String$left, i, str));
5078			}
5079		}
5080	});
5081var $elm$core$String$startsWith = _String_startsWith;
5082var $elm$url$Url$fromString = function (str) {
5083	return A2($elm$core$String$startsWith, 'http://', str) ? A2(
5084		$elm$url$Url$chompAfterProtocol,
5085		0,
5086		A2($elm$core$String$dropLeft, 7, str)) : (A2($elm$core$String$startsWith, 'https://', str) ? A2(
5087		$elm$url$Url$chompAfterProtocol,
5088		1,
5089		A2($elm$core$String$dropLeft, 8, str)) : $elm$core$Maybe$Nothing);
5090};
5091var $elm$core$Basics$never = function (_v0) {
5092	never:
5093	while (true) {
5094		var nvr = _v0;
5095		var $temp$_v0 = nvr;
5096		_v0 = $temp$_v0;
5097		continue never;
5098	}
5099};
5100var $elm$core$Task$Perform = $elm$core$Basics$identity;
5101var $elm$core$Task$succeed = _Scheduler_succeed;
5102var $elm$core$Task$init = $elm$core$Task$succeed(0);
5103var $elm$core$List$foldrHelper = F4(
5104	function (fn, acc, ctr, ls) {
5105		if (!ls.b) {
5106			return acc;
5107		} else {
5108			var a = ls.a;
5109			var r1 = ls.b;
5110			if (!r1.b) {
5111				return A2(fn, a, acc);
5112			} else {
5113				var b = r1.a;
5114				var r2 = r1.b;
5115				if (!r2.b) {
5116					return A2(
5117						fn,
5118						a,
5119						A2(fn, b, acc));
5120				} else {
5121					var c = r2.a;
5122					var r3 = r2.b;
5123					if (!r3.b) {
5124						return A2(
5125							fn,
5126							a,
5127							A2(
5128								fn,
5129								b,
5130								A2(fn, c, acc)));
5131					} else {
5132						var d = r3.a;
5133						var r4 = r3.b;
5134						var res = (ctr > 500) ? A3(
5135							$elm$core$List$foldl,
5136							fn,
5137							acc,
5138							$elm$core$List$reverse(r4)) : A4($elm$core$List$foldrHelper, fn, acc, ctr + 1, r4);
5139						return A2(
5140							fn,
5141							a,
5142							A2(
5143								fn,
5144								b,
5145								A2(
5146									fn,
5147									c,
5148									A2(fn, d, res))));
5149					}
5150				}
5151			}
5152		}
5153	});
5154var $elm$core$List$foldr = F3(
5155	function (fn, acc, ls) {
5156		return A4($elm$core$List$foldrHelper, fn, acc, 0, ls);
5157	});
5158var $elm$core$List$map = F2(
5159	function (f, xs) {
5160		return A3(
5161			$elm$core$List$foldr,
5162			F2(
5163				function (x, acc) {
5164					return A2(
5165						$elm$core$List$cons,
5166						f(x),
5167						acc);
5168				}),
5169			_List_Nil,
5170			xs);
5171	});
5172var $elm$core$Task$andThen = _Scheduler_andThen;
5173var $elm$core$Task$map = F2(
5174	function (func, taskA) {
5175		return A2(
5176			$elm$core$Task$andThen,
5177			function (a) {
5178				return $elm$core$Task$succeed(
5179					func(a));
5180			},
5181			taskA);
5182	});
5183var $elm$core$Task$map2 = F3(
5184	function (func, taskA, taskB) {
5185		return A2(
5186			$elm$core$Task$andThen,
5187			function (a) {
5188				return A2(
5189					$elm$core$Task$andThen,
5190					function (b) {
5191						return $elm$core$Task$succeed(
5192							A2(func, a, b));
5193					},
5194					taskB);
5195			},
5196			taskA);
5197	});
5198var $elm$core$Task$sequence = function (tasks) {
5199	return A3(
5200		$elm$core$List$foldr,
5201		$elm$core$Task$map2($elm$core$List$cons),
5202		$elm$core$Task$succeed(_List_Nil),
5203		tasks);
5204};
5205var $elm$core$Platform$sendToApp = _Platform_sendToApp;
5206var $elm$core$Task$spawnCmd = F2(
5207	function (router, _v0) {
5208		var task = _v0;
5209		return _Scheduler_spawn(
5210			A2(
5211				$elm$core$Task$andThen,
5212				$elm$core$Platform$sendToApp(router),
5213				task));
5214	});
5215var $elm$core$Task$onEffects = F3(
5216	function (router, commands, state) {
5217		return A2(
5218			$elm$core$Task$map,
5219			function (_v0) {
5220				return 0;
5221			},
5222			$elm$core$Task$sequence(
5223				A2(
5224					$elm$core$List$map,
5225					$elm$core$Task$spawnCmd(router),
5226					commands)));
5227	});
5228var $elm$core$Task$onSelfMsg = F3(
5229	function (_v0, _v1, _v2) {
5230		return $elm$core$Task$succeed(0);
5231	});
5232var $elm$core$Task$cmdMap = F2(
5233	function (tagger, _v0) {
5234		var task = _v0;
5235		return A2($elm$core$Task$map, tagger, task);
5236	});
5237_Platform_effectManagers['Task'] = _Platform_createManager($elm$core$Task$init, $elm$core$Task$onEffects, $elm$core$Task$onSelfMsg, $elm$core$Task$cmdMap);
5238var $elm$core$Task$command = _Platform_leaf('Task');
5239var $elm$core$Task$perform = F2(
5240	function (toMessage, task) {
5241		return $elm$core$Task$command(
5242			A2($elm$core$Task$map, toMessage, task));
5243	});
5244var $elm$browser$Browser$application = _Browser_application;
5245var $author$project$Main$LevelIntro = 0;
5246var $author$project$Main$SeedGenerated = function (a) {
5247	return {$: 4, a: a};
5248};
5249var $elm$core$Platform$Cmd$batch = _Platform_batch;
5250var $author$project$Main$Falling = {$: 1};
5251var $elm$random$Random$Generator = $elm$core$Basics$identity;
5252var $elm$core$Bitwise$and = _Bitwise_and;
5253var $elm$core$Basics$negate = function (n) {
5254	return -n;
5255};
5256var $elm$random$Random$Seed = F2(
5257	function (a, b) {
5258		return {$: 0, a: a, b: b};
5259	});
5260var $elm$core$Bitwise$shiftRightZfBy = _Bitwise_shiftRightZfBy;
5261var $elm$random$Random$next = function (_v0) {
5262	var state0 = _v0.a;
5263	var incr = _v0.b;
5264	return A2($elm$random$Random$Seed, ((state0 * 1664525) + incr) >>> 0, incr);
5265};
5266var $elm$core$Bitwise$xor = _Bitwise_xor;
5267var $elm$random$Random$peel = function (_v0) {
5268	var state = _v0.a;
5269	var word = (state ^ (state >>> ((state >>> 28) + 4))) * 277803737;
5270	return ((word >>> 22) ^ word) >>> 0;
5271};
5272var $elm$random$Random$int = F2(
5273	function (a, b) {
5274		return function (seed0) {
5275			var _v0 = (_Utils_cmp(a, b) < 0) ? _Utils_Tuple2(a, b) : _Utils_Tuple2(b, a);
5276			var lo = _v0.a;
5277			var hi = _v0.b;
5278			var range = (hi - lo) + 1;
5279			if (!((range - 1) & range)) {
5280				return _Utils_Tuple2(
5281					(((range - 1) & $elm$random$Random$peel(seed0)) >>> 0) + lo,
5282					$elm$random$Random$next(seed0));
5283			} else {
5284				var threshhold = (((-range) >>> 0) % range) >>> 0;
5285				var accountForBias = function (seed) {
5286					accountForBias:
5287					while (true) {
5288						var x = $elm$random$Random$peel(seed);
5289						var seedN = $elm$random$Random$next(seed);
5290						if (_Utils_cmp(x, threshhold) < 0) {
5291							var $temp$seed = seedN;
5292							seed = $temp$seed;
5293							continue accountForBias;
5294						} else {
5295							return _Utils_Tuple2((x % range) + lo, seedN);
5296						}
5297					}
5298				};
5299				return accountForBias(seed0);
5300			}
5301		};
5302	});
5303var $elm$random$Random$step = F2(
5304	function (_v0, seed) {
5305		var generator = _v0;
5306		return generator(seed);
5307	});
5308var $author$project$Main$createSingleMiner = F4(
5309	function (levelWidth, totalMiners, minerIndex, _v0) {
5310		var miners = _v0.a;
5311		var seed = _v0.b;
5312		var facingLeft = (_Utils_cmp(minerIndex, (totalMiners / 2) | 0) < 0) ? true : false;
5313		var _v1 = A2(
5314			$elm$random$Random$step,
5315			A2($elm$random$Random$int, 24, 47),
5316			seed);
5317		var baseX = _v1.a;
5318		var seed1 = _v1.b;
5319		var finalX = (_Utils_cmp(minerIndex, (totalMiners / 2) | 0) < 0) ? (levelWidth - baseX) : baseX;
5320		var _v2 = A2(
5321			$elm$random$Random$step,
5322			A2($elm$random$Random$int, 0, 399),
5323			seed1);
5324		var negativeY = _v2.a;
5325		var seed2 = _v2.b;
5326		var finalY = -negativeY;
5327		var miner = {ae: 0, l: false, c: facingLeft, f: -640, g: 0, h: $author$project$Main$Falling, u: $elm$core$Maybe$Nothing, aP: 0.0, aQ: 0.0, a: finalX, b: finalY};
5328		var seed3 = seed2;
5329		return _Utils_Tuple2(
5330			A2($elm$core$List$cons, miner, miners),
5331			seed3);
5332	});
5333var $author$project$Main$createInitialMiners = F3(
5334	function (levelWidth, numMiners, seed) {
5335		var _v0 = A3(
5336			$elm$core$List$foldl,
5337			A2($author$project$Main$createSingleMiner, levelWidth, numMiners),
5338			_Utils_Tuple2(_List_Nil, seed),
5339			A2($elm$core$List$range, 0, numMiners - 1));
5340		var miners = _v0.a;
5341		return $elm$core$List$reverse(miners);
5342	});
5343var $elm$core$List$append = F2(
5344	function (xs, ys) {
5345		if (!ys.b) {
5346			return xs;
5347		} else {
5348			return A3($elm$core$List$foldr, $elm$core$List$cons, ys, xs);
5349		}
5350	});
5351var $elm$core$List$concat = function (lists) {
5352	return A3($elm$core$List$foldr, $elm$core$List$append, _List_Nil, lists);
5353};
5354var $elm$core$List$concatMap = F2(
5355	function (f, list) {
5356		return $elm$core$List$concat(
5357			A2($elm$core$List$map, f, list));
5358	});
5359var $elm$core$List$filter = F2(
5360	function (isGood, list) {
5361		return A3(
5362			$elm$core$List$foldr,
5363			F2(
5364				function (x, xs) {
5365					return isGood(x) ? A2($elm$core$List$cons, x, xs) : xs;
5366				}),
5367			_List_Nil,
5368			list);
5369	});
5370var $elm$core$Basics$ge = _Utils_ge;
5371var $elm$core$Array$bitMask = 4294967295 >>> (32 - $elm$core$Array$shiftStep);
5372var $elm$core$Elm$JsArray$unsafeGet = _JsArray_unsafeGet;
5373var $elm$core$Array$getHelp = F3(
5374	function (shift, index, tree) {
5375		getHelp:
5376		while (true) {
5377			var pos = $elm$core$Array$bitMask & (index >>> shift);
5378			var _v0 = A2($elm$core$Elm$JsArray$unsafeGet, pos, tree);
5379			if (!_v0.$) {
5380				var subTree = _v0.a;
5381				var $temp$shift = shift - $elm$core$Array$shiftStep,
5382					$temp$index = index,
5383					$temp$tree = subTree;
5384				shift = $temp$shift;
5385				index = $temp$index;
5386				tree = $temp$tree;
5387				continue getHelp;
5388			} else {
5389				var values = _v0.a;
5390				return A2($elm$core$Elm$JsArray$unsafeGet, $elm$core$Array$bitMask & index, values);
5391			}
5392		}
5393	});
5394var $elm$core$Bitwise$shiftLeftBy = _Bitwise_shiftLeftBy;
5395var $elm$core$Array$tailIndex = function (len) {
5396	return (len >>> 5) << 5;
5397};
5398var $elm$core$Array$get = F2(
5399	function (index, _v0) {
5400		var len = _v0.a;
5401		var startShift = _v0.b;
5402		var tree = _v0.c;
5403		var tail = _v0.d;
5404		return ((index < 0) || (_Utils_cmp(index, len) > -1)) ? $elm$core$Maybe$Nothing : ((_Utils_cmp(
5405			index,
5406			$elm$core$Array$tailIndex(len)) > -1) ? $elm$core$Maybe$Just(
5407			A2($elm$core$Elm$JsArray$unsafeGet, $elm$core$Array$bitMask & index, tail)) : $elm$core$Maybe$Just(
5408			A3($elm$core$Array$getHelp, startShift, index, tree)));
5409	});
5410var $elm$core$Bitwise$or = _Bitwise_or;
5411var $elm$core$Maybe$withDefault = F2(
5412	function (_default, maybe) {
5413		if (!maybe.$) {
5414			var value = maybe.a;
5415			return value;
5416		} else {
5417			return _default;
5418		}
5419	});
5420var $author$project$Main$getPixelAt = F3(
5421	function (x, y, levelArray) {
5422		var index = x | (y << 10);
5423		return A2(
5424			$elm$core$Maybe$withDefault,
5425			0,
5426			A2($elm$core$Array$get, index, levelArray));
5427	});
5428var $elm$core$Basics$min = F2(
5429	function (x, y) {
5430		return (_Utils_cmp(x, y) < 0) ? x : y;
5431	});
5432var $elm$core$Basics$neq = _Utils_notEqual;
5433var $elm$core$Basics$round = _Basics_round;
5434var $elm$core$Elm$JsArray$unsafeSet = _JsArray_unsafeSet;
5435var $elm$core$Array$setHelp = F4(
5436	function (shift, index, value, tree) {
5437		var pos = $elm$core$Array$bitMask & (index >>> shift);
5438		var _v0 = A2($elm$core$Elm$JsArray$unsafeGet, pos, tree);
5439		if (!_v0.$) {
5440			var subTree = _v0.a;
5441			var newSub = A4($elm$core$Array$setHelp, shift - $elm$core$Array$shiftStep, index, value, subTree);
5442			return A3(
5443				$elm$core$Elm$JsArray$unsafeSet,
5444				pos,
5445				$elm$core$Array$SubTree(newSub),
5446				tree);
5447		} else {
5448			var values = _v0.a;
5449			var newLeaf = A3($elm$core$Elm$JsArray$unsafeSet, $elm$core$Array$bitMask & index, value, values);
5450			return A3(
5451				$elm$core$Elm$JsArray$unsafeSet,
5452				pos,
5453				$elm$core$Array$Leaf(newLeaf),
5454				tree);
5455		}
5456	});
5457var $elm$core$Array$set = F3(
5458	function (index, value, array) {
5459		var len = array.a;
5460		var startShift = array.b;
5461		var tree = array.c;
5462		var tail = array.d;
5463		return ((index < 0) || (_Utils_cmp(index, len) > -1)) ? array : ((_Utils_cmp(
5464			index,
5465			$elm$core$Array$tailIndex(len)) > -1) ? A4(
5466			$elm$core$Array$Array_elm_builtin,
5467			len,
5468			startShift,
5469			tree,
5470			A3($elm$core$Elm$JsArray$unsafeSet, $elm$core$Array$bitMask & index, value, tail)) : A4(
5471			$elm$core$Array$Array_elm_builtin,
5472			len,
5473			startShift,
5474			A4($elm$core$Array$setHelp, startShift, index, value, tree),
5475			tail));
5476	});
5477var $author$project$Main$setPixelAt = F4(
5478	function (x, y, color, levelArray) {
5479		var index = x | (y << 10);
5480		return A3($elm$core$Array$set, index, color, levelArray);
5481	});
5482var $author$project$Main$setObjectPixel = F8(
5483	function (levelWidth, objectType, size, centerX, centerY, seed, _v0, levelArray) {
5484		var x = _v0.a;
5485		var y = _v0.b;
5486		var currentPixel = A3($author$project$Main$getPixelAt, x, y, levelArray);
5487		if (!(!currentPixel)) {
5488			var objectColor = function () {
5489				if (objectType === 1) {
5490					var dy = (y - centerY) + (size / 3.0);
5491					var dx = (x - centerX) + (size / 3.0);
5492					var d2 = $elm$core$Basics$round((((dx * dx) / (size * size)) + ((dy * dy) / (size * size))) * 64.0);
5493					var _v1 = A2(
5494						$elm$random$Random$step,
5495						A2($elm$random$Random$int, 0, 15),
5496						seed);
5497					var randomVal = _v1.a;
5498					var c = (200 - d2) - randomVal;
5499					var grayValue = A2(
5500						$elm$core$Basics$max,
5501						0,
5502						A2($elm$core$Basics$min, 255, c));
5503					return (grayValue << 16) | ((grayValue << 8) | grayValue);
5504				} else {
5505					if (!objectType) {
5506						return 16776960;
5507					} else {
5508						return 65280;
5509					}
5510				}
5511			}();
5512			return A4($author$project$Main$setPixelAt, x, y, objectColor, levelArray);
5513		} else {
5514			return levelArray;
5515		}
5516	});
5517var $author$project$Main$drawObjectBlob = F8(
5518	function (levelArray, levelWidth, levelHeight, centerX, centerY, size, objectType, seed) {
5519		var positions = A2(
5520			$elm$core$List$concatMap,
5521			function (x) {
5522				return A2(
5523					$elm$core$List$map,
5524					function (y) {
5525						return _Utils_Tuple2(x, y);
5526					},
5527					A2($elm$core$List$range, centerY - size, centerY + size));
5528			},
5529			A2($elm$core$List$range, centerX - size, centerX + size));
5530		var validPositions = A2(
5531			$elm$core$List$filter,
5532			function (_v0) {
5533				var x = _v0.a;
5534				var y = _v0.b;
5535				var dy = y - centerY;
5536				var dx = x - centerX;
5537				var distanceSquared = (dx * dx) + (dy * dy);
5538				return (_Utils_cmp(distanceSquared, size * size) < 0) && ((x >= 0) && ((x < 1024) && ((y >= 0) && (y < 2048))));
5539			},
5540			positions);
5541		return A3(
5542			$elm$core$List$foldl,
5543			A6($author$project$Main$setObjectPixel, levelWidth, objectType, size, centerX, centerY, seed),
5544			levelArray,
5545			validPositions);
5546	});
5547var $author$project$Main$addSingleObject = F5(
5548	function (levelWidth, levelHeight, levelConfig, objectIndex, _v0) {
5549		var levelArray = _v0.a;
5550		var seed = _v0.b;
5551		var objectType = (_Utils_cmp(objectIndex, levelConfig.K) < 0) ? 0 : ((_Utils_cmp(objectIndex, levelConfig.K + levelConfig.ab) < 0) ? 1 : 2);
5552		var _v1 = A2(
5553			$elm$random$Random$step,
5554			A2($elm$random$Random$int, 20, levelWidth - 20),
5555			seed);
5556		var x = _v1.a;
5557		var seed1 = _v1.b;
5558		var _v2 = A2(
5559			$elm$random$Random$step,
5560			A2($elm$random$Random$int, 0, levelHeight - 240),
5561			seed1);
5562		var y0Raw = _v2.a;
5563		var seed2 = _v2.b;
5564		var _v3 = A2(
5565			$elm$random$Random$step,
5566			A2($elm$random$Random$int, 0, levelHeight - 240),
5567			seed2);
5568		var y1Raw = _v3.a;
5569		var seed3 = _v3.b;
5570		var _v4 = A2(
5571			$elm$random$Random$step,
5572			A2($elm$random$Random$int, 0, levelHeight - 240),
5573			seed3);
5574		var y2Raw = _v4.a;
5575		var seed4 = _v4.b;
5576		var _v5 = (!objectType) ? A2(
5577			$elm$random$Random$step,
5578			A2($elm$random$Random$int, 4, 12),
5579			seed4) : ((objectType === 1) ? A2(
5580			$elm$random$Random$step,
5581			A2($elm$random$Random$int, 8, 40),
5582			seed4) : _Utils_Tuple2(6, seed4));
5583		var size = _v5.a;
5584		var seed5 = _v5.b;
5585		var y2 = y2Raw + 200;
5586		var y1 = y1Raw + 200;
5587		var y0 = y0Raw + 200;
5588		var y = A2(
5589			$elm$core$Basics$max,
5590			y0,
5591			A2($elm$core$Basics$max, y1, y2));
5592		var levelWithObject = A8($author$project$Main$drawObjectBlob, levelArray, levelWidth, levelHeight, x, y, size, objectType, seed5);
5593		return _Utils_Tuple2(levelWithObject, seed5);
5594	});
5595var $elm$core$Array$fromListHelp = F3(
5596	function (list, nodeList, nodeListSize) {
5597		fromListHelp:
5598		while (true) {
5599			var _v0 = A2($elm$core$Elm$JsArray$initializeFromList, $elm$core$Array$branchFactor, list);
5600			var jsArray = _v0.a;
5601			var remainingItems = _v0.b;
5602			if (_Utils_cmp(
5603				$elm$core$Elm$JsArray$length(jsArray),
5604				$elm$core$Array$branchFactor) < 0) {
5605				return A2(
5606					$elm$core$Array$builderToArray,
5607					true,
5608					{n: nodeList, k: nodeListSize, m: jsArray});
5609			} else {
5610				var $temp$list = remainingItems,
5611					$temp$nodeList = A2(
5612					$elm$core$List$cons,
5613					$elm$core$Array$Leaf(jsArray),
5614					nodeList),
5615					$temp$nodeListSize = nodeListSize + 1;
5616				list = $temp$list;
5617				nodeList = $temp$nodeList;
5618				nodeListSize = $temp$nodeListSize;
5619				continue fromListHelp;
5620			}
5621		}
5622	});
5623var $elm$core$Array$fromList = function (list) {
5624	if (!list.b) {
5625		return $elm$core$Array$empty;
5626	} else {
5627		return A3($elm$core$Array$fromListHelp, list, _List_Nil, 0);
5628	}
5629};
5630var $author$project$Main$levelSlimes = $elm$core$Array$fromList(
5631	_List_fromArray(
5632		[0, 0, 0, 6, 10, 25, 0]));
5633var $author$project$Main$getLevelConfig = function (currentLevel) {
5634	var slimeCount = A2(
5635		$elm$core$Maybe$withDefault,
5636		0,
5637		A2($elm$core$Array$get, currentLevel, $author$project$Main$levelSlimes));
5638	var baseWidth = (((currentLevel / 4) | 0) * 384) + 640;
5639	var baseTarget = currentLevel * 500;
5640	var baseRocks = (((currentLevel - 1) / 2) | 0) * 100;
5641	var baseHeight = (currentLevel > 1) ? 1024 : 480;
5642	var baseGoldLumps = (currentLevel * currentLevel) * 50;
5643	var baseDiggers = (currentLevel * currentLevel) * 50;
5644	var config = (!currentLevel) ? {C: 50, K: 10, X: baseHeight, ab: 0, am: slimeCount, O: 100, P: 200, ad: baseWidth} : ((currentLevel === 1) ? {C: baseDiggers, K: 30, X: baseHeight, ab: 10, am: slimeCount, O: 200, P: 400, ad: baseWidth} : ((currentLevel === 2) ? {C: baseDiggers, K: baseGoldLumps, X: baseHeight, ab: 50, am: slimeCount, O: baseTarget, P: baseTarget * 2, ad: baseWidth} : ((currentLevel === 6) ? {C: 800, K: baseGoldLumps, X: 2048, ab: baseRocks, am: slimeCount, O: 99999, P: 199998, ad: baseWi
5644dth} : {C: baseDiggers, K: baseGoldLumps, X: baseHeight, ab: baseRocks, am: slimeCount, O: baseTarget, P: baseTarget * 2, ad: baseWidth})));
5645	return config;
5646};
5647var $author$project$Main$addGoldObjects = F5(
5648	function (levelArray, levelWidth, levelHeight, currentLevel, seed) {
5649		var levelConfig = $author$project$Main$getLevelConfig(currentLevel);
5650		var totalObjects = (levelConfig.K + levelConfig.ab) + levelConfig.am;
5651		var _v0 = A3(
5652			$elm$core$List$foldl,
5653			A3($author$project$Main$addSingleObject, levelWidth, levelHeight, levelConfig),
5654			_Utils_Tuple2(levelArray, seed),
5655			A2($elm$core$List$range, 0, totalObjects - 1));
5656		var levelWithObjects = _v0.a;
5657		var finalSeed = _v0.b;
5658		return _Utils_Tuple2(levelWithObjects, finalSeed);
5659	});
5660var $author$project$Main$createPlatforms = F2(
5661	function (levelWidth, heightmap) {
5662		var rightPlatformHeight = function (h) {
5663			return h - 2;
5664		}(
5665			A2(
5666				$elm$core$Maybe$withDefault,
5667				200,
5668				A2($elm$core$Array$get, (levelWidth - 88) - 1, heightmap)));
5669		var leftPlatformHeight = function (h) {
5670			return h - 2;
5671		}(
5672			A2(
5673				$elm$core$Maybe$withDefault,
5674				200,
5675				A2($elm$core$Array$get, 88, heightmap)));
5676		var withLeftPlatform = A3(
5677			$elm$core$List$foldl,
5678			F2(
5679				function (x, acc) {
5680					return A3($elm$core$Array$set, x, leftPlatformHeight, acc);
5681				}),
5682			heightmap,
5683			A2($elm$core$List$range, 0, 87));
5684		var withBothPlatforms = A3(
5685			$elm$core$List$foldl,
5686			F2(
5687				function (x, acc) {
5688					return A3($elm$core$Array$set, x, rightPlatformHeight, acc);
5689				}),
5690			withLeftPlatform,
5691			A2($elm$core$List$range, levelWidth - 88, levelWidth - 1));
5692		return withBothPlatforms;
5693	});
5694var $elm$core$Array$repeat = F2(
5695	function (n, e) {
5696		return A2(
5697			$elm$core$Array$initialize,
5698			n,
5699			function (_v0) {
5700				return e;
5701			});
5702	});
5703var $author$project$Main$subdivideAtPosition = F3(
5704	function (step, p, _v0) {
5705		var heightmap = _v0.a;
5706		var seed = _v0.b;
5707		var midPoint = p + ((step / 2) | 0);
5708		var d1 = A2(
5709			$elm$core$Maybe$withDefault,
5710			200,
5711			A2($elm$core$Array$get, (p + step) & 1023, heightmap));
5712		var d0 = A2(
5713			$elm$core$Maybe$withDefault,
5714			200,
5715			A2($elm$core$Array$get, p, heightmap));
5716		var _v1 = A2(
5717			$elm$random$Random$step,
5718			A2($elm$random$Random$int, 0, step - 1),
5719			seed);
5720		var randomValue = _v1.a;
5721		var newSeed = _v1.b;
5722		var variation = ((randomValue - ((step / 2) | 0)) / 4) | 0;
5723		var newHeight = (((d0 + d1) / 2) | 0) + variation;
5724		var newHeightmap = A3($elm$core$Array$set, midPoint, newHeight, heightmap);
5725		return _Utils_Tuple2(newHeightmap, newSeed);
5726	});
5727var $author$project$Main$subdivideAtStep = F3(
5728	function (heightmap, step, seed) {
5729		var positions = A2(
5730			$elm$core$List$map,
5731			$elm$core$Basics$mul(step),
5732			A2($elm$core$List$range, 0, ((1024 / step) | 0) - 1));
5733		return A3(
5734			$elm$core$List$foldl,
5735			$author$project$Main$subdivideAtPosition(step),
5736			_Utils_Tuple2(heightmap, seed),
5737			positions);
5738	});
5739var $author$project$Main$subdivideHeightmap = F3(
5740	function (heightmap, step, seed) {
5741		subdivideHeightmap:
5742		while (true) {
5743			if (step > 1) {
5744				var _v0 = A3($author$project$Main$subdivideAtStep, heightmap, step, seed);
5745				var newHeightmap = _v0.a;
5746				var newSeed = _v0.b;
5747				var $temp$heightmap = newHeightmap,
5748					$temp$step = (step / 2) | 0,
5749					$temp$seed = newSeed;
5750				heightmap = $temp$heightmap;
5751				step = $temp$step;
5752				seed = $temp$seed;
5753				continue subdivideHeightmap;
5754			} else {
5755				return _Utils_Tuple2(heightmap, seed);
5756			}
5757		}
5758	});
5759var $author$project$Main$generateHeightmap = function (seed) {
5760	var initialHeightmap = A2($elm$core$Array$repeat, 1024, 200);
5761	var heightmapWithEndpoints = A3(
5762		$elm$core$Array$set,
5763		512,
5764		200,
5765		A3($elm$core$Array$set, 0, 200, initialHeightmap));
5766	var _v0 = A3($author$project$Main$subdivideHeightmap, heightmapWithEndpoints, 512, seed);
5767	var finalHeightmap = _v0.a;
5768	var finalSeed = _v0.b;
5769	return _Utils_Tuple2(finalHeightmap, finalSeed);
5770};
5771var $elm$core$Basics$abs = function (n) {
5772	return (n < 0) ? (-n) : n;
5773};
5774var $elm$random$Random$float = F2(
5775	function (a, b) {
5776		return function (seed0) {
5777			var seed1 = $elm$random$Random$next(seed0);
5778			var range = $elm$core$Basics$abs(b - a);
5779			var n1 = $elm$random$Random$peel(seed1);
5780			var n0 = $elm$random$Random$peel(seed0);
5781			var lo = (134217727 & n1) * 1.0;
5782			var hi = (67108863 & n0) * 1.0;
5783			var val = ((hi * 134217728.0) + lo) / 9007199254740992.0;
5784			var scaled = (val * range) + a;
5785			return _Utils_Tuple2(
5786				scaled,
5787				$elm$random$Random$next(seed1));
5788		};
5789	});
5790var $elm$core$Basics$modBy = _Basics_modBy;
5791var $author$project$Main$generateSinglePixel = F7(
5792	function (levelWidth, levelHeight, heightmap, seed, y, x, levelArray) {
5793		var i = x | (y << 10);
5794		var heightAtX = A2(
5795			$elm$core$Maybe$withDefault,
5796			200,
5797			A2(
5798				$elm$core$Array$get,
5799				A2($elm$core$Basics$modBy, 1024, x),
5800				heightmap));
5801		var _v0 = A2(
5802			$elm$random$Random$step,
5803			A2($elm$random$Random$float, 0, 1),
5804			seed);
5805		var randomValue = _v0.a;
5806		var br = 1.2 - ((((randomValue - 0.5) * randomValue) * randomValue) * 0.6);
5807		var br2 = br * (1 - (i / (1024 * 6048.0)));
5808		var pixelColor = function () {
5809			if ((x < 8) || ((_Utils_cmp(x, levelWidth - 8) > -1) || (_Utils_cmp(y, levelHeight - 8) > -1))) {
5810				var c = $elm$core$Basics$round(180.0 * br2);
5811				return (c << 16) | ((c << 8) | c);
5812			} else {
5813				if (_Utils_cmp(y, heightAtX) < 0) {
5814					return 0;
5815				} else {
5816					var r = $elm$core$Basics$round(111.0 * br2);
5817					var g = $elm$core$Basics$round(92.0 * br2);
5818					var b = $elm$core$Basics$round(51.0 * br2);
5819					var _v1 = function () {
5820						if (_Utils_cmp(y, heightAtX + 4) < 0) {
5821							var grassR = $elm$core$Basics$round(44.0 * br2);
5822							var grassG = $elm$core$Basics$round(148.0 * br2);
5823							var grassB = $elm$core$Basics$round(49.0 * br2);
5824							return ((x < 88) || (_Utils_cmp(x, levelWidth - 89) >
5824 0)) ? _Utils_Tuple3(grassG, grassG, grassG) : _Utils_Tuple3(grassR, grassG, grassB);
5825						} else {
5826							return _Utils_Tuple3(r, g, b);
5827						}
5828					}();
5829					var finalR = _v1.a;
5830					var finalG = _v1.b;
5831					var finalB = _v1.c;
5832					return (finalR << 16) | ((finalG << 8) | finalB);
5833				}
5834			}
5835		}();
5836		return A3($elm$core$Array$set, i, pixelColor, levelArray);
5837	});
5838var $author$project$Main$generateRowPixels = F6(
5839	function (levelWidth, levelHeight, heightmap, seed, y, levelArray) {
5840		return A3(
5841			$elm$core$List$foldl,
5842			A5($author$project$Main$generateSinglePixel, levelWidth, levelHeight, heightmap, seed, y),
5843			levelArray,
5844			A2($elm$core$List$range, 0, levelWidth - 1));
5845	});
5846var $author$project$Main$generateLevelPixels = F5(
5847	function (levelWidth, levelHeight, heightmap, currentLevel, seed) {
5848		var levelArray = A2($elm$core$Array$repeat, 1024 * 2048, 0);
5849		var terrainArray = A3(
5850			$elm$core$List$foldl,
5851			A4($author$project$Main$generateRowPixels, levelWidth, levelHeight, heightmap, seed),
5852			levelArray,
5853			A2($elm$core$List$range, 1, levelHeight - 1));
5854		return terrainArray;
5855	});
5856var $author$project$Main$createLevel = F2(
5857	function (currentLevel, seed) {
5858		var levelConfig = $author$project$Main$getLevelConfig(currentLevel);
5859		var levelHeight = levelConfig.X;
5860		var levelWidth = levelConfig.ad;
5861		var _v0 = $author$project$Main$generateHeightmap(seed);
5862		var heightmap = _v0.a;
5863		var seed1 = _v0.b;
5864		var heightmapWithPlatforms = A2($author$project$Main$createPlatforms, levelWidth, heightmap);
5865		var baseLevelArray = A5($author$project$Main$generateLevelPixels, levelWidth, levelHeight, heightmapWithPlatforms, currentLevel, seed1);
5866		var _v1 = A5($author$project$Main$addGoldObjects, baseLevelArray, levelWidth, levelHeight, currentLevel, seed1);
5867		var levelWithGold = _v1.a;
5868		var seed2 = _v1.b;
5869		return {d: levelWithGold, v: levelHeight, p: levelWidth, B: seed2};
5870	});
5871var $elm$random$Random$initialSeed = function (x) {
5872	var _v0 = $elm$random$Random$next(
5873		A2($elm$random$Random$Seed, 0, 1013904223));
5874	var state1 = _v0.a;
5875	var incr = _v0.b;
5876	var state2 = (state1 + x) >>> 0;
5877	return $elm$random$Random$next(
5878		A2($elm$random$Random$Seed, state2, incr));
5879};
5880var $elm$time$Time$Name = function (a) {
5881	return {$: 0, a: a};
5882};
5883var $elm$time$Time$Offset = function (a) {
5884	return {$: 1, a: a};
5885};
5886var $elm$time$Time$Zone = F2(
5887	function (a, b) {
5888		return {$: 0, a: a, b: b};
5889	});
5890var $elm$time$Time$customZone = $elm$time$Time$Zone;
5891var $elm$time$Time$Posix = $elm$core$Basics$identity;
5892var $elm$time$Time$millisToPosix = $elm$core$Basics$identity;
5893var $elm$time$Time$now = _Time_now($elm$time$Time$millisToPosix);
5894var $elm$core$Maybe$andThen = F2(
5895	function (callback, maybeValue) {
5896		if (!maybeValue.$) {
5897			var value = maybeValue.a;
5898			return callback(value);
5899		} else {
5900			return $elm$core$Maybe$Nothing;
5901		}
5902	});
5903var $elm$core$Basics$composeR = F3(
5904	function (f, g, x) {
5905		return g(
5906			f(x));
5907	});
5908var $elm$core$List$maybeCons = F3(
5909	function (f, mx, xs) {
5910		var _v0 = f(mx);
5911		if (!_v0.$) {
5912			var x = _v0.a;
5913			return A2($elm$core$List$cons, x, xs);
5914		} else {
5915			return xs;
5916		}
5917	});
5918var $elm$core$List$filterMap = F2(
5919	function (f, xs) {
5920		return A3(
5921			$elm$core$List$foldr,
5922			$elm$core$List$maybeCons(f),
5923			_List_Nil,
5924			xs);
5925	});
5926var $elm$core$List$head = function (list) {
5927	if (list.b) {
5928		var x = list.a;
5929		var xs = list.b;
5930		return $elm$core$Maybe$Just(x);
5931	} else {
5932		return $elm$core$Maybe$Nothing;
5933	}
5934};
5935var $author$project$Main$parseGoldParam = function (param) {
5936	var _v0 = A2($elm$core$String$split, '=', param);
5937	if (((_v0.b && (_v0.a === 'gold')) && _v0.b.b) && (!_v0.b.b.b)) {
5938		var _v1 = _v0.b;
5939		var value = _v1.a;
5940		return $elm$core$String$toInt(value);
5941	} else {
5942		return $elm$core$Maybe$Nothing;
5943	}
5944};
5945var $author$project$Main$parseGoldFromUrl = function (url) {
5946	return A2(
5947		$elm$core$Maybe$andThen,
5948		A2(
5949			$elm$core$Basics$composeR,
5950			$elm$core$String$split('&'),
5951			A2(
5952				$elm$core$Basics$composeR,
5953				$elm$core$List$filterMap($author$project$Main$parseGoldParam),
5954				$elm$core$List$head)),
5955		url.bo);
5956};
5957var $author$project$Main$parseLevelParam = function (param) {
5958	var _v0 = A2($elm$core$String$split, '=', param);
5959	if (((_v0.b && (_v0.a === 'level')) && _v0.b.b) && (!_v0.b.b.b)) {
5960		var _v1 = _v0.b;
5961		var value = _v1.a;
5962		return $elm$core$String$toInt(value);
5963	} else {
5964		return $elm$core$Maybe$Nothing;
5965	}
5966};
5967var $author$project$Main$parseLevelFromUrl = function (url) {
5968	return A2(
5969		$elm$core$Maybe$andThen,
5970		A2(
5971			$elm$core$Basics$composeR,
5972			$elm$core$String$split('&'),
5973			A2(
5974				$elm$core$Basics$composeR,
5975				$elm$core$List$filterMap($author$project$Main$parseLevelParam),
5976				$elm$core$List$head)),
5977		url.bo);
5978};
5979var $elm$time$Time$posixToMillis = function (_v0) {
5980	var millis = _v0;
5981	return millis;
5982};
5983var $elm$json$Json$Encode$null = _Json_encodeNull;
5984var $author$project$Main$preventContextMenu = _Platform_outgoingPort(
5985	'preventContextMenu',
5986	function ($) {
5987		return $elm$json$Json$Encode$null;
5988	});
5989var $author$project$Main$init = F3(
5990	function (_v0, url, key) {
5991		var urlLevel = A2(
5992			$elm$core$Maybe$withDefault,
5993			0,
5994			$author$project$Main$parseLevelFromUrl(url));
5995		var urlGold = A2(
5996			$elm$core$Maybe$withDefault,
5997			0,
5998			$author$project$Main$parseGoldFromUrl(url));
5999		var placeholderSeed = $elm$random$Random$initialSeed(12345);
6000		var generateFreshSeed = A2(
6001			$elm$core$Task$perform,
6002			function (posix) {
6003				return $author$project$Main$SeedGenerated(
6004					$elm$time$Time$posixToMillis(posix));
6005			},
6006			$elm$time$Time$now);
6007		var currentLevel = A2(
6008			$elm$core$Basics$max,
6009			0,
6010			A2($elm$core$Basics$min, 6, urlLevel));
6011		var levelConfig = $author$project$Main$getLevelConfig(currentLevel);
6012		var levelResult = A2($author$project$Main$createLevel, currentLevel, placeholderSeed);
6013		var model = {
6014			T: {aB: false, aD: false, aH: false, aM: false},
6015			i: 0,
6016			j: 0,
6017			ap: 0,
6018			af: 1,
6019			aq: 50,
6020			ar: false,
6021			as: 200,
6022			q: currentLevel,
6023			U: 0,
6024			at: $elm$core$Maybe$Nothing,
6025			ah: 1.5,
6026			z: 0,
6027			o: 0,
6028			aU: key,
6029			d: levelResult.d,
6030			v: levelResult.v,
6031			bd: false,
6032			aw: levelConfig.O,
6033			p: levelResult.p,
6034			s: A3($author$project$Main$createInitialMiners, levelResult.p, levelConfig.C, placeholderSeed),
6035			_: -1,
6036			M: 0,
6037			N: 0,
6038			I: false,
6039			A: false,
6040			J: $elm$core$Maybe$Nothing,
6041			E: 0,
6042			t: $elm$core$Maybe$Nothing,
6043			aF: 0,
6044			aG: 0,
6045			aj: levelResult.B,
6046			e: urlGold,
6047			al: false,
6048			Q: levelConfig.C,
6049			aO: url
6050		};
6051		return _Utils_Tuple2(
6052			model,
6053			$elm$core$Platform$Cmd$batch(
6054				_List_fromArray(
6055					[
6056						generateFreshSeed,
6057						$author$project$Main$preventContextMenu(0)
6058					])));
6059	});
6060var $author$project$Main$GameTick = function (a) {
6061	return {$: 12, a: a};
6062};
6063var $author$project$Main$KeyDown = function (a) {
6064	return {$: 8, a: a};
6065};
6066var $author$project$Main$KeyUp = function (a) {
6067	return {$: 9, a: a};
6068};
6069var $author$project$Main$PortalTick = {$: 16};
6070var $author$project$Main$UpdateMiners = {$: 3};
6071var $elm$core$Basics$always = F2(
6072	function (a, _v0) {
6073		return a;
6074	});
6075var $elm$core$Platform$Sub$batch = _Platform_batch;
6076var $elm$core$Basics$composeL = F3(
6077	function (g, f, x) {
6078		return g(
6079			f(x));
6080	});
6081var $elm$time$Time$Every = F2(
6082	function (a, b) {
6083		return {$: 0, a: a, b: b};
6084	});
6085var $elm$time$Time$State = F2(
6086	function (taggers, processes) {
6087		return {bm: processes, bx: taggers};
6088	});
6089var $elm$core$Dict$RBEmpty_elm_builtin = {$: -2};
6090var $elm$core$Dict$empty = $elm$core$Dict$RBEmpty_elm_builtin;
6091var $elm$time$Time$init = $elm$core$Task$succeed(
6092	A2($elm$time$Time$State, $elm$core$Dict$empty, $elm$core$Dict$empty));
6093var $elm$core$Basics$compare = _Utils_compare;
6094var $elm$core$Dict$get = F2(
6095	function (targetKey, dict) {
6096		get:
6097		while (true) {
6098			if (dict.$ === -2) {
6099				return $elm$core$Maybe$Nothing;
6100			} else {
6101				var key = dict.b;
6102				var value = dict.c;
6103				var left = dict.d;
6104				var right = dict.e;
6105				var _v1 = A2($elm$core$Basics$compare, targetKey, key);
6106				switch (_v1) {
6107					case 0:
6108						var $temp$targetKey = targetKey,
6109							$temp$dict = left;
6110						targetKey = $temp$targetKey;
6111						dict = $temp$dict;
6112						continue get;
6113					case 1:
6114						return $elm$core$Maybe$Just(value);
6115					default:
6116						var $temp$targetKey = targetKey,
6117							$temp$dict = right;
6118						targetKey = $temp$targetKey;
6119						dict = $temp$dict;
6120						continue get;
6121				}
6122			}
6123		}
6124	});
6125var $elm$core$Dict$Black = 1;
6126var $elm$core$Dict$RBNode_elm_builtin = F5(
6127	function (a, b, c, d, e) {
6128		return {$: -1, a: a, b: b, c: c, d: d, e: e};
6129	});
6130var $elm$core$Dict$Red = 0;
6131var $elm$core$Dict$balance = F5(
6132	function (color, key, value, left, right) {
6133		if ((right.$ === -1) && (!right.a)) {
6134			var _v1 = right.a;
6135			var rK = right.b;
6136			var rV = right.c;
6137			var rLeft = right.d;
6138			var rRight = right.e;
6139			if ((left.$ === -1) && (!left.a)) {
6140				var _v3 = left.a;
6141				var lK = left.b;
6142				var lV = left.c;
6143				var lLeft = left.d;
6144				var lRight = left.e;
6145				return A5(
6146					$elm$core$Dict$RBNode_elm_builtin,
6147					0,
6148					key,
6149					value,
6150					A5($elm$core$Dict$RBNode_elm_builtin, 1, lK, lV, lLeft, lRight),
6151					A5($elm$core$Dict$RBNode_elm_builtin, 1, rK, rV, rLeft, rRight));
6152			} else {
6153				return A5(
6154					$elm$core$Dict$RBNode_elm_builtin,
6155					color,
6156					rK,
6157					rV,
6158					A5($elm$core$Dict$RBNode_elm_builtin, 0, key, value, left, rLeft),
6159					rRight);
6160			}
6161		} else {
6162			if ((((left.$ === -1) && (!left.a)) && (left.d.$ === -1)) && (!left.d.a)) {
6163				var _v5 = left.a;
6164				var lK = left.b;
6165				var lV = left.c;
6166				var _v6 = left.d;
6167				var _v7 = _v6.a;
6168				var llK = _v6.b;
6169				var llV = _v6.c;
6170				var llLeft = _v6.d;
6171				var llRight = _v6.e;
6172				var lRight = left.e;
6173				return A5(
6174					$elm$core$Dict$RBNode_elm_builtin,
6175					0,
6176					lK,
6177					lV,
6178					A5($elm$core$Dict$RBNode_elm_builtin, 1, llK, llV, llLeft, llRight),
6179					A5($elm$core$Dict$RBNode_elm_builtin, 1, key, value, lRight, right));
6180			} else {
6181				return A5($elm$core$Dict$RBNode_elm_builtin, color, key, value, left, right);
6182			}
6183		}
6184	});
6185var $elm$core$Dict$insertHelp = F3(
6186	function (key, value, dict) {
6187		if (dict.$ === -2) {
6188			return A5($elm$core$Dict$RBNode_elm_builtin, 0, key, value, $elm$core$Dict$RBEmpty_elm_builtin, $elm$core$Dict$RBEmpty_elm_builtin);
6189		} else {
6190			var nColor = dict.a;
6191			var nKey = dict.b;
6192			var nValue = dict.c;
6193			var nLeft = dict.d;
6194			var nRight = dict.e;
6195			var _v1 = A2($elm$core$Basics$compare, key, nKey);
6196			switch (_v1) {
6197				case 0:
6198					return A5(
6199						$elm$core$Dict$balance,
6200						nColor,
6201						nKey,
6202						nValue,
6203						A3($elm$core$Dict$insertHelp, key, value, nLeft),
6204						nRight);
6205				case 1:
6206					return A5($elm$core$Dict$RBNode_elm_builtin, nColor, nKey, value, nLeft, nRight);
6207				default:
6208					return A5(
6209						$elm$core$Dict$balance,
6210						nColor,
6211						nKey,
6212						nValue,
6213						nLeft,
6214						A3($elm$core$Dict$insertHelp, key, value, nRight));
6215			}
6216		}
6217	});
6218var $elm$core$Dict$insert = F3(
6219	function (key, value, dict) {
6220		var _v0 = A3($elm$core$Dict$insertHelp, key, value, dict);
6221		if ((_v0.$ === -1) && (!_v0.a)) {
6222			var _v1 = _v0.a;
6223			var k = _v0.b;
6224			var v = _v0.c;
6225			var l = _v0.d;
6226			var r = _v0.e;
6227			return A5($elm$core$Dict$RBNode_elm_builtin, 1, k, v, l, r);
6228		} else {
6229			var x = _v0;
6230			return x;
6231		}
6232	});
6233var $elm$time$Time$addMySub = F2(
6234	function (_v0, state) {
6235		var interval = _v0.a;
6236		var tagger = _v0.b;
6237		var _v1 = A2($elm$core$Dict$get, interval, state);
6238		if (_v1.$ === 1) {
6239			return A3(
6240				$elm$core$Dict$insert,
6241				interval,
6242				_List_fromArray(
6243					[tagger]),
6244				state);
6245		} else {
6246			var taggers = _v1.a;
6247			return A3(
6248				$elm$core$Dict$insert,
6249				interval,
6250				A2($elm$core$List$cons, tagger, taggers),
6251				state);
6252		}
6253	});
6254var $elm$core$Process$kill = _Scheduler_kill;
6255var $elm$core$Dict$foldl = F3(
6256	function (func, acc, dict) {
6257		foldl:
6258		while (true) {
6259			if (dict.$ === -2) {
6260				return acc;
6261			} else {
6262				var key = dict.b;
6263				var value = dict.c;
6264				var left = dict.d;
6265				var right = dict.e;
6266				var $temp$func = func,
6267					$temp$acc = A3(
6268					func,
6269					key,
6270					value,
6271					A3($elm$core$Dict$foldl, func, acc, left)),
6272					$temp$dict = right;
6273				func = $temp$func;
6274				acc = $temp$acc;
6275				dict = $temp$dict;
6276				continue foldl;
6277			}
6278		}
6279	});
6280var $elm$core$Dict$merge = F6(
6281	function (leftStep, bothStep, rightStep, leftDict, rightDict, initialResult) {
6282		var stepState = F3(
6283			function (rKey, rValue, _v0) {
6284				stepState:
6285				while (true) {
6286					var list = _v0.a;
6287					var result = _v0.b;
6288					if (!list.b) {
6289						return _Utils_Tuple2(
6290							list,
6291							A3(rightStep, rKey, rValue, result));
6292					} else {
6293						var _v2 = list.a;
6294						var lKey = _v2.a;
6295						var lValue = _v2.b;
6296						var rest = list.b;
6297						if (_Utils_cmp(lKey, rKey) < 0) {
6298							var $temp$rKey = rKey,
6299								$temp$rValue = rValue,
6300								$temp$_v0 = _Utils_Tuple2(
6301								rest,
6302								A3(leftStep, lKey, lValue, result));
6303							rKey = $temp$rKey;
6304							rValue = $temp$rValue;
6305							_v0 = $temp$_v0;
6306							continue stepState;
6307						} else {
6308							if (_Utils_cmp(lKey, rKey) > 0) {
6309								return _Utils_Tuple2(
6310									list,
6311									A3(rightStep, rKey, rValue, result));
6312							} else {
6313								return _Utils_Tuple2(
6314									rest,
6315									A4(bothStep, lKey, lValue, rValue, result));
6316							}
6317						}
6318					}
6319				}
6320			});
6321		var _v3 = A3(
6322			$elm$core$Dict$foldl,
6323			stepState,
6324			_Utils_Tuple2(
6325				$elm$core$Dict$toList(leftDict),
6326				initialResult),
6327			rightDict);
6328		var leftovers = _v3.a;
6329		var intermediateResult = _v3.b;
6330		return A3(
6331			$elm$core$List$foldl,
6332			F2(
6333				function (_v4, result) {
6334					var k = _v4.a;
6335					var v = _v4.b;
6336					return A3(leftStep, k, v, result);
6337				}),
6338			intermediateResult,
6339			leftovers);
6340	});
6341var $elm$core$Platform$sendToSelf = _Platform_sendToSelf;
6342var $elm$time$Time$setInterval = _Time_setInterval;
6343var $elm$core$Process$spawn = _Scheduler_spawn;
6344var $elm$time$Time$spawnHelp = F3(
6345	function (router, intervals, processes) {
6346		if (!intervals.b) {
6347			return $elm$core$Task$succeed(processes);
6348		} else {
6349			var interval = intervals.a;
6350			var rest = intervals.b;
6351			var spawnTimer = $elm$core$Process$spawn(
6352				A2(
6353					$elm$time$Time$setInterval,
6354					interval,
6355					A2($elm$core$Platform$sendToSelf, router, interval)));
6356			var spawnRest = function (id) {
6357				return A3(
6358					$elm$time$Time$spawnHelp,
6359					router,
6360					rest,
6361					A3($elm$core$Dict$insert, interval, id, processes));
6362			};
6363			return A2($elm$core$Task$andThen, spawnRest, spawnTimer);
6364		}
6365	});
6366var $elm$time$Time$onEffects = F3(
6367	function (router, subs, _v0) {
6368		var processes = _v0.bm;
6369		var rightStep = F3(
6370			function (_v6, id, _v7) {
6371				var spawns = _v7.a;
6372				var existing = _v7.b;
6373				var kills = _v7.c;
6374				return _Utils_Tuple3(
6375					spawns,
6376					existing,
6377					A2(
6378						$elm$core$Task$andThen,
6379						function (_v5) {
6380							return kills;
6381						},
6382						$elm$core$Process$kill(id)));
6383			});
6384		var newTaggers = A3($elm$core$List$foldl, $elm$time$Time$addMySub, $elm$core$Dict$empty, subs);
6385		var leftStep = F3(
6386			function (interval, taggers, _v4) {
6387				var spawns = _v4.a;
6388				var existing = _v4.b;
6389				var kills = _v4.c;
6390				return _Utils_Tuple3(
6391					A2($elm$core$List$cons, interval, spawns),
6392					existing,
6393					kills);
6394			});
6395		var bothStep = F4(
6396			function (interval, taggers, id, _v3) {
6397				var spawns = _v3.a;
6398				var existing = _v3.b;
6399				var kills = _v3.c;
6400				return _Utils_Tuple3(
6401					spawns,
6402					A3($elm$core$Dict$insert, interval, id, existing),
6403					kills);
6404			});
6405		var _v1 = A6(
6406			$elm$core$Dict$merge,
6407			leftStep,
6408			bothStep,
6409			rightStep,
6410			newTaggers,
6411			processes,
6412			_Utils_Tuple3(
6413				_List_Nil,
6414				$elm$core$Dict$empty,
6415				$elm$core$Task$succeed(0)));
6416		var spawnList = _v1.a;
6417		var existingDict = _v1.b;
6418		var killTask = _v1.c;
6419		return A2(
6420			$elm$core$Task$andThen,
6421			function (newProcesses) {
6422				return $elm$core$Task$succeed(
6423					A2($elm$time$Time$State, newTaggers, newProcesses));
6424			},
6425			A2(
6426				$elm$core$Task$andThen,
6427				function (_v2) {
6428					return A3($elm$time$Time$spawnHelp, router, spawnList, existingDict);
6429				},
6430				killTask));
6431	});
6432var $elm$time$Time$onSelfMsg = F3(
6433	function (router, interval, state) {
6434		var _v0 = A2($elm$core$Dict$get, interval, state.bx);
6435		if (_v0.$ === 1) {
6436			return $elm$core$Task$succeed(state);
6437		} else {
6438			var taggers = _v0.a;
6439			var tellTaggers = function (time) {
6440				return $elm$core$Task$sequence(
6441					A2(
6442						$elm$core$List$map,
6443						function (tagger) {
6444							return A2(
6445								$elm$core$Platform$sendToApp,
6446								router,
6447								tagger(time));
6448						},
6449						taggers));
6450			};
6451			return A2(
6452				$elm$core$Task$andThen,
6453				function (_v1) {
6454					return $elm$core$Task$succeed(state);
6455				},
6456				A2($elm$core$Task$andThen, tellTaggers, $elm$time$Time$now));
6457		}
6458	});
6459var $elm$time$Time$subMap = F2(
6460	function (f, _v0) {
6461		var interval = _v0.a;
6462		var tagger = _v0.b;
6463		return A2(
6464			$elm$time$Time$Every,
6465			interval,
6466			A2($elm$core$Basics$composeL, f, tagger));
6467	});
6468_Platform_effectManagers['Time'] = _Platform_createManager($elm$time$Time$init, $elm$time$Time$onEffects, $elm$time$Time$onSelfMsg, 0, $elm$time$Time$subMap);
6469var $elm$time$Time$subscription = _Platform_leaf('Time');
6470var $elm$time$Time$every = F2(
6471	function (interval, tagger) {
6472		return $elm$time$Time$subscription(
6473			A2($elm$time$Time$Every, interval, tagger));
6474	});
6475var $elm$json$Json$Decode$field = _Json_decodeField;
6476var $elm$json$Json$Decode$int = _Json_decodeInt;
6477var $elm$core$Platform$Sub$none = $elm$core$Platform$Sub$batch(_List_Nil);
6478var $elm$browser$Browser$Events$Document = 0;
6479var $elm$browser$Browser$Events$MySub = F3(
6480	function (a, b, c) {
6481		return {$: 0, a: a, b: b, c: c};
6482	});
6483var $elm$browser$Browser$Events$State = F2(
6484	function (subs, pids) {
6485		return {bi: pids, bw: subs};
6486	});
6487var $elm$browser$Browser$Events$init = $elm$core$Task$succeed(
6488	A2($elm$browser$Browser$Events$State, _List_Nil, $elm$core$Dict$empty));
6489var $elm$browser$Browser$Events$nodeToKey = function (node) {
6490	if (!node) {
6491		return 'd_';
6492	} else {
6493		return 'w_';
6494	}
6495};
6496var $elm$browser$Browser$Events$addKey = function (sub) {
6497	var node = sub.a;
6498	var name = sub.b;
6499	return _Utils_Tuple2(
6500		_Utils_ap(
6501			$elm$browser$Browser$Events$nodeToKey(node),
6502			name),
6503		sub);
6504};
6505var $elm$core$Dict$fromList = function (assocs) {
6506	return A3(
6507		$elm$core$List$foldl,
6508		F2(
6509			function (_v0, dict) {
6510				var key = _v0.a;
6511				var value = _v0.b;
6512				return A3($elm$core$Dict$insert, key, value, dict);
6513			}),
6514		$elm$core$Dict$empty,
6515		assocs);
6516};
6517var $elm$browser$Browser$Events$Event = F2(
6518	function (key, event) {
6519		return {a8: event, aU: key};
6520	});
6521var $elm$browser$Browser$Events$spawn = F3(
6522	function (router, key, _v0) {
6523		var node = _v0.a;
6524		var name = _v0.b;
6525		var actualNode = function () {
6526			if (!node) {
6527				return _Browser_doc;
6528			} else {
6529				return _Browser_window;
6530			}
6531		}();
6532		return A2(
6533			$elm$core$Task$map,
6534			function (value) {
6535				return _Utils_Tuple2(key, value);
6536			},
6537			A3(
6538				_Browser_on,
6539				actualNode,
6540				name,
6541				function (event) {
6542					return A2(
6543						$elm$core$Platform$sendToSelf,
6544						router,
6545						A2($elm$browser$Browser$Events$Event, key, event));
6546				}));
6547	});
6548var $elm$core$Dict$union = F2(
6549	function (t1, t2) {
6550		return A3($elm$core$Dict$foldl, $elm$core$Dict$insert, t2, t1);
6551	});
6552var $elm$browser$Browser$Events$onEffects = F3(
6553	function (router, subs, state) {
6554		var stepRight = F3(
6555			function (key, sub, _v6) {
6556				var deads = _v6.a;
6557				var lives = _v6.b;
6558				var news = _v6.c;
6559				return _Utils_Tuple3(
6560					deads,
6561					lives,
6562					A2(
6563						$elm$core$List$cons,
6564						A3($elm$browser$Browser$Events$spawn, router, key, sub),
6565						news));
6566			});
6567		var stepLeft = F3(
6568			function (_v4, pid, _v5) {
6569				var deads = _v5.a;
6570				var lives = _v5.b;
6571				var news = _v5.c;
6572				return _Utils_Tuple3(
6573					A2($elm$core$List$cons, pid, deads),
6574					lives,
6575					news);
6576			});
6577		var stepBoth = F4(
6578			function (key, pid, _v2, _v3) {
6579				var deads = _v3.a;
6580				var lives = _v3.b;
6581				var news = _v3.c;
6582				return _Utils_Tuple3(
6583					deads,
6584					A3($elm$core$Dict$insert, key, pid, lives),
6585					news);
6586			});
6587		var newSubs = A2($elm$core$List$map, $elm$browser$Browser$Events$addKey, subs);
6588		var _v0 = A6(
6589			$elm$core$Dict$merge,
6590			stepLeft,
6591			stepBoth,
6592			stepRight,
6593			state.bi,
6594			$elm$core$Dict$fromList(newSubs),
6595			_Utils_Tuple3(_List_Nil, $elm$core$Dict$empty, _List_Nil));
6596		var deadPids = _v0.a;
6597		var livePids = _v0.b;
6598		var makeNewPids = _v0.c;
6599		return A2(
6600			$elm$core$Task$andThen,
6601			function (pids) {
6602				return $elm$core$Task$succeed(
6603					A2(
6604						$elm$browser$Browser$Events$State,
6605						newSubs,
6606						A2(
6607							$elm$core$Dict$union,
6608							livePids,
6609							$elm$core$Dict$fromList(pids))));
6610			},
6611			A2(
6612				$elm$core$Task$andThen,
6613				function (_v1) {
6614					return $elm$core$Task$sequence(makeNewPids);
6615				},
6616				$elm$core$Task$sequence(
6617					A2($elm$core$List$map, $elm$core$Process$kill, deadPids))));
6618	});
6619var $elm$browser$Browser$Events$onSelfMsg = F3(
6620	function (router, _v0, state) {
6621		var key = _v0.aU;
6622		var event = _v0.a8;
6623		var toMessage = function (_v2) {
6624			var subKey = _v2.a;
6625			var _v3 = _v2.b;
6626			var node = _v3.a;
6627			var name = _v3.b;
6628			var decoder = _v3.c;
6629			return _Utils_eq(subKey, key) ? A2(_Browser_decodeEvent, decoder, event) : $elm$core$Maybe$Nothing;
6630		};
6631		var messages = A2($elm$core$List$filterMap, toMessage, state.bw);
6632		return A2(
6633			$elm$core$Task$andThen,
6634			function (_v1) {
6635				return $elm$core$Task$succeed(state);
6636			},
6637			$elm$core$Task$sequence(
6638				A2(
6639					$elm$core$List$map,
6640					$elm$core$Platform$sendToApp(router),
6641					messages)));
6642	});
6643var $elm$browser$Browser$Events$subMap = F2(
6644	function (func, _v0) {
6645		var node = _v0.a;
6646		var name = _v0.b;
6647		var decoder = _v0.c;
6648		return A3(
6649			$elm$browser$Browser$Events$MySub,
6650			node,
6651			name,
6652			A2($elm$json$Json$Decode$map, func, decoder));
6653	});
6654_Platform_effectManagers['Browser.Events'] = _Platform_createManager($elm$browser$Browser$Events$init, $elm$browser$Browser$Events$onEffects, $elm$browser$Browser$Events$onSelfMsg, 0, $elm$browser$Browser$Events$subMap);
6655var $elm$browser$Browser$Events$subscription = _Platform_leaf('Browser.Events');
6656var $elm$browser$Browser$Events$on = F3(
6657	function (node, name, decoder) {
6658		return $elm$browser$Browser$Events$subscription(
6659			A3($elm$browser$Browser$Events$MySub, node, name, decoder));
6660	});
6661var $elm$browser$Browser$Events$onKeyDown = A2($elm$browser$Browser$Events$on, 0, 'keydown');
6662var $elm$browser$Browser$Events$onKeyUp = A2($elm$browser$Browser$Events$on, 0, 'keyup');
6663var $author$project$Main$subscriptions = function (model) {
6664	var portalTimerSub = (model.E > 0) ? A2(
6665		$elm$time$Time$every,
6666		1000,
6667		function (_v0) {
6668			return $author$project$Main$PortalTick;
6669		}) : $elm$core$Platform$Sub$none;
6670	var gameTimerInterval = A2(
6671		$elm$core$Basics$max,
6672		16,
6673		$elm$core$Basics$round(25.0 / model.ah));
6674	return $elm$core$Platform$Sub$batch(
6675		_List_fromArray(
6676			[
6677				A2(
6678				$elm$time$Time$every,
6679				gameTimerInterval,
6680				$elm$core$Basics$always($author$project$Main$UpdateMiners)),
6681				A2(
6682				$elm$time$Time$every,
6683				1000,
6684				A2($elm$core$Basics$composeL, $author$project$Main$GameTick, $elm$time$Time$posixToMillis)),
6685				$elm$browser$Browser$Events$onKeyDown(
6686				A2(
6687					$elm$json$Json$Decode$map,
6688					$author$project$Main$KeyDown,
6689					A2($elm$json$Json$Decode$field, 'keyCode', $elm$json$Json$Decode$int))),
6690				$elm$browser$Browser$Events$onKeyUp(
6691				A2(
6692					$elm$json$Json$Decode$map,
6693					$author$project$Main$KeyUp,
6694					A2($elm$json$Json$Decode$field, 'keyCode', $elm$json$Json$Decode$int))),
6695				portalTimerSub
6696			]));
6697};
6698var $author$project$Main$Dead = {$: 3};
6699var $author$project$Main$GameComplete = 4;
6700var $author$project$Main$LevelComplete = 2;
6701var $author$project$Main$LevelFailed = 3;
6702var $author$project$Main$NextLevel = {$: 10};
6703var $author$project$Main$Playing = 1;
6704var $author$project$Main$RestartLevel = {$: 11};
6705var $elm$core$List$any = F2(
6706	function (isOkay, list) {
6707		any:
6708		while (true) {
6709			if (!list.b) {
6710				return false;
6711			} else {
6712				var x = list.a;
6713				var xs = list.b;
6714				if (isOkay(x)) {
6715					return true;
6716				} else {
6717					var $temp$isOkay = isOkay,
6718						$temp$list = xs;
6719					isOkay = $temp$isOkay;
6720					list = $temp$list;
6721					continue any;
6722				}
6723			}
6724		}
6725	});
6726var $author$project$Main$isPixelSolid = F5(
6727	function (level, levelW, levelH, y, x) {
6728		if ((x >= 0) && ((_Utils_cmp(x, levelW) < 0) && ((y >= 0) && (_Utils_cmp(y, levelH) < 0)))) {
6729			var pixel = A3($author$project$Main$getPixelAt, x, y, level);
6730			return !(!pixel);
6731		} else {
6732			return true;
6733		}
6734	});
6735var $author$project$Main$checkMinerCollision = F5(
6736	function (x, y, level, levelWidth, levelHeight) {
6737		var minerY = $elm$core$Basics$round(y);
6738		var minerX = $elm$core$Basics$round(x);
6739		var terrainBlocked = A2(
6740			$elm$core$List$any,
6741			function (dx) {
6742				return A2(
6743					$elm$core$List$any,
6744					function (dy) {
6745						var checkY = minerY + dy;
6746						var checkX = minerX + dx;
6747						return (checkX >= 0) && ((_Utils_cmp(checkX, levelWidth) < 0) && ((checkY >= 0) && ((_Utils_cmp(checkY, levelHeight) < 0) && A5($author$project$Main$isPixelSolid, level, levelWidth, levelHeight, checkY, checkX))));
6748					},
6749					A2($elm$core$List$range, 0, 9));
6750			},
6751			A2($elm$core$List$range, 0, 6));
6752		return terrainBlocked;
6753	});
6754var $elm$core$Basics$not = _Basics_not;
6755var $author$project$Main$findSafeExitPositionLeft = F5(
6756	function (portalX, portalY, level, levelWidth, levelHeight) {
6757		var candidatePositions = _List_fromArray(
6758			[
6759				_Utils_Tuple2(portalX - 12, portalY),
6760				_Utils_Tuple2(portalX - 15, portalY),
6761				_Utils_Tuple2(portalX - 18, portalY),
6762				_Utils_Tuple2(portalX - 12, portalY - 10),
6763				_Utils_Tuple2(portalX - 12, portalY + 12),
6764				_Utils_Tuple2(portalX - 20, portalY)
6765			]);
6766		var safePosition = A2(
6767			$elm$core$Maybe$withDefault,
6768			_Utils_Tuple2(portalX - 12, portalY),
6769			$elm$core$List$head(
6770				A2(
6771					$elm$core$List$filter,
6772					function (_v0) {
6773						var x = _v0.a;
6774						var y = _v0.b;
6775						return !A5($author$project$Main$checkMinerCollision, x, y, level, levelWidth, levelHeight);
6776					},
6777					candidatePositions)));
6778		return safePosition;
6779	});
6780var $author$project$Main$findSafeExitPositionRight = F5(
6781	function (portalX, portalY, level, levelWidth, levelHeight) {
6782		var candidatePositions = _List_fromArray(
6783			[
6784				_Utils_Tuple2(portalX + 12, portalY),
6785				_Utils_Tuple2(portalX + 15, portalY),
6786				_Utils_Tuple2(portalX + 18, portalY),
6787				_Utils_Tuple2(portalX + 12, portalY - 10),
6788				_Utils_Tuple2(portalX + 12, portalY + 12),
6789				_Utils_Tuple2(portalX + 20, portalY)
6790			]);
6791		var safePosition = A2(
6792			$elm$core$Maybe$withDefault,
6793			_Utils_Tuple2(portalX + 12, portalY),
6794			$elm$core$List$head(
6795				A2(
6796					$elm$core$List$filter,
6797					function (_v0) {
6798						var x = _v0.a;
6799						var y = _v0.b;
6800						return !A5($author$project$Main$checkMinerCollision, x, y, level, levelWidth, levelHeight);
6801					},
6802					candidatePositions)));
6803		return safePosition;
6804	});
6805var $elm$core$Tuple$second = function (_v0) {
6806	var y = _v0.b;
6807	return y;
6808};
6809var $author$project$Main$teleportMinerToPortal = F6(
6810	function (miner, fromPortal, toPortal, level, levelWidth, levelHeight) {
6811		var portalRightEdge = fromPortal.a + 7;
6812		var portalLeftEdge = fromPortal.a;
6813		var minerX = $elm$core$Basics$round(miner.a);
6814		var enteredFromLeft = _Utils_cmp(minerX, portalLeftEdge + 2) < 0;
6815		var newFacingLeft = !enteredFromLeft;
6816		var _v0 = enteredFromLeft ? _Utils_Tuple2(toPortal.a + 12, toPortal.b) : _Utils_Tuple2(toPortal.a - 12, toPortal.b);
6817		var exitX = _v0.a;
6818		var exitY = _v0.b;
6819		var exitBlocked = A5($author$project$Main$checkMinerCollision, exitX, exitY, level, levelWidth, levelHeight);
6820		var finalPosition = exitBlocked ? (enteredFromLeft ? A5($author$project$Main$findSafeExitPositionRight, toPortal.a, toPortal.b, level, levelWidth, levelHeight) : A5($author$project$Main$findSafeExitPositionLeft, toPortal.a, toPortal.b, level, levelWidth, levelHeight)) : _Utils_Tuple2(exitX, exitY);
6821		return _Utils_update(
6822			miner,
6823			{c: newFacingLeft, a: finalPosition.a, b: finalPosition.b});
6824	});
6825var $author$project$Main$checkPortalTeleportation = F5(
6826	function (miner, maybePortals, level, levelWidth, levelHeight) {
6827		if (maybePortals.$ === 1) {
6828			return miner;
6829		} else {
6830			var _v1 = maybePortals.a;
6831			var p1 = _v1.a;
6832			var maybeP2 = _v1.b;
6833			var portalBuffer = 3;
6834			var minerY = $elm$core$Basics$round(miner.b);
6835			var minerX = $elm$core$Basics$round(miner.a);
6836			var p1Collision = (_Utils_cmp(minerX, (p1.a + 7) + portalBuffer) < 0) && ((_Utils_cmp(minerX + 7, p1.a - portalBuffer) > 0) && ((_Utils_cmp(minerY, (p1.b + 12) + portalBuffer) < 0) && (_Utils_cmp(minerY + 10, p1.b - portalBuffer) > 0)));
6837			var p2Collision = function () {
6838				if (maybeP2.$ === 1) {
6839					return false;
6840				} else {
6841					var p2 = maybeP2.a;
6842					return (_Utils_cmp(minerX, (p2.a + 7) + portalBuffer) < 0) && ((_Utils_cmp(minerX + 7, p2.a - portalBuffer) > 0) && ((_Utils_cmp(minerY, (p2.b + 12) + portalBuffer) < 0) && (_Utils_cmp(minerY + 10, p2.b - portalBuffer) > 0)));
6843				}
6844			}();
6845			if (p1Collision && (!_Utils_eq(maybeP2, $elm$core$Maybe$Nothing))) {
6846				if (!maybeP2.$) {
6847					var p2 = maybeP2.a;
6848					return A6($author$project$Main$teleportMinerToPortal, miner, p1, p2, level, levelWidth, levelHeight);
6849				} else {
6850					return miner;
6851				}
6852			} else {
6853				if (p2Collision) {
6854					if (!maybeP2.$) {
6855						var p2 = maybeP2.a;
6856						return A6($author$project$Main$teleportMinerToPortal, miner, p2, p1, level, levelWidth, levelHeight);
6857					} else {
6858						return miner;
6859					}
6860				} else {
6861					return miner;
6862				}
6863			}
6864		}
6865	});
6866var $author$project$Main$gameWidth = 640;
6867var $elm$core$List$repeatHelp = F3(
6868	function (result, n, value) {
6869		repeatHelp:
6870		while (true) {
6871			if (n <= 0) {
6872				return result;
6873			} else {
6874				var $temp$result = A2($elm$core$List$cons, value, result),
6875					$temp$n = n - 1,
6876					$temp$value = value;
6877				result = $temp$result;
6878				n = $temp$n;
6879				value = $temp$value;
6880				continue repeatHelp;
6881			}
6882		}
6883	});
6884var $elm$core$List$repeat = F2(
6885	function (n, value) {
6886		return A3($elm$core$List$repeatHelp, _List_Nil, n, value);
6887	});
6888var $author$project$Main$copyScreenRow = F2(
6889	function (model, screenY) {
6890		var sourceY = screenY + model.j;
6891		var row = ((sourceY >= 0) && (_Utils_cmp(sourceY, model.v) < 0)) ? A2(
6892			$elm$core$List$map,
6893			function (screenX) {
6894				var sourceX = screenX + model.i;
6895				return ((sourceX >= 0) && (_Utils_cmp(sourceX, model.p) < 0)) ? A3($author$project$Main$getPixelAt, sourceX, sourceY, model.d) : 16711680;
6896			},
6897			A2($elm$core$List$range, 0, $author$project$Main$gameWidth - 1)) : A2($elm$core$List$repeat, $author$project$Main$gameWidth, 255);
6898		return row;
6899	});
6900var $author$project$Main$gameHeight = 480;
6901var $author$project$Main$minerSprites = $elm$core$Array$fromList(
6902	_List_fromArray(
6903		[
6904			_List_fromArray(
6905			[' !!!!  ', ' !oooo ', ' !oooo ', '  **   ', '  **XX ', '  o*XX ', '  **   ', '  **   ', '  **   ', '  ooo  ']),
6906			_List_fromArray(
6907			['  !    ', ' !!!!  ', ' !oooo ', '  oooo ', '  **XXX', '  *oXXX', '  **** ', ' ** ** ', '**   oo', 'oo     ']),
6908			_List_fromArray(
6909			['  !!!  ', ' !oooo ', '!!oooo ', '  ** XX', '  ***oX', '  ** XX', '  ***  ', ' ***** ', 'o** ** ', 'o    oo']),
6910			_List_fromArray(
6911			[' !!!!  ', '!!oooo ', ' !oooo ', '  **   ', '  **XXX', '  *oXXX', '  **   ', ' o***  ', '  o**  ', '    oo ']),
6912			_List_fromArray(
6913			['       ', '       ', ' !!!!  ', ' !oooo ', ' !oooo ', '  **   ', '  **XX ', '  o*XX ', ' #*# # ', '  ###  ']),
6914			_List_fromArray(
6915			['       ', '       ', '       ', '       ', '       ', '   #   ', '#!!!! #', ' !oooo ', ' #o#o# ', ' ##### ']),
6916			_List_fromArray(
6917			['       ', '       ', '       ', '       ', '       ', '       ', '       ', '       ', '   #   ', '#     #'])
6918		]));
6919var $elm$core$String$reverse = _String_reverse;
6920var $author$project$Main$spriteCharToColor = F2(
6921	function (_char, carryingGold) {
6922		switch (_char) {
6923			case ' ':
6924				return -1;
6925			case '!':
6926				return 65280;
6927			case 'o':
6928				return 16758465;
6929			case '*':
6930				return 255;
6931			case 'X':
6932				return carryingGold ? 16776960 : 255;
6933			case '#':
6934				return 16711680;
6935			default:
6936				return 16711935;
6937		}
6938	});
6939var $elm$core$String$foldr = _String_foldr;
6940var $elm$core$String$toList = function (string) {
6941	return A3($elm$core$String$foldr, $elm$core$List$cons, _List_Nil, string);
6942};
6943var $author$project$Main$renderMinerSprite = F4(
6944	function (pixelArray, screenX, screenY, miner) {
6945		var spriteIndex = function () {
6946			var _v2 = miner.h;
6947			switch (_v2.$) {
6948				case 0:
6949					return (miner.ae / 4) | 0;
6950				case 1:
6951					return 0;
6952				case 2:
6953					var frame = _v2.a;
6954					return A2($elm$core$Basics$min, frame + 4, 6);
6955				default:
6956					return 6;
6957			}
6958		}();
6959		var sprite = A2(
6960			$elm$core$Maybe$withDefault,
6961			_List_Nil,
6962			A2($elm$core$Array$get, spriteIndex, $author$project$Main$minerSprites));
6963		return A3(
6964			$elm$core$List$foldl,
6965			F2(
6966				function (_v1, acc) {
6967					var idx = _v1.a;
6968					var color = _v1.b;
6969					return A3($elm$core$Array$set, idx, color, acc);
6970				}),
6971			pixelArray,
6972			$elm$core$List$concat(
6973				A2(
6974					$elm$core$List$indexedMap,
6975					F2(
6976						function (row, line) {
6977							var flippedLine = miner.c ? $elm$core$String$reverse(line) : line;
6978							return A2(
6979								$elm$core$List$filter,
6980								function (_v0) {
6981									var idx = _v0.a;
6982									return !_Utils_eq(idx, -1);
6983								},
6984								A2(
6985									$elm$core$List$indexedMap,
6986									F2(
6987										function (col, _char) {
6988											var pixelY = (screenY + row) - 8;
6989											var pixelX = screenX + col;
6990											var color = A2($author$project$Main$spriteCharToColor, _char, miner.l);
6991											var bufferIndex = (pixelY * $author$project$Main$gameWidth) + pixelX;
6992											return ((!_Utils_eq(color, -1)) && ((pixelX >= 0) && ((_Utils_cmp(pixelX, $author$project$Main$gameWidth) < 0) && ((pixelY >= 0) && (_Utils_cmp(pixelY, $author$project$Main$gameHeight) < 0))))) ? _Utils_Tuple2(bufferIndex, color) : _Utils_Tuple2(-1, 0);
6993										}),
6994									$elm$core$String$toList(flippedLine)));
6995						}),
6996					sprite)));
6997	});
6998var $author$project$Main$renderMinerToBuffer = F3(
6999	function (model, miner, pixelArray) {
7000		var screenY = $elm$core$Basics$round(miner.b) - model.j;
7001		var screenX = $elm$core$Basics$round(miner.a) - model.i;
7002		return ((_Utils_cmp(screenX, -7) > -1) && ((_Utils_cmp(screenX, $author$project$Main$gameWidth) < 0) && ((_Utils_cmp(screenY, -10) > -1) && (_Utils_cmp(screenY, $author$project$Main$gameHeight) < 0)))) ? A4($author$project$Main$renderMinerSprite, pixelArray, screenX, screenY, miner) : pixelArray;
7003	});
7004var $author$project$Main$renderPortalToBuffer = F3(
7005	function (model, portal, pixelArray) {
7006		var screenY = portal.b - model.j;
7007		var screenX = portal.a - model.i;
7008		var portalWidth = 7;
7009		var portalHeight = 12;
7010		var portalColor = portal.Y ? 26367 : 16737792;
7011		return ((_Utils_cmp(screenX, -portalWidth) > -1) && ((_Utils_cmp(screenX, $author$project$Main$gameWidth) < 0) && ((_Utils_cmp(screenY, -portalHeight) > -1) && (_Utils_cmp(screenY, $author$project$Main$gameHeight) < 0)))) ? A3(
7012			$elm$core$List$foldl,
7013			F2(
7014				function (_v1, acc) {
7015					var idx = _v1.a;
7016					var color = _v1.b;
7017					return A3($elm$core$Array$set, idx, color, acc);
7018				}),
7019			pixelArray,
7020			A2(
7021				$elm$core$List$concatMap,
7022				function (row) {
7023					return A2(
7024						$elm$core$List$filter,
7025						function (_v0) {
7026							var idx = _v0.a;
7027							return !_Utils_eq(idx, -1);
7028						},
7029						A2(
7030							$elm$core$List$map,
7031							function (col) {
7032								var pixelY = screenY + row;
7033								var pixelX = screenX + col;
7034								var bufferIndex = (pixelY * $author$project$Main$gameWidth) + pixelX;
7035								return ((pixelX >= 0) && ((_Utils_cmp(pixelX, $author$project$Main$gameWidth) < 0) && ((pixelY >= 0) && (_Utils_cmp(pixelY, $author$project$Main$gameHeight) < 0)))) ? _Utils_Tuple2(bufferIndex, portalColor) : _Utils_Tuple2(-1, 0);
7036							},
7037							A2($elm$core$List$range, 0, portalWidth - 1)));
7038				},
7039				A2($elm$core$List$range, 0, portalHeight - 1))) : pixelArray;
7040	});
7041var $author$project$Main$renderPreviewDirtToBuffer = F4(
7042	function (model, centerX, centerY, pixelArray) {
7043		var screenY = centerY - model.j;
7044		var screenX = centerX - model.i;
7045		var previewColor = 16777215;
7046		var brushSize = 3;
7047		return ((_Utils_cmp(screenX, -7) > -1) && ((_Utils_cmp(screenX, $author$project$Main$gameWidth + 7) < 0) && ((_Utils_cmp(screenY, -7) > -1) && (_Utils_cmp(screenY, $author$project$Main$gameHeight + 7) < 0)))) ? A3(
7048			$elm$core$List$foldl,
7049			F2(
7050				function (_v0, acc) {
7051					var idx = _v0.a;
7052					var color = _v0.b;
7053					return A3($elm$core$Array$set, idx, color, acc);
7054				}),
7055			pixelArray,
7056			A2(
7057				$elm$core$List$concatMap,
7058				function (xx) {
7059					return A2(
7060						$elm$core$List$filterMap,
7061						function (yy) {
7062							var pixelY = screenY + yy;
7063							var pixelX = screenX + xx;
7064							var isCorner = (_Utils_eq(xx, -3) || (xx === 3)) && (_Utils_eq(yy, -3) || (yy === 3));
7065							var shouldRender = (!isCorner) && (!A2($elm$core$Basics$modBy, 2, xx + yy));
7066							var bufferIndex = (pixelY * $author$project$Main$gameWidth) + pixelX;
7067							return (shouldRender && ((pixelX >= 0) && ((_Utils_cmp(pixelX, $author$project$Main$gameWidth) < 0) && ((pixelY >= 0) && (_Utils_cmp(pixelY, $author$project$Main$gameHeight) < 0))))) ? $elm$core$Maybe$Just(
7068								_Utils_Tuple2(bufferIndex, previewColor)) : $elm$core$Maybe$Nothing;
7069						},
7070						A2($elm$core$List$range, -brushSize, brushSize));
7071				},
7072				A2($elm$core$List$range, -brushSize, brushSize))) : pixelArray;
7073	});
7074var $author$project$Main$renderPreviewPortalToBuffer = F3(
7075	function (model, portal, pixelArray) {
7076		var screenY = portal.b - model.j;
7077		var screenX = portal.a - model.i;
7078		var portalWidth = 7;
7079		var portalHeight = 12;
7080		var baseColor = portal.Y ? 26367 : 16724736;
7081		var previewColor = baseColor + 4210752;
7082		return ((_Utils_cmp(screenX, -portalWidth) > -1) && ((_Utils_cmp(screenX, $author$project$Main$gameWidth) < 0) && ((_Utils_cmp(screenY, -portalHeight) > -1) && (_Utils_cmp(screenY, $author$project$Main$gameHeight) < 0)))) ? A3(
7083			$elm$core$List$foldl,
7084			F2(
7085				function (_v0, acc) {
7086					var idx = _v0.a;
7087					var color = _v0.b;
7088					return A3($elm$core$Array$set, idx, color, acc);
7089				}),
7090			pixelArray,
7091			A2(
7092				$elm$core$List$concatMap,
7093				function (row) {
7094					return A2(
7095						$elm$core$List$filterMap,
7096						function (col) {
7097							var shouldRender = !A2($elm$core$Basics$modBy, 2, row + col);
7098							var pixelY = screenY + row;
7099							var pixelX = screenX + col;
7100							var bufferIndex = (pixelY * $author$project$Main$gameWidth) + pixelX;
7101							return (shouldRender && ((pixelX >= 0) && ((_Utils_cmp(pixelX, $author$project$Main$gameWidth) < 0) && ((pixelY >= 0) && (_Utils_cmp(pixelY, $author$project$Main$gameHeight) < 0))))) ? $elm$core$Maybe$Just(
7102								_Utils_Tuple2(bufferIndex, previewColor)) : $elm$core$Maybe$Nothing;
7103						},
7104						A2($elm$core$List$range, 0, portalWidth - 1));
7105				},
7106				A2($elm$core$List$range, 0, portalHeight - 1))) : pixelArray;
7107	});
7108var $author$project$Main$generatePixelBuffer = function (model) {
7109	var basePixels = A2(
7110		$elm$core$List$concatMap,
7111		$author$project$Main$copyScreenRow(model),
7112		A2($elm$core$List$range, 0, $author$project$Main$gameHeight - 1));
7113	var pixelArray = $elm$core$Array$fromList(basePixels);
7114	var minersPixels = A3(
7115		$elm$core$List$foldl,
7116		$author$project$Main$renderMinerToBuffer(model),
7117		pixelArray,
7118		model.s);
7119	var portalsPixels = function () {
7120		var _v3 = model.t;
7121		if (_v3.$ === 1) {
7122			return minersPixels;
7123		} else {
7124			var _v4 = _v3.a;
7125			var p1 = _v4.a;
7126			var maybeP2 = _v4.b;
7127			var withP1 = A3($author$project$Main$renderPortalToBuffer, model, p1, minersPixels);
7128			if (maybeP2.$ === 1) {
7129				return withP1;
7130			} else {
7131				var p2 = maybeP2.a;
7132				return A3($author$project$Main$renderPortalToBuffer, model, p2, withP1);
7133			}
7134		}
7135	}();
7136	var withPreviewPortal = function () {
7137		var _v2 = model.J;
7138		if (_v2.$ === 1) {
7139			return portalsPixels;
7140		} else {
7141			var previewPortal = _v2.a;
7142			return A3($author$project$Main$renderPreviewPortalToBuffer, model, previewPortal, portalsPixels);
7143		}
7144	}();
7145	var finalPixels = function () {
7146		var _v0 = model.at;
7147		if (_v0.$ === 1) {
7148			return withPreviewPortal;
7149		} else {
7150			var _v1 = _v0.a;
7151			var previewX = _v1.a;
7152			var previewY = _v1.b;
7153			return A4($author$project$Main$renderPreviewDirtToBuffer, model, previewX, previewY, withPreviewPortal);
7154		}
7155	}();
7156	return $elm$core$Array$toList(finalPixels);
7157};
7158var $author$project$Main$buildTerrain = F4(
7159	function (centerX, centerY, levelArray, model) {
7160		return A3(
7161			$elm$core$List$foldl,
7162			F2(
7163				function (_v1, acc) {
7164					var xx = _v1.a;
7165					var yy = _v1.b;
7166					var y = centerY + yy;
7167					var x = centerX + xx;
7168					if ((x >= 0) && ((y >= 0) && ((x < 1024) && (y < 2048)))) {
7169						var currentColor = A3($author$project$Main$getPixelAt, x, y, acc);
7170						if (!currentColor) {
7171							var depthFactor = 1.0 - ((x | (y << 10)) / (1024.0 * 6048.0));
7172							var baseBrightness = 1.4;
7173							var brightness = baseBrightness * depthFactor;
7174							var g = A2(
7175								$elm$core$Basics$min,
7176								255,
7177								A2(
7178									$elm$core$Basics$max,
7179									0,
7180									$elm$core$Basics$round(92.0 * brightness)));
7181							var r = A2(
7182								$elm$core$Basics$min,
7183								255,
7184								A2(
7185									$elm$core$Basics$max,
7186									0,
7187									$elm$core$Basics$round(111.0 * brightness)));
7188							var b = A2(
7189								$elm$core$Basics$min,
7190								255,
7191								A2(
7192									$elm$core$Basics$max,
7193									0,
7194									$elm$core$Basics$round(51.0 * brightness)));
7195							var dirtColor = b | ((g << 8) | (r << 16));
7196							return A4($author$project$Main$setPixelAt, x, y, dirtColor, acc);
7197						} else {
7198							return acc;
7199						}
7200					} else {
7201						return acc;
7202					}
7203				}),
7204			levelArray,
7205			A2(
7206				$elm$core$List$filter,
7207				function (_v0) {
7208					var xx = _v0.a;
7209					var yy = _v0.b;
7210					return !((_Utils_eq(xx, -3) || (xx === 3)) && (_Utils_eq(yy, -3) || (yy === 3)));
7211				},
7212				A2(
7213					$elm$core$List$concatMap,
7214					function (xx) {
7215						return A2(
7216							$elm$core$List$map,
7217							function (yy) {
7218								return _Utils_Tuple2(xx, yy);
7219							},
7220							A2($elm$core$List$range, -3, 3));
7221					},
7222					A2($elm$core$List$range, -3, 3))));
7223	});
7224var $elm$core$Bitwise$shiftRightBy = _Bitwise_shiftRightBy;
7225var $author$project$Main$digTerrain = F4(
7226	function (centerX, centerY, levelArray, model) {
7227		return A3(
7228			$elm$core$List$foldl,
7229			F2(
7230				function (_v1, acc) {
7231					var xx = _v1.a;
7232					var yy = _v1.b;
7233					var y = centerY + yy;
7234					var x = centerX + xx;
7235					if ((x >= 0) && ((y >= 0) && ((x < 1024) && (y < 2048)))) {
7236						var currentColor = A3($author$project$Main$getPixelAt, x, y, acc);
7237						var g = 255 & (currentColor >> 8);
7238						var r = 255 & (currentColor >> 16);
7239						var b = 255 & currentColor;
7240						return ((!_Utils_eq(r, g)) && (!_Utils_eq(r, b))) ? A4($author$project$Main$setPixelAt, x, y, 0, acc) : acc;
7241					} else {
7242						return acc;
7243					}
7244				}),
7245			levelArray,
7246			A2(
7247				$elm$core$List$filter,
7248				function (_v0) {
7249					var xx = _v0.a;
7250					var yy = _v0.b;
7251					return !((_Utils_eq(xx, -3) || (xx === 3)) && (_Utils_eq(yy, -3) || (yy === 3)));
7252				},
7253				A2(
7254					$elm$core$List$concatMap,
7255					function (xx) {
7256						return A2(
7257							$elm$core$List$map,
7258							function (yy) {
7259								return _Utils_Tuple2(xx, yy);
7260							},
7261							A2($elm$core$List$range, -3, 3));
7262					},
7263					A2($elm$core$List$range, -3, 3))));
7264	});
7265var $elm$core$Basics$sqrt = _Basics_sqrt;
7266var $author$project$Main$handleTerrainInteraction = function (model) {
7267	var worldMouseY = model.N + model.j;
7268	var worldMouseX = model.M + model.i;
7269	var prevWorldMouseY = model.aG + model.j;
7270	var prevWorldMouseX = model.aF + model.i;
7271	var dy = worldMouseY - prevWorldMouseY;
7272	var dx = worldMouseX - prevWorldMouseX;
7273	var distance = A2(
7274		$elm$core$Basics$max,
7275		1,
7276		$elm$core$Basics$round(
7277			$elm$core$Basics$sqrt((dx * dx) + (dy * dy))));
7278	return A3(
7279		$elm$core$List$foldl,
7280		F2(
7281			function (i, levelArray) {
7282				var ym = prevWorldMouseY + (((dy * i) / distance) | 0);
7283				var xm = prevWorldMouseX + (((dx * i) / distance) | 0);
7284				return (!model._) ? A4($author$project$Main$buildTerrain, xm, ym, levelArray, model) : ((model._ === 2) ? A4($author$project$Main$digTerrain, xm, ym, levelArray, model) : levelArray);
7285			}),
7286		model.d,
7287		A2($elm$core$List$range, 0, distance));
7288};
7289var $author$project$Main$isGoldDeliveredThisFrame = F2(
7290	function (oldMiner, newMiner) {
7291		return oldMiner.l && ((!newMiner.l) && (!_Utils_eq(oldMiner.u, $elm$core$Maybe$Nothing)));
7292	});
7293var $elm$browser$Browser$Navigation$load = _Browser_load;
7294var $elm$core$Platform$Cmd$none = $elm$core$Platform$Cmd$batch(_List_Nil);
7295var $elm$browser$Browser$Navigation$pushUrl = _Browser_pushUrl;
7296var $elm$json$Json$Encode$int = _Json_wrap;
7297var $elm$json$Json$Encode$list = F2(
7298	function (func, entries) {
7299		return _Json_wrap(
7300			A3(
7301				$elm$core$List$foldl,
7302				_Json_addEntry(func),
7303				_Json_emptyArray(0),
7304				entries));
7305	});
7306var $author$project$Main$renderPixels = _Platform_outgoingPort(
7307	'renderPixels',
7308	$elm$json$Json$Encode$list($elm$json$Json$Encode$int));
7309var $author$project$Main$findAllSlimePositions = F3(
7310	function (level, levelW, levelH) {
7311		return A2(
7312			$elm$core$List$concatMap,
7313			function (x) {
7314				return A2(
7315					$elm$core$List$filterMap,
7316					function (y) {
7317						return (A3($author$project$Main$getPixelAt, x, y, level) === 65280) ? $elm$core$Maybe$Just(
7318							_Utils_Tuple2(x, y)) : $elm$core$Maybe$Nothing;
7319					},
7320					A2($elm$core$List$range, 0, levelH - 1));
7321			},
7322			A2($elm$core$List$range, 0, levelW - 1));
7323	});
7324var $author$project$Main$trySpreadSlimeAt = F4(
7325	function (levelW, levelH, _v0, level) {
7326		var x = _v0.a;
7327		var y = _v0.b;
7328		var adjacentPositions = _List_fromArray(
7329			[
7330				_Utils_Tuple2(x - 1, y),
7331				_Utils_Tuple2(x + 1, y),
7332				_Utils_Tuple2(x, y - 1),
7333				_Utils_Tuple2(x, y + 1)
7334			]);
7335		var validTargets = A2(
7336			$elm$core$List$filter,
7337			function (_v2) {
7338				var adjX = _v2.a;
7339				var adjY = _v2.b;
7340				return (adjX >= 0) && ((_Utils_cmp(adjX, levelW) < 0) && ((adjY >= 0) && ((_Utils_cmp(adjY, levelH) < 0) && function () {
7341					var pixel = A3($author$project$Main$getPixelAt, adjX, adjY, level);
7342					return (!(!pixel)) && ((pixel !== 16776960) && (pixel !== 65280));
7343				}())));
7344			},
7345			adjacentPositions);
7346		return A3(
7347			$elm$core$List$foldl,
7348			F2(
7349				function (_v1, acc) {
7350					var adjX = _v1.a;
7351					var adjY = _v1.b;
7352					return A4($author$project$Main$setPixelAt, adjX, adjY, 65280, acc);
7353				}),
7354			level,
7355			validTargets);
7356	});
7357var $author$project$Main$spreadSlime = F4(
7358	function (level, levelW, levelH, seed) {
7359		var _v0 = A2(
7360			$elm$random$Random$step,
7361			A2($elm$random$Random$int, 0, 15),
7362			seed);
7363		var shouldSpread = _v0.a;
7364		var newSeed = _v0.b;
7365		if (!shouldSpread) {
7366			var slimePositions = A3($author$project$Main$findAllSlimePositions, level, levelW, levelH);
7367			return A3(
7368				$elm$core$List$foldl,
7369				A2($author$project$Main$trySpreadSlimeAt, levelW, levelH),
7370				level,
7371				slimePositions);
7372		} else {
7373			return level;
7374		}
7375	});
7376var $elm$url$Url$addPort = F2(
7377	function (maybePort, starter) {
7378		if (maybePort.$ === 1) {
7379			return starter;
7380		} else {
7381			var port_ = maybePort.a;
7382			return starter + (':' + $elm$core$String$fromInt(port_));
7383		}
7384	});
7385var $elm$url$Url$addPrefixed = F3(
7386	function (prefix, maybeSegment, starter) {
7387		if (maybeSegment.$ === 1) {
7388			return starter;
7389		} else {
7390			var segment = maybeSegment.a;
7391			return _Utils_ap(
7392				starter,
7393				_Utils_ap(prefix, segment));
7394		}
7395	});
7396var $elm$url$Url$toString = function (url) {
7397	var http = function () {
7398		var _v0 = url.bn;
7399		if (!_v0) {
7400			return 'http://';
7401		} else {
7402			return 'https://';
7403		}
7404	}();
7405	return A3(
7406		$elm$url$Url$addPrefixed,
7407		'#',
7408		url.a9,
7409		A3(
7410			$elm$url$Url$addPrefixed,
7411			'?',
7412			url.bo,
7413			_Utils_ap(
7414				A2(
7415					$elm$url$Url$addPort,
7416					url.bk,
7417					_Utils_ap(http, url.bb)),
7418				url.bh)));
7419};
7420var $author$project$Main$updateArrowKeys = F3(
7421	function (keyCode, pressed, arrows) {
7422		switch (keyCode) {
7423			case 37:
7424				return _Utils_update(
7425					arrows,
7426					{aD: pressed});
7427			case 38:
7428				return _Utils_update(
7429					arrows,
7430					{aM: pressed});
7431			case 39:
7432				return _Utils_update(
7433					arrows,
7434					{aH: pressed});
7435			case 40:
7436				return _Utils_update(
7437					arrows,
7438					{aB: pressed});
7439			default:
7440				return arrows;
7441		}
7442	});
7443var $author$project$Main$updateCamera = F5(
7444	function (arrows, levelWidth, levelHeight, cameraX, cameraY) {
7445		var newY = (arrows.aM && (cameraY > 8)) ? (cameraY - 8) : ((arrows.aB && (_Utils_cmp(cameraY, levelHeight - $author$project$Main$gameHeight) < 0)) ? (cameraY + 8) : cameraY);
7446		var newX = (arrows.aD && (cameraX > 8)) ? (cameraX - 8) : ((arrows.aH && (_Utils_cmp(cameraX, levelWidth - $author$project$Main$gameWidth) < 0)) ? (cameraX + 8) : cameraX);
7447		return _Utils_Tuple2(newX, newY);
7448	});
7449var $author$project$Main$Dying = function (a) {
7450	return {$: 2, a: a};
7451};
7452var $author$project$Main$Walking = {$: 0};
7453var $elm$core$List$drop = F2(
7454	function (n, list) {
7455		drop:
7456		while (true) {
7457			if (n <= 0) {
7458				return list;
7459			} else {
7460				if (!list.b) {
7461					return list;
7462				} else {
7463					var x = list.a;
7464					var xs = list.b;
7465					var $temp$n = n - 1,
7466						$temp$list = xs;
7467					n = $temp$n;
7468					list = $temp$list;
7469					continue drop;
7470				}
7471			}
7472		}
7473	});
7474var $elm$core$Maybe$map = F2(
7475	function (f, maybe) {
7476		if (!maybe.$) {
7477			var value = maybe.a;
7478			return $elm$core$Maybe$Just(
7479				f(value));
7480		} else {
7481			return $elm$core$Maybe$Nothing;
7482		}
7483	});
7484var $author$project$Main$getSpriteCharAt = F3(
7485	function (spriteX, spriteY, frameIndex) {
7486		if ((spriteX >= 0) && ((spriteX < 7) && ((spriteY >= 0) && (spriteY < 10)))) {
7487			var _v0 = A2($elm$core$Array$get, frameIndex, $author$project$Main$minerSprites);
7488			if (!_v0.$) {
7489				var sprite = _v0.a;
7490				var _v1 = $elm$core$List$head(
7491					A2($elm$core$List$drop, spriteY, sprite));
7492				if (!_v1.$) {
7493					var row = _v1.a;
7494					return A2(
7495						$elm$core$Maybe$withDefault,
7496						' ',
7497						A2(
7498							$elm$core$Maybe$map,
7499							$elm$core$Tuple$first,
7500							$elm$core$String$uncons(
7501								A3($elm$core$String$slice, spriteX, spriteX + 1, row))));
7502				} else {
7503					return ' ';
7504				}
7505			} else {
7506				return ' ';
7507			}
7508		} else {
7509			return ' ';
7510		}
7511	});
7512var $author$project$Main$isGoldPixel = function (color) {
7513	return color === 16776960;
7514};
7515var $author$project$Main$checkForGold = F5(
7516	function (level, levelW, levelH, x, y) {
7517		var spritePositions = A2(
7518			$elm$core$List$concatMap,
7519			function (xx) {
7520				return A2(
7521					$elm$core$List$map,
7522					function (yy) {
7523						return _Utils_Tuple2(xx, yy);
7524					},
7525					A2($elm$core$List$range, -8, 1));
7526			},
7527			A2($elm$core$List$range, -3, 3));
7528		var checkSpritePixel = F2(
7529			function (xx, yy) {
7530				var worldY = y + yy;
7531				var worldX = x + xx;
7532				var spriteY = yy + 8;
7533				var spriteX = xx + 3;
7534				var spriteIndex = 0;
7535				var spriteChar = A3($author$project$Main$getSpriteCharAt, spriteX, spriteY, spriteIndex);
7536				if ((spriteChar !== ' ') && ((worldX >= 0) && ((_Utils_cmp(worldX, levelW) < 0) && ((worldY >= 0) && (_Utils_cmp(worldY, levelH) < 0))))) {
7537					var pixel = A3($author$project$Main$getPixelAt, worldX, worldY, level);
7538					return $author$project$Main$isGoldPixel(pixel);
7539				} else {
7540					return false;
7541				}
7542			});
7543		var hasGold = A2(
7544			$elm$core$List$any,
7545			function (_v0) {
7546				var xx = _v0.a;
7547				var yy = _v0.b;
7548				return A2(checkSpritePixel, xx, yy);
7549			},
7550			spritePositions);
7551		return hasGold;
7552	});
7553var $author$project$Main$checkForSlime = F5(
7554	function (level, levelW, levelH, x, y) {
7555		var spritePositions = A2(
7556			$elm$core$List$concatMap,
7557			function (spriteX) {
7558				return A2(
7559					$elm$core$List$map,
7560					function (spriteY) {
7561						return _Utils_Tuple2(spriteX, spriteY);
7562					},
7563					A2($elm$core$List$range, y - 9, y));
7564			},
7565			A2($elm$core$List$range, x, x + 6));
7566		return A2(
7567			$elm$core$List$any,
7568			function (_v0) {
7569				var checkX = _v0.a;
7570				var checkY = _v0.b;
7571				return ((checkX >= 0) && ((_Utils_cmp(checkX, levelW) < 0) && ((checkY >= 0) && (_Utils_cmp(checkY, levelH) < 0)))) ? (A3($author$project$Main$getPixelAt, checkX, checkY, level) === 65280) : false;
7572			},
7573			spritePositions);
7574	});
7575var $author$project$Main$simulateGoldFall = F5(
7576	function (level, levelW, levelH, startX, startY) {
7577		var fallStep = F2(
7578			function (x, y) {
7579				fallStep:
7580				while (true) {
7581					if (_Utils_cmp(y, levelH - 1) > -1) {
7582						return $elm$core$Maybe$Just(
7583							_Utils_Tuple2(x, y));
7584					} else {
7585						if (!(!A3($author$project$Main$getPixelAt, x, y + 1, level))) {
7586							if ((x > 0) && (!A3($author$project$Main$getPixelAt, x - 1, y + 1, level))) {
7587								var $temp$x = x - 1,
7588									$temp$y = y + 1;
7589								x = $temp$x;
7590								y = $temp$y;
7591								continue fallStep;
7592							} else {
7593								if ((_Utils_cmp(x, levelW - 1) < 0) && (!A3($author$project$Main$getPixelAt, x + 1, y + 1, level))) {
7594									var $temp$x = x + 1,
7595										$temp$y = y + 1;
7596									x = $temp$x;
7597									y = $temp$y;
7598									continue fallStep;
7599								} else {
7600									return $elm$core$Maybe$Just(
7601										_Utils_Tuple2(x, y));
7602								}
7603							}
7604						} else {
7605							var $temp$x = x,
7606								$temp$y = y + 1;
7607							x = $temp$x;
7608							y = $temp$y;
7609							continue fallStep;
7610						}
7611					}
7612				}
7613			});
7614		return ((startX >= 0) && ((_Utils_cmp(startX, levelW) < 0) && (startY >= 0))) ? A2(fallStep, startX, startY) : $elm$core$Maybe$Nothing;
7615	});
7616var $author$project$Main$dropSingleGoldPixel = F6(
7617	function (levelW, levelH, minerX, minerY, pixelIndex, level) {
7618		var startY = minerY - 5;
7619		var startX = minerX;
7620		var goldColor = 16711168;
7621		var finalPosition = A5($author$project$Main$simulateGoldFall, level, levelW, levelH, startX, startY);
7622		if (!finalPosition.$) {
7623			var _v1 = finalPosition.a;
7624			var x = _v1.a;
7625			var y = _v1.b;
7626			return ((y >= 0) && (_Utils_cmp(y, levelH) < 0)) ? A4($author$project$Main$setPixelAt, x, y, goldColor, level) : level;
7627		} else {
7628			return level;
7629		}
7630	});
7631var $author$project$Main$dropGoldOnPlatform = F5(
7632	function (level, levelW, levelH, minerX, minerY) {
7633		var dropPositions = A2($elm$core$List$range, 0, 3);
7634		var finalLevel = A3(
7635			$elm$core$List$foldl,
7636			A4($author$project$Main$dropSingleGoldPixel, levelW, levelH, minerX, minerY),
7637			level,
7638			dropPositions);
7639		return finalLevel;
7640	});
7641var $author$project$Main$fallTwoPixels = F8(
7642	function (level, levelW, levelH, x, startY, fallDist, facingLeft, seed) {
7643		var fallY1 = ((startY < 4) || ((startY >= 0) && ((_Utils_cmp(startY, levelH - 1) < 0) && (!A5(
7644			$author$project$Main$isPixelSolid,
7645			level,
7646			levelW,
7647			levelH,
7648			startY + 1,
7649			$elm$core$Basics$round(x)))))) ? (startY + 1) : startY;
7650		var fallY2 = ((fallY1 < 4) || ((fallY1 >= 0) && ((_Utils_cmp(fallY1, levelH - 1) < 0) && (!A5(
7651			$author$project$Main$isPixelSolid,
7652			level,
7653			levelW,
7654			levelH,
7655			fallY1 + 1,
7656			$elm$core$Basics$round(x)))))) ? (fallY1 + 1) : fallY1;
7657		var newFallDist = fallDist + (fallY2 - startY);
7658		return _Utils_Tuple2(
7659			{c: facingLeft, f: newFallDist, g: 0, h: $author$project$Main$Falling, a: x, b: fallY2},
7660			seed);
7661	});
7662var $author$project$Main$getPlatformTarget = F2(
7663	function (levelW, x) {
7664		var rightDistance = levelW - x;
7665		var leftDistance = x;
7666		return (_Utils_cmp(leftDistance, rightDistance) < 1) ? 'left' : 'right';
7667	});
7668var $author$project$Main$findValidMove = F5(
7669	function (level, levelW, levelH, targetX, currentY) {
7670		var checkYOffsets = _List_fromArray(
7671			[2, 1, 0, -1, -2, -3, -4]);
7672		var checkOffset = function (yOffset) {
7673			var testY = currentY + yOffset;
7674			return (!A5($author$project$Main$isPixelSolid, level, levelW, levelH, testY, targetX)) ? $elm$core$Maybe$Just(
7675				_Utils_Tuple2(targetX, testY)) : $elm$core$Maybe$Nothing;
7676		};
7677		return $elm$core$List$head(
7678			A2($elm$core$List$filterMap, checkOffset, checkYOffsets));
7679	});
7680var $author$project$Main$handleGroundMovement = F6(
7681	function (level, levelW, levelH, miner, adjustedY, seed) {
7682		var shouldDie = miner.f > 100;
7683		var currentX = $elm$core$Basics$round(miner.a);
7684		if (shouldDie) {
7685			return _Utils_Tuple2(
7686				{
7687					c: miner.c,
7688					f: 0,
7689					g: -1,
7690					h: $author$project$Main$Dying(1),
7691					a: miner.a,
7692					b: adjustedY
7693				},
7694				seed);
7695		} else {
7696			var newJumpVel = -1;
7697			var newFallDist = 0;
7698			var _v0 = A2(
7699				$elm$random$Random$step,
7700				A2($elm$random$Random$int, 0, 19),
7701				seed);
7702			var standStillRoll = _v0.a;
7703			var seed1 = _v0.b;
7704			var shouldStandStill = !standStillRoll;
7705			if (shouldStandStill) {
7706				return _Utils_Tuple2(
7707					{c: miner.c, f: newFallDist, g: newJumpVel, h: $author$project$Main$Walking, a: miner.a, b: adjustedY},
7708					seed1);
7709			} else {
7710				var targetDirection = miner.c ? (-1) : 1;
7711				var targetX = currentX + targetDirection;
7712				var validMove = A5($author$project$Main$findValidMove, level, levelW, levelH, targetX, adjustedY);
7713				var newFacingForGold = miner.c;
7714				if (!validMove.$) {
7715					var _v2 = validMove.a;
7716					var validX = _v2.a;
7717					var validY = _v2.b;
7718					var _v3 = A2(
7719						$elm$random$Random$step,
7720						A2($elm$random$Random$int, 0, 3999),
7721						seed1);
7722					var randomTurnRoll = _v3.a;
7723					var seed2 = _v3.b;
7724					var shouldRandomTurn = !randomTurnRoll;
7725					var newFacingLeft = shouldRandomTurn ? (!newFacingForGold) : newFacingForGold;
7726					return _Utils_Tuple2(
7727						{c: newFacingLeft, f: newFallDist, g: newJumpVel, h: $author$project$Main$Walking, a: validX, b: validY},
7728						seed2);
7729				} else {
7730					var _v4 = A2(
7731						$elm$random$Random$step,
7732						A2($elm$random$Random$int, 0, 9),
7733						seed1);
7734					var turnRoll = _v4.a;
7735					var seed2 = _v4.b;
7736					var _v5 = A2(
7737						$elm$random$Random$step,
7738						A2($elm$random$Random$int, 0, 2),
7739						seed2);
7740					var jumpChance = _v5.a;
7741					var seed3 = _v5.b;
7742					var shouldTurn = !turnRoll;
7743					var newFacingLeft = shouldTurn ? (!newFacingForGold) : newFacingForGold;
7744					var shouldJump = shouldTurn && (!(!jumpChance));
7745					return shouldJump ? _Utils_Tuple2(
7746						{c: newFacingLeft, f: newFallDist, g: 16, h: $author$project$Main$Walking, a: miner.a, b: adjustedY},
7747						seed3) : _Utils_Tuple2(
7748						{c: newFacingLeft, f: newFallDist, g: newJumpVel, h: $author$project$Main$Walking, a: miner.a, b: adjustedY},
7749						seed3);
7750				}
7751			}
7752		}
7753	});
7754var $author$project$Main$getGroundLevel = F4(
7755	function (level, levelW, levelH, x) {
7756		var findGround = function (y) {
7757			findGround:
7758			while (true) {
7759				if (_Utils_cmp(y, levelH) > -1) {
7760					return levelH - 1;
7761				} else {
7762					if (A5($author$project$Main$isPixelSolid, level, levelW, levelH, y, x)) {
7763						return y - 1;
7764					} else {
7765						var $temp$y = y + 1;
7766						y = $temp$y;
7767						continue findGround;
7768					}
7769				}
7770			}
7771		};
7772		return findGround(0);
7773	});
7774var $author$project$Main$isAboveGround = F5(
7775	function (level, levelW, levelH, x, y) {
7776		if ((x >= 0) && ((_Utils_cmp(x, levelW) < 0) && (x < 1024))) {
7777			var groundHeight = A4($author$project$Main$getGroundLevel, level, levelW, levelH, x);
7778			return _Utils_cmp(y, groundHeight) < 1;
7779		} else {
7780			return false;
7781		}
7782	});
7783var $author$project$Main$isOnPlatform = F2(
7784	function (levelW, x) {
7785		return (x === 40) || _Utils_eq(x, levelW - 40);
7786	});
7787var $author$project$Main$removeGoldAtMiner = F5(
7788	function (level, levelW, levelH, x, y) {
7789		var spritePositions = A2(
7790			$elm$core$List$concatMap,
7791			function (xx) {
7792				return A2(
7793					$elm$core$List$map,
7794					function (yy) {
7795						return _Utils_Tuple2(xx, yy);
7796					},
7797					A2($elm$core$List$range, -8, 1));
7798			},
7799			A2($elm$core$List$range, -3, 3));
7800		var removeSpriteGold = F3(
7801			function (xx, yy, levelArray) {
7802				var worldY = y + yy;
7803				var worldX = x + xx;
7804				var spriteY = yy + 8;
7805				var spriteX = xx + 3;
7806				var spriteIndex = 0;
7807				var spriteChar = A3($author$project$Main$getSpriteCharAt, spriteX, spriteY, spriteIndex);
7808				if ((spriteChar !== ' ') && ((worldX >= 0) && ((_Utils_cmp(worldX, levelW) < 0) && ((worldY >= 0) && (_Utils_cmp(worldY, levelH) < 0))))) {
7809					var pixel = A3($author$project$Main$getPixelAt, worldX, worldY, levelArray);
7810					return $author$project$Main$isGoldPixel(pixel) ? A4($author$project$Main$setPixelAt, worldX, worldY, 0, levelArray) : levelArray;
7811				} else {
7812					return levelArray;
7813				}
7814			});
7815		return A3(
7816			$elm$core$List$foldl,
7817			F2(
7818				function (_v0, acc) {
7819					var xx = _v0.a;
7820					var yy = _v0.b;
7821					return A3(removeSpriteGold, xx, yy, acc);
7822				}),
7823			level,
7824			spritePositions);
7825	});
7826var $author$project$Main$updateMiner = F6(
7827	function (level, levelW, levelH, miner, seed, gameSpeed) {
7828		var _v0 = miner.h;
7829		switch (_v0.$) {
7830			case 3:
7831				return _Utils_Tuple3(miner, level, seed);
7832			case 2:
7833				var frame = _v0.a;
7834				return (frame < 2) ? _Utils_Tuple3(
7835					_Utils_update(
7836						miner,
7837						{
7838							h: $author$project$Main$Dying(frame + 1)
7839						}),
7840					level,
7841					seed) : _Utils_Tuple3(
7842					_Utils_update(
7843						miner,
7844						{h: $author$project$Main$Dead}),
7845					level,
7846					seed);
7847			default:
7848				var finalVy = 0.0;
7849				var currentY = $elm$core$Basics$round(miner.b);
7850				var currentX = $elm$core$Basics$round(miner.a);
7851				var _v1 = function () {
7852					if ((miner.g > 1) && (currentY > 1)) {
7853						var targetY = currentY - ((miner.g / 8) | 0);
7854						var targetX = currentX + (miner.c ? (-1) : 1);
7855						return ((targetX >= 0) && ((_Utils_cmp(targetX, levelW) < 0) && ((targetY >= 0) && (!A5($author$project$Main$isPixelSolid, level, levelW, levelH, targetY, targetX))))) ? _Utils_Tuple2(
7856							{
7857								c: miner.c,
7858								f: miner.f,
7859								g: miner.g - 1,
7860								h: (miner.g <= 2) ? $author$project$Main$Falling : $author$project$Main$Walking,
7861								a: targetX,
7862								b: targetY
7863							},
7864							seed) : _Utils_Tuple2(
7865							{c: miner.c, f: miner.f, g: 0, h: $author$project$Main$Falling, a: miner.a, b: miner.b},
7866							seed);
7867					} else {
7868						var adjustedY = ((currentY > 0) && (A5($author$project$Main$isPixelSolid, level, levelW, levelH, currentY, currentX) && (A3($author$project$Main$getPixelAt, currentX, currentY, level) === 16776960))
7868) ? (currentY - 1) : currentY;
7869						var shouldFall = (adjustedY < 4) || ((adjustedY >= 0) && ((_Utils_cmp(adjustedY, levelH - 1) < 0) && (!A5($author$project$Main$isPixelSolid, level, levelW, levelH, adjustedY + 1, currentX))));
7870						if (shouldFall) {
7871							if (_Utils_eq(miner.g, -1)) {
7872								var _v2 = A2(
7873									$elm$random$Random$step,
7874									A2($elm$random$Random$int, 0, 2),
7875									seed);
7876								var randomVal = _v2.a;
7877								var newSeed1 = _v2.b;
7878								return (!(!randomVal)) ? _Utils_Tuple2(
7879									{c: miner.c, f: miner.f, g: 16, h: $author$project$Main$Walking, a: miner.a, b: adjustedY},
7880									newSeed1) : A8($author$project$Main$fallTwoPixels, level, levelW, levelH, miner.a, adjustedY, miner.f, miner.c, newSeed1);
7881							} else {
7882								return A8($author$project$Main$fallTwoPixels, level, levelW, levelH, miner.a, adjustedY, miner.f, miner.c, seed);
7883							}
7884						} else {
7885							return A6($author$project$Main$handleGroundMovement, level, levelW, levelH, miner, adjustedY, seed);
7886						}
7887					}
7888				}();
7889				var movement = _v1.a;
7890				var newSeed = _v1.b;
7891				var goldInteraction = function () {
7892					if (!miner.l) {
7893						var hasGold = A5(
7894							$author$project$Main$checkForGold,
7895							level,
7896							levelW,
7897							levelH,
7898							$elm$core$Basics$round(movement.a),
7899							$elm$core$Basics$round(movement.b));
7900						if (hasGold) {
7901							var platform = A2(
7902								$author$project$Main$getPlatformTarget,
7903								levelW,
7904								$elm$core$Basics$round(movement.a));
7905							var levelWithoutGold = A5(
7906								$author$project$Main$removeGoldAtMiner,
7907								level,
7908								levelW,
7909								levelH,
7910								$elm$core$Basics$round(movement.a),
7911								$elm$core$Basics$round(movement.b));
7912							return {
7913								l: true,
7914								aC: true,
7915								av: false,
7916								d: levelWithoutGold,
7917								u: $elm$core$Maybe$Just(platform)
7918							};
7919						} else {
7920							return {l: miner.l, aC: false, av: false, d: level, u: miner.u};
7921						}
7922					} else {
7923						if (miner.l && (A2(
7924							$author$project$Main$isOnPlatform,
7925							levelW,
7926							$elm$core$Basics$round(movement.a)) && A5(
7927							$author$project$Main$isAboveGround,
7928							level,
7929							levelW,
7930							levelH,
7931							$elm$core$Basics$round(movement.a),
7932							$elm$core$Basics$round(movement.b)))) {
7933							var levelWithDroppedGold = A5(
7934								$author$project$Main$dropGoldOnPlatform,
7935								level,
7936								levelW,
7937								levelH,
7938								$elm$core$Basics$round(movement.a),
7939								$elm$core$Basics$round(movement.b));
7940							return {l: false, aC: false, av: true, d: levelWithDroppedGold, u: $elm$core$Maybe$Nothing};
7941						} else {
7942							return {l: miner.l, aC: false, av: false, d: level, u: miner.u};
7943						}
7944					}
7945				}();
7946				var newAnimFrame = _Utils_eq(movement.h, $author$project$Main$Walking) ? A2($elm$core$Basics$modBy, 16, miner.ae + 1) : miner.ae;
7947				var newFacingLeft = goldInteraction.av ? (!miner.c) : movement.c;
7948				var slimeCollision = A5(
7949					$author$project$Main$checkForSlime,
7950					goldInteraction.d,
7951					levelW,
7952					levelH,
7953					$elm$core$Basics$round(movement.a),
7954					$elm$core$Basics$round(movement.b));
7955				var updatedMiner = slimeCollision ? _Utils_update(
7956					miner,
7957					{
7958						ae: newAnimFrame,
7959						l: goldInteraction.l,
7960						c: newFacingLeft,
7961						f: movement.f,
7962						g: movement.g,
7963						h: $author$project$Main$Dying(0),
7964						u: goldInteraction.u,
7965						aP: 0.0,
7966						aQ: finalVy,
7967						a: movement.a,
7968						b: movement.b
7969					}) : _Utils_update(
7970					miner,
7971					{ae: newAnimFrame, l: goldInteraction.l, c: newFacingLeft, f: movement.f, g: movement.g, h: movement.h, u: goldInteraction.u, aP: 0.0, aQ: finalVy, a: movement.a, b: movement.b});
7972				return _Utils_Tuple3(updatedMiner, goldInteraction.d, newSeed);
7973		}
7974	});
7975var $author$project$Main$update = F2(
7976	function (msg, model) {
7977		switch (msg.$) {
7978			case 0:
7979				return _Utils_Tuple2(model, $elm$core$Platform$Cmd$none);
7980			case 1:
7981				return _Utils_Tuple2(
7982					_Utils_update(
7983						model,
7984						{U: 0, z: 0, o: 1}),
7985					A2(
7986						$elm$core$Task$perform,
7987						A2($elm$core$Basics$composeL, $author$project$Main$GameTick, $elm$time$Time$posixToMillis),
7988						$elm$time$Time$now));
7989			case 2:
7990				var pixelBuffer = $author$project$Main$generatePixelBuffer(model);
7991				return _Utils_Tuple2(
7992					model,
7993					$author$project$Main$renderPixels(pixelBuffer));
7994			case 3:
7995				if (model.o === 1) {
7996					var updateIterations = A2(
7997						$elm$core$Basics$max,
7998						1,
7999						$elm$core$Basics$round(model.ah));
8000					var _v1 = A5($author$project$Main$updateCamera, model.T, model.p, model.v, model.i, model.j);
8001					var newCameraX = _v1.a;
8002					var newCameraY = _v1.b;
8003					var levelAfterInteraction = (model._ >= 0) ? $author$project$Main$handleTerrainInteraction(
8004						_Utils_update(
8005							model,
8006							{i: newCameraX, j: newCameraY})) : model.d;
8007					var minerUpdateResult = model.I ? {d: levelAfterInteraction, ax: model.Q, s: model.s, e: model.e, B: model.aj} : A3(
8008						$elm$core$List$foldl,
8009						F2(
8010							function (_v3, iterResult) {
8011								return A3(
8012									$elm$core$List$foldl,
8013									F2(
8014										function (miner, acc) {
8015											var _v4 = A6($author$project$Main$updateMiner, acc.d, model.p, model.v, miner, acc.B, 1.0);
8016											var newMiner = _v4.a;
8017											var newLevel = _v4.b;
8018											var newSeed = _v4.c;
8019											var minerAfterPortal = A5($author$project$Main$checkPortalTeleportation, newMiner, model.t, newLevel, model.p, model.v);
8020											var aliveCount = (!_Utils_eq(minerAfterPortal.h, $author$project$Main$Dead)) ? 1 : 0;
8021											var scoreDelta = A2($author$project$Main$isGoldDeliveredThisFrame, miner, minerAfterPortal) ? 1 : 0;
8022											return {
8023												d: newLevel,
8024												ax: acc.ax + aliveCount,
8025												s: A2($elm$core$List$cons, minerAfterPortal, acc.s),
8026												e: acc.e + scoreDelta,
8027												B: newSeed
8028											};
8029										}),
8030									{d: iterResult.d, ax: 0, s: _List_Nil, e: iterResult.e, B: iterResult.B},
8031									iterResult.s);
8032							}),
8033						{d: levelAfterInteraction, ax: model.Q, s: model.s, e: model.e, B: model.aj},
8034						A2($elm$core$List$range, 1, updateIterations));
8035					var finalMiners = $elm$core$List$reverse(minerUpdateResult.s);
8036					var levelWithSlime = model.I ? minerUpdateResult.d : A3(
8037						$elm$core$List$foldl,
8038						F2(
8039							function (_v2, currentLevel) {
8040								return A4($author$project$Main$spreadSlime, currentLevel, model.p, model.v, minerUpdateResult.B);
8041							}),
8042						minerUpdateResult.d,
8043						A2($elm$core$List$range, 1, updateIterations));
8044					var newModel = _Utils_update(
8045						model,
8046						{i: newCameraX, j: newCameraY, d: levelWithSlime, s: finalMiners, aF: model.M, aG: model.N, aj: minerUpdateResult.B, e: minerUpdateResult.e, Q: minerUpdateResult.ax});
8047					var pixelBuffer = $author$project$Main$generatePixelBuffer(newModel);
8048					var renderCmd = $author$project$Main$renderPixels(pixelBuffer);
8049					return _Utils_Tuple2(newModel, renderCmd);
8050				} else {
8051					var pixelBuffer = $author$project$Main$generatePixelBuffer(model);
8052					return _Utils_Tuple2(
8053						model,
8054						$author$project$Main$renderPixels(pixelBuffer));
8055				}
8056			case 4:
8057				var seedValue = msg.a;
8058				var startTimeOffset = (model.as > 0) ? (-(model.as * 1000)) : 0;
8059				var freshSeed = $elm$random$Random$initialSeed(seedValue);
8060				var actualLevel = (model.af > 0) ? (model.af - 1) : model.q;
8061				var levelConfig = $author$project$Main$getLevelConfig(actualLevel);
8062				var minerCount = (model.aq > 0) ? model.aq : levelConfig.C;
8063				var levelResult = A2($author$project$Main$createLevel, actualLevel, freshSeed);
8064				var freshMiners = A3($author$project$Main$createInitialMiners, levelResult.p, minerCount, freshSeed);
8065				var newModel = _Utils_update(
8066					model,
8067					{
8068						T: {aB: false, aD: false, aH: false, aM: false},
8069						i: 0,
8070						j: 0,
8071						q: actualLevel,
8072						U: 0,
8073						at: $elm$core$Maybe$Nothing,
8074						z: startTimeOffset,
8075						o: 0,
8076						d: levelResult.d,
8077						v: levelResult.v,
8078						aw: levelConfig.O,
8079						p: levelResult.p,
8080						s: freshMiners,
8081						_: -1,
8082						M: 0,
8083						N: 0,
8084						A: false,
8085						J: $elm$core$Maybe$Nothing,
8086						E: 0,
8087						t: $elm$core$Maybe$Nothing,
8088						aF: 0,
8089						aG: 0,
8090						aj: levelResult.B,
8091						e: model.ap,
8092						al: false,
8093						Q: minerCount
8094					});
8095				var pixelBuffer = $author$project$Main$generatePixelBuffer(newModel);
8096				return _Utils_Tuple2(
8097					newModel,
8098					$author$project$Main$renderPixels(pixelBuffer));
8099			case 5:
8100				var x = msg.a;
8101				var y = msg.b;
8102				var updatedModel = _Utils_update(
8103					model,
8104					{M: x, N: y});
8105				var finalModel = function () {
8106					if (model.A) {
8107						var levelY = y + model.j;
8108						var levelX = x + model.i;
8109						var isP1 = _Utils_eq(model.t, $elm$core$Maybe$Nothing);
8110						var updatedPreview = {Y: isP1, a: levelX, b: levelY};
8111						return _Utils_update(
8112							updatedModel,
8113							{
8114								at: $elm$core$Maybe$Nothing,
8115								J: $elm$core$Maybe$Just(updatedPreview)
8116							});
8117					} else {
8118						var levelY = y + model.j;
8119						var levelX = x + model.i;
8120						return _Utils_update(
8121							updatedModel,
8122							{
8123								at: $elm$core$Maybe$Just(
8124									_Utils_Tuple2(levelX, levelY)),
8125								J: $elm$core$Maybe$Nothing
8126							});
8127					}
8128				}();
8129				return _Utils_Tuple2(finalModel, $elm$core$Platform$Cmd$none);
8130			case 6:
8131				var button = msg.a;
8132				var _v5 = model.o;
8133				switch (_v5) {
8134					case 0:
8135						return _Utils_Tuple2(
8136							_Utils_update(
8137								model,
8138								{U: 0, z: 0, o: 1}),
8139							A2(
8140								$elm$core$Task$perform,
8141								A2($elm$core$Basics$composeL, $author$project$Main$GameTick, $elm$time$Time$posixToMillis),
8142								$elm$time$Time$now));
8143					case 1:
8144						if (model.A && (button === 2)) {
8145							return _Utils_Tuple2(
8146								_Utils_update(
8147									model,
8148									{A: false, J: $elm$core$Maybe$Nothing}),
8149								$elm$core$Platform$Cmd$none);
8150						} else {
8151							if (model.A && (!button)) {
8152								var portalDuration = 20;
8153								var levelY = model.N + model.j;
8154								var levelX = model.M + model.i;
8155								var newPortal = {
8156									Y: _Utils_eq(model.t, $elm$core$Maybe$Nothing),
8157									a: levelX,
8158									b: levelY
8159								};
8160								var _v6 = function () {
8161									var _v7 = model.t;
8162									if (_v7.$ === 1) {
8163										return _Utils_Tuple3(
8164											$elm$core$Maybe$Just(
8165												_Utils_Tuple2(newPortal, $elm$core$Maybe$Nothing)),
8166											20,
8167											false);
8168									} else {
8169										if (_v7.a.b.$ === 1) {
8170											var _v8 = _v7.a;
8171											var p1 = _v8.a;
8172											var _v9 = _v8.b;
8173											return _Utils_Tuple3(
8174												$elm$core$Maybe$Just(
8175													_Utils_Tuple2(
8176														p1,
8177														$elm$core$Maybe$Just(
8178															_Utils_update(
8179																newPortal,
8180																{Y: false})))),
8181												0,
8182												true);
8183										} else {
8184											var _v10 = _v7.a;
8185											return _Utils_Tuple3(
8186												$elm$core$Maybe$Just(
8187													_Utils_Tuple2(newPortal, $elm$core$Maybe$Nothing)),
8188												20,
8189												false);
8190										}
8191									}
8192								}();
8193								var newPortals = _v6.a;
8194								var goldCost = _v6.b;
8195								var shouldExitPortalMode = _v6.c;
8196								var newScore = A2($elm$core$Basics$max, 0, model.e - goldCost);
8197								var newPortalPreview = shouldExitPortalMode ? $elm$core$Maybe$Nothing : $elm$core$Maybe$Just(
8198									{Y: false, a: model.M + model.i, b: model.N + model.j});
8199								return _Utils_Tuple2(
8200									_Utils_update(
8201										model,
8202										{A: !shouldExitPortalMode, J: newPortalPreview, E: portalDuration, t: newPortals, e: newScore}),
8203									$elm$core$Platform$Cmd$none);
8204							} else {
8205								return _Utils_Tuple2(
8206									_Utils_update(
8207										model,
8208										{_: button}),
8209									$elm$core$Platform$Cmd$none);
8210							}
8211						}
8212					case 2:
8213						return _Utils_Tuple2(
8214							model,
8215							A2(
8216								$elm$core$Task$perform,
8217								$elm$core$Basics$always($author$project$Main$NextLevel),
8218								$elm$core$Task$succeed(0)));
8219					case 3:
8220						return _Utils_Tuple2(
8221							model,
8222							A2(
8223								$elm$core$Task$perform,
8224								$elm$core$Basics$always($author$project$Main$RestartLevel),
8225								$elm$core$Task$succeed(0)));
8226					default:
8227						return _Utils_Tuple2(model, $elm$core$Platform$Cmd$none);
8228				}
8229			case 7:
8230				return _Utils_Tuple2(
8231					_Utils_update(
8232						model,
8233						{_: -1}),
8234					$elm$core$Platform$Cmd$none);
8235			case 8:
8236				var keyCode = msg.a;
8237				var newShiftPressed = (keyCode === 16) ? true : model.al;
8238				var newArrowKeys = A3($author$project$Main$updateArrowKeys, keyCode, true, model.T);
8239				var _v11 = function () {
8240					if ((keyCode === 32) && (model.o === 1)) {
8241						return model.I ? _Utils_Tuple2(
8242							_Utils_update(
8243								model,
8244								{I: false}),
8245							$elm$core$Platform$Cmd$none) : ((model.e >= 80) ? _Utils_Tuple2(
8246							_Utils_update(
8247								model,
8248								{I: true, e: model.e - 80}),
8249							$elm$core$Platform$Cmd$none) : _Utils_Tuple2(model, $elm$core$Platform$Cmd$none));
8250					} else {
8251						if ((keyCode === 80) && ((model.o === 1) && ((model.e >= 20) && function () {
8252							var _v12 = model.t;
8253							if ((!_v12.$) && (!_v12.a.b.$)) {
8254								var _v13 = _v12.a;
8255								return false;
8256							} else {
8257								return true;
8258							}
8259						}()))) {
8260							var levelY = model.N + model.j;
8261							var levelX = model.M + model.i;
8262							var isP1 = _Utils_eq(model.t, $elm$core$Maybe$Nothing);
8263							var previewPortal = {Y: isP1, a: levelX, b: levelY};
8264							return _Utils_Tuple2(
8265								_Utils_update(
8266									model,
8267									{
8268										A: true,
8269										J: $elm$core$Maybe$Just(previewPortal)
8270									}),
8271								$elm$core$Platform$Cmd$none);
8272						} else {
8273							if ((keyCode === 27) && model.A) {
8274								return _Utils_Tuple2(
8275									_Utils_update(
8276										model,
8277										{A: false, J: $elm$core$Maybe$Nothing}),
8278									$elm$core$Platform$Cmd$none);
8279							} else {
8280								return _Utils_Tuple2(model, $elm$core$Platform$Cmd$none);
8281							}
8282						}
8283					}
8284				}();
8285				var newModel = _v11.a;
8286				var portalCmd = _v11.b;
8287				return _Utils_Tuple2(
8288					_Utils_update(
8289						newModel,
8290						{T: newArrowKeys, al: newShiftPressed}),
8291					portalCmd);
8292			case 9:
8293				var keyCode = msg.a;
8294				var newShiftPressed = (keyCode === 16) ? false : model.al;
8295				var newArrowKeys = A3($author$project$Main$updateArrowKeys, keyCode, false, model.T);
8296				return _Utils_Tuple2(
8297					_Utils_update(
8298						model,
8299						{T: newArrowKeys, al: newShiftPressed}),
8300					$elm$core$Platform$Cmd$none);
8301			case 10:
8302				if (model.q < 6) {
8303					var nextLevel = model.q + 1;
8304					return _Utils_Tuple2(
8305						_Utils_update(
8306							model,
8307							{q: nextLevel, o: 0}),
8308						A2(
8309							$elm$core$Task$perform,
8310							function (posix) {
8311								return $author$project$Main$SeedGenerated(
8312									$elm$time$Time$posixToMillis(posix));
8313							},
8314							$elm$time$Time$now));
8315				} else {
8316					return _Utils_Tuple2(
8317						_Utils_update(
8318							model,
8319							{o: 4}),
8320						$elm$core$Platform$Cmd$none);
8321				}
8322			case 11:
8323				return _Utils_Tuple2(
8324					_Utils_update(
8325						model,
8326						{o: 0}),
8327					A2(
8328						$elm$core$Task$perform,
8329						function (posix) {
8330							return $author$project$Main$SeedGenerated(
8331								$elm$time$Time$posixToMillis(posix));
8332						},
8333						$elm$time$Time$now));
8334			case 12:
8335				var currentTime = msg.a;
8336				if (model.I) {
8337					return _Utils_Tuple2(model, $elm$core$Platform$Cmd$none);
8338				} else {
8339					var newModel = _Utils_update(
8340						model,
8341						{
8342							U: currentTime,
8343							z: (!model.z) ? currentTime : model.z
8344						});
8345					var levelConfig = $author$project$Main$getLevelConfig(model.q);
8346					var elapsed = ((currentTime - newModel.z) / 1000) | 0;
8347					var timeLeft = levelConfig.P - elapsed;
8348					var gameOverCondition = (model.o === 1) ? ((_Utils_cmp(model.e, model.aw) > -1) ? $elm$core$Maybe$Just(2) : (((model.Q <= 0) || (timeLeft <= 0)) ? $elm$core$Maybe$Just(3) : $elm$core$Maybe$Nothing)) : $elm$core$Maybe$Nothing;
8349					if (!gameOverCondition.$) {
8350						var newState = gameOverCondition.a;
8351						return _Utils_Tuple2(
8352							_Utils_update(
8353								newModel,
8354								{o: newState}),
8355							$elm$core$Platform$Cmd$none);
8356					} else {
8357						return _Utils_Tuple2(newModel, $elm$core$Platform$Cmd$none);
8358					}
8359				}
8360			case 13:
8361				var urlRequest = msg.a;
8362				if (!urlRequest.$) {
8363					var url = urlRequest.a;
8364					return _Utils_Tuple2(
8365						model,
8366						A2(
8367							$elm$browser$Browser$Navigation$pushUrl,
8368							model.aU,
8369							$elm$url$Url$toString(url)));
8370				} else {
8371					var href = urlRequest.a;
8372					return _Utils_Tuple2(
8373						model,
8374						$elm$browser$Browser$Navigation$load(href));
8375				}
8376			case 14:
8377				var url = msg.a;
8378				var urlLevel = A2(
8379					$elm$core$Maybe$withDefault,
8380					0,
8381					$author$project$Main$parseLevelFromUrl(url));
8382				var urlGold = A2(
8383					$elm$core$Maybe$withDefault,
8384					0,
8385					$author$project$Main$parseGoldFromUrl(url));
8386				var currentLevel = A2(
8387					$elm$core$Basics$max,
8388					0,
8389					A2($elm$core$Basics$min, 6, urlLevel));
8390				if (!_Utils_eq(currentLevel, model.q)) {
8391					var levelResult = A2($author$project$Main$createLevel, currentLevel, model.aj);
8392					var levelConfig = $author$project$Main$getLevelConfig(currentLevel);
8393					return _Utils_Tuple2(
8394						_Utils_update(
8395							model,
8396							{
8397								i: 0,
8398								j: 0,
8399								q: currentLevel,
8400								U: 0,
8401								z: 0,
8402								o: 0,
8403								d: levelResult.d,
8404								v: levelResult.v,
8405								aw: levelConfig.O,
8406								p: levelResult.p,
8407								s: A3($author$project$Main$createInitialMiners, levelResult.p, levelConfig.C, levelResult.B),
8408								e: urlGold,
8409								Q: levelConfig.C,
8410								aO: url
8411							}),
8412						$elm$core$Platform$Cmd$none);
8413				} else {
8414					return _Utils_Tuple2(
8415						_Utils_update(
8416							model,
8417							{aO: url}),
8418						$elm$core$Platform$Cmd$none);
8419				}
8420			case 15:
8421				return _Utils_Tuple2(model, $elm$core$Platform$Cmd$none);
8422			case 16:
8423				if (model.I) {
8424					return _Utils_Tuple2(model, $elm$core$Platform$Cmd$none);
8425				} else {
8426					if (model.E > 0) {
8427						var newTimeRemaining = model.E - 1;
8428						var newPortals = (newTimeRemaining <= 0) ? $elm$core$Maybe$Nothing : model.t;
8429						return _Utils_Tuple2(
8430							_Utils_update(
8431								model,
8432								{E: newTimeRemaining, t: newPortals}),
8433							$elm$core$Platform$Cmd$none);
8434					} else {
8435						return _Utils_Tuple2(model, $elm$core$Platform$Cmd$none);
8436					}
8437				}
8438			case 17:
8439				var newSpeed = msg.a;
8440				var clampedSpeed = A2(
8441					$elm$core$Basics$max,
8442					0.1,
8443					A2($elm$core$Basics$min, 5.0, newSpeed));
8444				return _Utils_Tuple2(
8445					_Utils_update(
8446						model,
8447						{ah: clampedSpeed}),
8448					$elm$core$Platform$Cmd$none);
8449			case 18:
8450				return _Utils_Tuple2(
8451					_Utils_update(
8452						model,
8453						{ar: !model.ar}),
8454					$elm$core$Platform$Cmd$none);
8455			case 19:
8456				var newTime = msg.a;
8457				return _Utils_Tuple2(
8458					_Utils_update(
8459						model,
8460						{
8461							as: A2($elm$core$Basics$max, 0, newTime)
8462						}),
8463					$elm$core$Platform$Cmd$none);
8464			case 20:
8465				var newGold = msg.a;
8466				return _Utils_Tuple2(
8467					_Utils_update(
8468						model,
8469						{
8470							ap: A2($elm$core$Basics$max, 0, newGold)
8471						}),
8472					$elm$core$Platform$Cmd$none);
8473			case 21:
8474				var newMiners = msg.a;
8475				return _Utils_Tuple2(
8476					_Utils_update(
8477						model,
8478						{
8479							aq: A2($elm$core$Basics$max, 1, newMiners)
8480						}),
8481					$elm$core$Platform$Cmd$none);
8482			case 22:
8483				var newLevel = msg.a;
8484				return _Utils_Tuple2(
8485					_Utils_update(
8486						model,
8487						{
8488							af: A2(
8489								$elm$core$Basics$max,
8490								1,
8491								A2($elm$core$Basics$min, 7, newLevel))
8492						}),
8493					$elm$core$Platform$Cmd$none);
8494			default:
8495				var updatedModel = _Utils_update(
8496					model,
8497					{q: model.af - 1, e: model.ap});
8498				return _Utils_Tuple2(
8499					updatedModel,
8500					A2(
8501						$elm$core$Task$perform,
8502						function (posix) {
8503							return $author$project$Main$SeedGenerated(
8504								$elm$time$Time$posixToMillis(posix));
8505						},
8506						$elm$time$Time$now));
8507		}
8508	});
8509var $author$project$Main$SetConfigGoldValue = function (a) {
8510	return {$: 20, a: a};
8511};
8512var $author$project$Main$SetConfigLevel = function (a) {
8513	return {$: 22, a: a};
8514};
8515var $author$project$Main$SetConfigNumMiners = function (a) {
8516	return {$: 21, a: a};
8517};
8518var $author$project$Main$SetConfigStartingTime = function (a) {
8519	return {$: 19, a: a};
8520};
8521var $author$project$Main$SetGameSpeed = function (a) {
8522	return {$: 17, a: a};
8523};
8524var $author$project$Main$StartNewWithConfig = {$: 23};
8525var $author$project$Main$ToggleConfigPanel = {$: 18};
8526var $elm$html$Html$a = _VirtualDom_node('a');
8527var $elm$html$Html$button = _VirtualDom_node('button');
8528var $elm$html$Html$canvas = _VirtualDom_node('canvas');
8529var $elm$html$Html$div = _VirtualDom_node('div');
8530var $elm$core$String$fromFloat = _String_fromNumber;
8531var $elm$html$Html$h3 = _VirtualDom_node('h3');
8532var $elm$html$Html$Attributes$height = function (n) {
8533	return A2(
8534		_VirtualDom_attribute,
8535		'height',
8536		$elm$core$String$fromInt(n));
8537};
8538var $elm$json$Json$Encode$string = _Json_wrap;
8539var $elm$html$Html$Attributes$stringProperty = F2(
8540	function (key, string) {
8541		return A2(
8542			_VirtualDom_property,
8543			key,
8544			$elm$json$Json$Encode$string(string));
8545	});
8546var $elm$html$Html$Attributes$href = function (url) {
8547	return A2(
8548		$elm$html$Html$Attributes$stringProperty,
8549		'href',
8550		_VirtualDom_noJavaScriptUri(url));
8551};
8552var $elm$html$Html$i = _VirtualDom_node('i');
8553var $elm$html$Html$Attributes$id = $elm$html$Html$Attributes$stringProperty('id');
8554var $elm$html$Html$input = _VirtualDom_node('input');
8555var $elm$html$Html$label = _VirtualDom_node('label');
8556var $elm$html$Html$li = _VirtualDom_node('li');
8557var $elm$html$Html$Attributes$max = $elm$html$Html$Attributes$stringProperty('max');
8558var $elm$html$Html$Attributes$min = $elm$html$Html$Attributes$stringProperty('min');
8559var $author$project$Main$MouseMove = F2(
8560	function (a, b) {
8561		return {$: 5, a: a, b: b};
8562	});
8563var $elm$json$Json$Decode$oneOf = _Json_oneOf;
8564var $author$project$Main$mouseDecoder = A3(
8565	$elm$json$Json$Decode$map2,
8566	$author$project$Main$MouseMove,
8567	$elm$json$Json$Decode$oneOf(
8568		_List_fromArray(
8569			[
8570				A2($elm$json$Json$Decode$field, 'offsetX', $elm$json$Json$Decode$int),
8571				A2($elm$json$Json$Decode$field, 'clientX', $elm$json$Json$Decode$int)
8572			])),
8573	$elm$json$Json$Decode$oneOf(
8574		_List_fromArray(
8575			[
8576				A2($elm$json$Json$Decode$field, 'offsetY', $elm$json$Json$Decode$int),
8577				A2($elm$json$Json$Decode$field, 'clientY', $elm$json$Json$Decode$int)
8578			])));
8579var $author$project$Main$MouseDown = function (a) {
8580	return {$: 6, a: a};
8581};
8582var $author$project$Main$mouseDownDecoderWithPrevent = A2(
8583	$elm$json$Json$Decode$map,
8584	function (button) {
8585		return _Utils_Tuple2(
8586			$author$project$Main$MouseDown(button),
8587			true);
8588	},
8589	A2($elm$json$Json$Decode$field, 'button', $elm$json$Json$Decode$int));
8590var $author$project$Main$MouseUp = {$: 7};
8591var $author$project$Main$mouseUpDecoderWithPrevent = $elm$json$Json$Decode$succeed(
8592	_Utils_Tuple2($author$project$Main$MouseUp, true));
8593var $elm$virtual_dom$VirtualDom$Normal = function (a) {
8594	return {$: 0, a: a};
8595};
8596var $elm$virtual_dom$VirtualDom$on = _VirtualDom_on;
8597var $elm$html$Html$Events$on = F2(
8598	function (event, decoder) {
8599		return A2(
8600			$elm$virtual_dom$VirtualDom$on,
8601			event,
8602			$elm$virtual_dom$VirtualDom$Normal(decoder));
8603	});
8604var $elm$html$Html$Events$onClick = function (msg) {
8605	return A2(
8606		$elm$html$Html$Events$on,
8607		'click',
8608		$elm$json$Json$Decode$succeed(msg));
8609};
8610var $elm$html$Html$Events$alwaysStop = function (x) {
8611	return _Utils_Tuple2(x, true);
8612};
8613var $elm$virtual_dom$VirtualDom$MayStopPropagation = function (a) {
8614	return {$: 1, a: a};
8615};
8616var $elm$html$Html$Events$stopPropagationOn = F2(
8617	function (event, decoder) {
8618		return A2(
8619			$elm$virtual_dom$VirtualDom$on,
8620			event,
8621			$elm$virtual_dom$VirtualDom$MayStopPropagation(decoder));
8622	});
8623var $elm$json$Json$Decode$at = F2(
8624	function (fields, decoder) {
8625		return A3($elm$core$List$foldr, $elm$json$Json$Decode$field, decoder, fields);
8626	});
8627var $elm$json$Json$Decode$string = _Json_decodeString;
8628var $elm$html$Html$Events$targetValue = A2(
8629	$elm$json$Json$Decode$at,
8630	_List_fromArray(
8631		['target', 'value']),
8632	$elm$json$Json$Decode$string);
8633var $elm$html$Html$Events$onInput = function (tagger) {
8634	return A2(
8635		$elm$html$Html$Events$stopPropagationOn,
8636		'input',
8637		A2(
8638			$elm$json$Json$Decode$map,
8639			$elm$html$Html$Events$alwaysStop,
8640			A2($elm$json$Json$Decode$map, tagger, $elm$html$Html$Events$targetValue)));
8641};
8642var $elm$html$Html$p = _VirtualDom_node('p');
8643var $elm$virtual_dom$VirtualDom$MayPreventDefault = function (a) {
8644	return {$: 2, a: a};
8645};
8646var $elm$html$Html$Events$preventDefaultOn = F2(
8647	function (event, decoder) {
8648		return A2(
8649			$elm$virtual_dom$VirtualDom$on,
8650			event,
8651			$elm$virtual_dom$VirtualDom$MayPreventDefault(decoder));
8652	});
8653var $elm$html$Html$Attributes$step = function (n) {
8654	return A2($elm$html$Html$Attributes$stringProperty, 'step', n);
8655};
8656var $elm$html$Html$strong = _VirtualDom_node('strong');
8657var $elm$virtual_dom$VirtualDom$style = _VirtualDom_style;
8658var $elm$html$Html$Attributes$style = $elm$virtual_dom$VirtualDom$style;
8659var $elm$html$Html$Attributes$target = $elm$html$Html$Attributes$stringProperty('target');
8660var $elm$virtual_dom$VirtualDom$text = _VirtualDom_text;
8661var $elm$html$Html$text = $elm$virtual_dom$VirtualDom$text;
8662var $elm$core$String$toFloat = _String_toFloat;
8663var $elm$html$Html$Attributes$type_ = $elm$html$Html$Attributes$stringProperty('type');
8664var $elm$html$Html$ul = _VirtualDom_node('ul');
8665var $elm$html$Html$Attributes$value = $elm$html$Html$Attributes$stringProperty('value');
8666var $author$project$Main$viewGameComplete = function (model) {
8667	return A2(
8668		$elm$html$Html$div,
8669		_List_fromArray(
8670			[
8671				A2($elm$html$Html$Attributes$style, 'position', 'absolute'),
8672				A2($elm$html$Html$Attributes$style, 'top', '100px'),
8673				A2($elm$html$Html$Attributes$style, 'left', '200px'),
8674				A2($elm$html$Html$Attributes$style, 'font-size', '30px'),
8675				A2($elm$html$Html$Attributes$style, 'font-weight', 'bold'),
8676				A2($elm$html$Html$Attributes$style, 'pointer-events', 'auto')
8677			]),
8678		_List_fromArray(
8679			[
8680				$elm$html$Html$text('CONGRATULATIONS!'),
8681				A2(
8682				$elm$html$Html$div,
8683				_List_fromArray(
8684					[
8685						A2($elm$html$Html$Attributes$style, 'font-size', '16px'),
8686						A2($elm$html$Html$Attributes$style, 'margin-top', '20px')
8687					]),
8688				_List_fromArray(
8689					[
8690						$elm$html$Html$text('You completed all levels!')
8691					]))
8692			]));
8693};
8694var $author$project$Main$viewLevelComplete = function (model) {
8695	return A2(
8696		$elm$html$Html$div,
8697		_List_fromArray(
8698			[
8699				A2($elm$html$Html$Attributes$style, 'position', 'absolute'),
8700				A2($elm$html$Html$Attributes$style, 'top', '100px'),
8701				A2($elm$html$Html$Attributes$style, 'left', '200px'),
8702				A2($elm$html$Html$Attributes$style, 'font-size', '30px'),
8703				A2($elm$html$Html$Attributes$style, 'font-weight', 'bold'),
8704				A2($elm$html$Html$Attributes$style, 'pointer-events', 'auto')
8705			]),
8706		_List_fromArray(
8707			[
8708				$elm$html$Html$text('LEVEL PASSED!')
8709			]));
8710};
8711var $author$project$Main$viewLevelFailed = function (model) {
8712	return A2(
8713		$elm$html$Html$div,
8714		_List_fromArray(
8715			[
8716				A2($elm$html$Html$Attributes$style, 'position', 'absolute'),
8717				A2($elm$html$Html$Attributes$style, 'top', '100px'),
8718				A2($elm$html$Html$Attributes$style, 'left', '200px'),
8719				A2($elm$html$Html$Attributes$style, 'font-size', '30px'),
8720				A2($elm$html$Html$Attributes$style, 'font-weight', 'bold'),
8721				A2($elm$html$Html$Attributes$style, 'pointer-events', 'auto')
8722			]),
8723		_List_fromArray(
8724			[
8725				$elm$html$Html$text('LEVEL FAILED!')
8726			]));
8727};
8728var $author$project$Main$levelInfoStrings = $elm$core$Array$fromList(
8729	_List_fromArray(
8730		['Bring the gold home!', 'Rocks are impenetrable.', 'Use arrow keys to scroll.', 'Slime explodes on contact!', 'Wide level!', 'Timekiller!', 'Bonus level!']));
8731var $author$project$Main$levelNames = $elm$core$Array$fromList(
8732	_List_fromArray(
8733		['Level 1: Miners4k', 'Level 2: Rocks', 'Level 3: Descent', 'Level 4: Slime', 'Level 5: Massive', 'Level 6: Riiiight', 'You won!']));
8734var $author$project$Main$viewLevelIntro = function (model) {
8735	var levelName = A2(
8736		$elm$core$Maybe$withDefault,
8737		'Unknown Level',
8738		A2($elm$core$Array$get, model.q, $author$project$Main$levelNames));
8739	var levelInfo = A2(
8740		$elm$core$Maybe$withDefault,
8741		'',
8742		A2($elm$core$Array$get, model.q, $author$project$Main$levelInfoStrings));
8743	return A2(
8744		$elm$html$Html$div,
8745		_List_fromArray(
8746			[
8747				A2($elm$html$Html$Attributes$style, 'position', 'absolute'),
8748				A2($elm$html$Html$Attributes$style, 'top', '100px'),
8749				A2($elm$html$Html$Attributes$style, 'left', '200px'),
8750				A2($elm$html$Html$Attributes$style, 'pointer-events', 'auto')
8751			]),
8752		_List_fromArray(
8753			[
8754				A2(
8755				$elm$html$Html$div,
8756				_List_fromArray(
8757					[
8758						A2($elm$html$Html$Attributes$style, 'font-size', '30px'),
8759						A2($elm$html$Html$Attributes$style, 'font-weight', 'bold'),
8760						A2($elm$html$Html$Attributes$style, 'margin-bottom', '16px')
8761					]),
8762				_List_fromArray(
8763					[
8764						$elm$html$Html$text(levelName)
8765					])),
8766				A2(
8767				$elm$html$Html$div,
8768				_List_fromArray(
8769					[
8770						A2($elm$html$Html$Attributes$style, 'font-size', '12px'),
8771						A2($elm$html$Html$Attributes$style, 'margin-bottom', '16px')
8772					]),
8773				_List_fromArray(
8774					[
8775						$elm$html$Html$text(levelInfo)
8776					])),
8777				A2(
8778				$elm$html$Html$div,
8779				_List_fromArray(
8780					[
8781						A2($elm$html$Html$Attributes$style, 'font-size', '12px')
8782					]),
8783				_List_fromArray(
8784					[
8785						$elm$html$Html$text('(click to start)')
8786					]))
8787			]));
8788};
8789var $author$project$Main$viewPlayingUI = F3(
8790	function (model, timeLeft, portalTimeRemaining) {
8791		return A2(
8792			$elm$html$Html$div,
8793			_List_Nil,
8794			_List_fromArray(
8795				[
8796					A2(
8797					$elm$html$Html$div,
8798					_List_fromArray(
8799						[
8800							A2($elm$html$Html$Attributes$style, 'position', 'absolute'),
8801							A2($elm$html$Html$Attributes$style, 'top', '10px'),
8802							A2($elm$html$Html$Attributes$style, 'left', '10px'),
8803							A2($elm$html$Html$Attributes$style, 'background', 'rgba(0,0,0,0.7)'),
8804							A2($elm$html$Html$Attributes$style, 'padding', '5px'),
8805							A2($elm$html$Html$Attributes$style, 'font-size', '12px')
8806						]),
8807					_List_fromArray(
8808						[
8809							A2(
8810							$elm$html$Html$div,
8811							_List_Nil,
8812							_List_fromArray(
8813								[
8814									$elm$html$Html$text(
8815									'Miners: ' + $elm$core$String$fromInt(model.Q))
8816								])),
8817							A2(
8818							$elm$html$Html$div,
8819							_List_Nil,
8820							_List_fromArray(
8821								[
8822									$elm$html$Html$text(
8823									'Gold: ' + ($elm$core$String$fromInt(model.e) + (' / ' + $elm$core$String$fromInt(model.aw))))
8824								])),
8825							A2(
8826							$elm$html$Html$div,
8827							_List_Nil,
8828							_List_fromArray(
8829								[
8830									$elm$html$Html$text(
8831									'Time left: ' + $elm$core$String$fromInt(timeLeft))
8832								]))
8833						])),
8834					A2(
8835					$elm$html$Html$div,
8836					_List_fromArray(
8837						[
8838							A2($elm$html$Html$Attributes$style, 'position', 'absolute'),
8839							A2($elm$html$Html$Attributes$style, 'top', '10px'),
8840							A2($elm$html$Html$Attributes$style, 'right', '10px'),
8841							A2($elm$html$Html$Attributes$style, 'background', 'rgba(0,0,0,0.7)'),
8842							A2($elm$html$Html$Attributes$style, 'padding', '5px'),
8843							A2($elm$html$Html$Attributes$style, 'font-size', '12px'),
8844							A2($elm$html$Html$Attributes$style, 'text-align', 'right')
8845						]),
8846					_List_fromArray(
8847						[
8848							function () {
8849							var _v0 = model.t;
8850							if ((!_v0.$) && (!_v0.a.b.$)) {
8851								var _v1 = _v0.a;
8852								var timerColor = (model.E <= 5) ? '#FF0000' : '#FFFF00';
8853								return A2(
8854									$elm$html$Html$div,
8855									_List_fromArray(
8856										[
8857											A2($elm$html$Html$Attributes$style, 'color', timerColor)
8858										]),
8859									_List_fromArray(
8860										[
8861											$elm$html$Html$text(
8862											'Portals expire in: ' + ($elm$core$String$fromInt(model.E) + 's'))
8863										]));
8864							} else {
8865								return (model.e >= 20) ? A2(
8866									$elm$html$Html$div,
8867									_List_fromArray(
8868										[
8869											A2($elm$html$Html$Attributes$style, 'color', '#00FF00')
8870										]),
8871									_List_fromArray(
8872										[
8873											$elm$html$Html$text(
8874											model.A ? 'Click to place portal!' : 'Press P for Portals (20 gold)')
8875										])) : A2(
8876									$elm$html$Html$div,
8877									_List_fromArray(
8878										[
8879											A2($elm$html$Html$Attributes$style, 'color', '#666666')
8880										]),
8881									_List_fromArray(
8882										[
8883											$elm$html$Html$text(
8884											'Portals: ' + ($elm$core$String$fromInt(model.e) + '/20 gold'))
8885										]));
8886							}
8887						}(),
8888							model.I ? A2(
8889							$elm$html$Html$div,
8890							_List_fromArray(
8891								[
8892									A2($elm$html$Html$Attributes$style, 'color', 'red')
8893								]),
8894							_List_fromArray(
8895								[
8896									$elm$html$Html$text('Time stop (paused)')
8897								])) : ((model.e >= 80) ? A2(
8898							$elm$html$Html$div,
8899							_List_fromArray(
8900								[
8901									A2($elm$html$Html$Attributes$style, 'color', '#00FF00')
8902								]),
8903							_List_fromArray(
8904								[
8905									$elm$html$Html$text('Press <space> for time stop (80 gold)')
8906								])) : A2(
8907							$elm$html$Html$div,
8908							_List_fromArray(
8909								[
8910									A2($elm$html$Html$Attributes$style, 'color', '#666666')
8911								]),
8912							_List_fromArray(
8913								[
8914									$elm$html$Html$text(
8915									'Time stop: ' + ($elm$core$String$fromInt(model.e) + '/80 gold'))
8916								])))
8917						]))
8918				]));
8919	});
8920var $author$project$Main$viewGameUI = function (model) {
8921	var portalTimeRemaining = model.E;
8922	var levelConfig = $author$project$Main$getLevelConfig(model.q);
8923	var timeLeft = function () {
8924		if (!model.z) {
8925			return levelConfig.P;
8926		} else {
8927			var elapsed = ((model.U - model.z) / 1000) | 0;
8928			return A2($elm$core$Basics$max, 0, levelConfig.P - elapsed);
8929		}
8930	}();
8931	return A2(
8932		$elm$html$Html$div,
8933		_List_fromArray(
8934			[
8935				A2($elm$html$Html$Attributes$style, 'position', 'absolute'),
8936				A2($elm$html$Html$Attributes$style, 'top', '0'),
8937				A2($elm$html$Html$Attributes$style, 'left', '0'),
8938				A2($elm$html$Html$Attributes$style, 'width', '100%'),
8939				A2($elm$html$Html$Attributes$style, 'height', '100%'),
8940				A2($elm$html$Html$Attributes$style, 'pointer-events', 'none'),
8941				A2($elm$html$Html$Attributes$style, 'color', 'white'),
8942				A2($elm$html$Html$Attributes$style, 'font-family', 'Arial, sans-serif')
8943			]),
8944		_List_fromArray(
8945			[
8946				function () {
8947				var _v0 = model.o;
8948				switch (_v0) {
8949					case 0:
8950						return $author$project$Main$viewLevelIntro(model);
8951					case 1:
8952						return A3($author$project$Main$viewPlayingUI, model, timeLeft, portalTimeRemaining);
8953					case 2:
8954						return $author$project$Main$viewLevelComplete(model);
8955					case 3:
8956						return $author$project$Main$viewLevelFailed(model);
8957					default:
8958						return $author$project$Main$viewGameComplete(model);
8959				}
8960			}()
8961			]));
8962};
8963var $elm$html$Html$Attributes$width = function (n) {
8964	return A2(
8965		_VirtualDom_attribute,
8966		'width',
8967		$elm$core$String$fromInt(n));
8968};
8969var $author$project$Main$view = function (model) {
8970	return A2(
8971		$elm$html$Html$div,
8972		_List_fromArray(
8973			[
8974				A2($elm$html$Html$Attributes$style, 'margin', '0'),
8975				A2($elm$html$Html$Attributes$style, 'padding', '20px'),
8976				A2($elm$html$Html$Attributes$style, 'background-color', '#1a1a1a'),
8977				A2($elm$html$Html$Attributes$style, 'color', '#ffffff'),
8978				A2($elm$html$Html$Attributes$style, 'font-family', 'Arial, sans-serif'),
8979				A2($elm$html$Html$Attributes$style, 'display', 'flex'),
8980				A2($elm$html$Html$Attributes$style, 'justify-content', 'center'),
8981				A2($elm$html$Html$Attributes$style, 'min-height', '100vh')
8982			]),
8983		_List_fromArray(
8984			[
8985				A2(
8986				$elm$html$Html$div,
8987				_List_fromArray(
8988					[
8989						A2($elm$html$Html$Attributes$style, 'display', 'flex'),
8990						A2($elm$html$Html$Attributes$style, 'gap', '20px'),
8991						A2($elm$html$Html$Attributes$style, 'align-items', 'flex-start'),
8992						A2($elm$html$Html$Attributes$style, 'max-width', '1200px')
8993					]),
8994				_List_fromArray(
8995					[
8996						A2(
8997						$elm$html$Html$div,
8998						_List_fromArray(
8999							[
9000								A2($elm$html$Html$Attributes$style, 'width', '250px'),
9001								A2($elm$html$Html$Attributes$style, 'padding', '20px'),
9002								A2($elm$html$Html$Attributes$style, 'background-color', '#2a2a2a'),
9003								A2($elm$html$Html$Attributes$style, 'border-radius', '8px'),
9004								A2($elm$html$Html$Attributes$style, 'line-height', '1.5'),
9005								A2($elm$html$Html$Attributes$style, 'font-size', '14px'),
9006								A2($elm$html$Html$Attributes$style, 'color', '#cccccc')
9007							]),
9008						_List_fromArray(
9009							[
9010								A2(
9011								$elm$html$Html$p,
9012								_List_Nil,
9013								_List_fromArray(
9014									[
9015										$elm$html$Html$text('A demo recreation of '),
9016										A2(
9017										$elm$html$Html$a,
9018										_List_fromArray(
9019											[
9020												$elm$html$Html$Attributes$href('https://x.com/notch'),
9021												$elm$html$Html$Attributes$target('_blank'),
9022												A2($elm$html$Html$Attributes$style, 'color', '#4a9eff'),
9023												A2($elm$html$Html$Attributes$style, 'text-decoration', 'none')
9024											]),
9025										_List_fromArray(
9026											[
9027												$elm$html$Html$text('@notch')
9028											])),
9029										$elm$html$Html$text('\'s amazing '),
9030										A2(
9031										$elm$html$Html$strong,
9032										_List_Nil,
9033										_List_fromArray(
9034											[
9035												$elm$html$Html$text('Miners4K')
9036											])),
9037										$elm$html$Html$text(' ('),
9038										A2(
9039										$elm$html$Html$a,
9040										_List_fromArray(
9041											[
9042												$elm$html$Html$Attributes$href('https://jvm-gaming.org/t/miners4k/25427'),
9043												$elm$html$Html$Attributes$target('_blank'),
9044												A2($elm$html$Html$Attributes$style, 'color', '#4a9eff'),
9045												A2($elm$html$Html$Attributes$style, 'text-decoration', 'none')
9046											]),
9047										_List_fromArray(
9048											[
9049												$elm$html$Html$text('2005')
9050											])),
9051										$elm$html$Html$text(') in '),
9052										A2(
9053										$elm$html$Html$a,
9054										_List_fromArray(
9055											[
9056												$elm$html$Html$Attributes$href('https://elm-lang.org/'),
9057												$elm$html$Html$Attributes$target('_blank'),
9058												A2($elm$html$Html$Attributes$style, 'color', '#4a9eff'),
9059												A2($elm$html$Html$Attributes$style, 'text-decoration', 'none')
9060											]),
9061										_List_fromArray(
9062											[
9063												$elm$html$Html$text('Elm')
9064											])),
9065										$elm$html$Html$text('! Such clever game design packed into 4KB. Full credit to the original. Just wanted to preserve this gem in a modern browser format 🎮')
9066									])),
9067								A2(
9068								$elm$html$Html$p,
9069								_List_Nil,
9070								_List_fromArray(
9071									[
9072										$elm$html$Html$text('I added Portals 🌀 and Time Stop ⏳ mechanics!')
9073									])),
9074								A2(
9075								$elm$html$Html$p,
9076								_List_Nil,
9077								_List_fromArray(
9078									[
9079										$elm$html$Html$text('An agentic coding experiment using '),
9080										A2(
9081										$elm$html$Html$a,
9082										_List_fromArray(
9083											[
9084												$elm$html$Html$Attributes$href('https://ampcode.com'),
9085												$elm$html$Html$Attributes$target('_blank'),
9086												A2($elm$html$Html$Attributes$style, 'color', '#4a9eff'),
9087												A2($elm$html$Html$Attributes$style, 'text-decoration', 'none')
9088											]),
9089										_List_fromArray(
9090											[
9091												$elm$html$Html$text('Amp')
9092											])),
9093										$elm$html$Html$text('.')
9094									])),
9095								A2(
9096								$elm$html$Html$p,
9097								_List_Nil,
9098								_List_fromArray(
9099									[
9100										$elm$html$Html$text('- '),
9101										A2(
9102										$elm$html$Html$a,
9103										_List_fromArray(
9104											[
9105												$elm$html$Html$Attributes$href('https://x.com/rvtond'),
9106												$elm$html$Html$Attributes$target('_blank'),
9107												A2($elm$html$Html$Attributes$style, 'color', '#4a9eff'),
9108												A2($elm$html$Html$Attributes$style, 'text-decoration', 'none')
9109											]),
9110										_List_fromArray(
9111											[
9112												$elm$html$Html$text('@rvtond')
9113											]))
9114									])),
9115								A2(
9116								$elm$html$Html$p,
9117								_List_Nil,
9118								_List_fromArray(
9119									[
9120										A2(
9121										$elm$html$Html$a,
9122										_List_fromArray(
9123											[
9124												$elm$html$Html$Attributes$href('https://github.com/rvantonder/Miners4k-elm'),
9125												$elm$html$Html$Attributes$target('_blank'),
9126												A2($elm$html$Html$Attributes$style, 'color', '#4a9eff'),
9127												A2($elm$html$Html$Attributes$style, 'text-decoration', 'none')
9128											]),
9129										_List_fromArray(
9130											[
9131												$elm$html$Html$text('🌐 GitHub')
9132											]))
9133									])),
9134								A2(
9135								$elm$html$Html$div,
9136								_List_fromArray(
9137									[
9138										A2($elm$html$Html$Attributes$style, 'margin-top', '16px'),
9139										A2($elm$html$Html$Attributes$style, 'padding-top', '16px'),
9140										A2($elm$html$Html$Attributes$style, 'border-top', '1px solid #444')
9141									]),
9142								_List_fromArray(
9143									[
9144										A2(
9145										$elm$html$Html$div,
9146										_List_fromArray(
9147											[
9148												A2($elm$html$Html$Attributes$style, 'cursor', 'pointer'),
9149												A2($elm$html$Html$Attributes$style, 'margin-bottom', '8px'),
9150												A2($elm$html$Html$Attributes$style, 'font-weight', 'bold'),
9151												A2($elm$html$Html$Attributes$style, 'color', '#ffffff'),
9152												A2($elm$html$Html$Attributes$style, 'display', 'flex'),
9153												A2($elm$html$Html$Attributes$style, 'align-items', 'center'),
9154												A2($elm$html$Html$Attributes$style, 'gap', '8px'),
9155												$elm$html$Html$Events$onClick($author$project$Main$ToggleConfigPanel)
9156											]),
9157										_List_fromArray(
9158											[
9159												$elm$html$Html$text(
9160												model.ar ? '▼ ' : '▶ '),
9161												$elm$html$Html$text('Config / Cheats')
9162											])),
9163										model.ar ? A2(
9164										$elm$html$Html$div,
9165										_List_fromArray(
9166											[
9167												A2($elm$html$Html$Attributes$style, 'margin-top', '12px'),
9168												A2($elm$html$Html$Attributes$style, 'padding', '12px'),
9169												A2($elm$html$Html$Attributes$style, 'background-color', '#1e1e1e'),
9170												A2($elm$html$Html$Attributes$style, 'border-radius', '4px'),
9171												A2($elm$html$Html$Attributes$style, 'border', '1px solid #444')
9172											]),
9173										_List_fromArray(
9174											[
9175												A2(
9176												$elm$html$Html$div,
9177												_List_fromArray(
9178													[
9179														A2($elm$html$Html$Attributes$style, 'margin-bottom', '16px')
9180													]),
9181												_List_fromArray(
9182													[
9183														A2(
9184														$elm$html$Html$div,
9185														_List_fromArray(
9186															[
9187																A2($elm$html$Html$Attributes$style, 'margin-bottom', '4px'),
9188																A2($elm$html$Html$Attributes$style, 'font-size', '12px'),
9189																A2($elm$html$Html$Attributes$style, 'color', '#aaa')
9190															]),
9191														_List_fromArray(
9192															[
9193																$elm$html$Html$text(
9194																'Game Speed: ' + ($elm$core$String$fromFloat(
9195																	function (x) {
9196																		return x / 10;
9197																	}(
9198																		$elm$core$Basics$round(model.ah * 10))) + 'x'))
9199															])),
9200														A2(
9201														$elm$html$Html$input,
9202														_List_fromArray(
9203															[
9204																$elm$html$Html$Attributes$type_('range'),
9205																$elm$html$Html$Attributes$min('0.1'),
9206																$elm$html$Html$Attributes$max('5.0'),
9207																$elm$html$Html$Attributes$step('0.1'),
9208																$elm$html$Html$Attributes$value(
9209																$elm$core$String$fromFloat(model.ah)),
9210																A2($elm$html$Html$Attributes$style, 'width', '100%'),
9211																$elm$html$Html$Events$onInput(
9212																function (s) {
9213																	return $author$project$Main$SetGameSpeed(
9214																		A2(
9215																			$elm$core$Maybe$withDefault,
9216																			1.0,
9217																			$elm$core$String$toFloat(s)));
9218																})
9219															]),
9220														_List_Nil)
9221													])),
9222												A2(
9223												$elm$html$Html$div,
9224												_List_fromArray(
9225													[
9226														A2($elm$html$Html$Attributes$style, 'margin-bottom', '12px')
9227													]),
9228												_List_fromArray(
9229													[
9230														A2(
9231														$elm$html$Html$label,
9232														_List_fromArray(
9233															[
9234																A2($elm$html$Html$Attributes$style, 'display', 'block'),
9235																A2($elm$html$Html$Attributes$style, 'font-size', '12px'),
9236																A2($elm$html$Html$Attributes$style, 'color', '#aaa'),
9237																A2($elm$html$Html$Attributes$style, 'margin-bottom', '4px')
9238															]),
9239														_List_fromArray(
9240															[
9241																$elm$html$Html$text('Starting Time (seconds)')
9242															])),
9243														A2(
9244														$elm$html$Html$input,
9245														_List_fromArray(
9246															[
9247																$elm$html$Html$Attributes$type_('number'),
9248																$elm$html$Html$Attributes$min('0'),
9249																$elm$html$Html$Attributes$max('3600'),
9250																$elm$html$Html$Attributes$value(
9251																$elm$core$String$fromInt(model.as)),
9252																A2($elm$html$Html$Attributes$style, 'width', '100%'),
9253																A2($elm$html$Html$Attributes$style, 'padding', '4px'),
9254																A2($elm$html$Html$Attributes$style, 'background-color', '#333'),
9255																A2($elm$html$Html$Attributes$style, 'border', '1px solid #555'),
9256																A2($elm$html$Html$Attributes$style, 'color', '#fff'),
9257																A2($elm$html$Html$Attributes$style, 'border-radius', '3px'),
9258																$elm$html$Html$Events$onInput(
9259																function (s) {
9260																	return $author$project$Main$SetConfigStartingTime(
9261																		A2(
9262																			$elm$core$Maybe$withDefault,
9263																			180,
9264																			$elm$core$String$toInt(s)));
9265																})
9266															]),
9267														_List_Nil)
9268													])),
9269												A2(
9270												$elm$html$Html$div,
9271												_List_fromArray(
9272													[
9273														A2($elm$html$Html$Attributes$style, 'margin-bottom', '12px')
9274													]),
9275												_List_fromArray(
9276													[
9277														A2(
9278														$elm$html$Html$label,
9279														_List_fromArray(
9280															[
9281																A2($elm$html$Html$Attributes$style, 'display', 'block'),
9282																A2($elm$html$Html$Attributes$style, 'font-size', '12px'),
9283																A2($elm$html$Html$Attributes$style, 'color', '#aaa'),
9284																A2($elm$html$Html$Attributes$style, 'margin-bottom', '4px')
9285															]),
9286														_List_fromArray(
9287															[
9288																$elm$html$Html$text('Starting Gold')
9289															])),
9290														A2(
9291														$elm$html$Html$input,
9292														_List_fromArray(
9293															[
9294																$elm$html$Html$Attributes$type_('number'),
9295																$elm$html$Html$Attributes$min('0'),
9296																$elm$html$Html$Attributes$max('9999'),
9297																$elm$html$Html$Attributes$value(
9298																$elm$core$String$fromInt(model.ap)),
9299																A2($elm$html$Html$Attributes$style, 'width', '100%'),
9300																A2($elm$html$Html$Attributes$style, 'padding', '4px'),
9301																A2($elm$html$Html$Attributes$style, 'background-color', '#333'),
9302																A2($elm$html$Html$Attributes$style, 'border', '1px solid #555'),
9303																A2($elm$html$Html$Attributes$style, 'color', '#fff'),
9304																A2($elm$html$Html$Attributes$style, 'border-radius', '3px'),
9305																$elm$html$Html$Events$onInput(
9306																function (s) {
9307																	return $author$project$Main$SetConfigGoldValue(
9308																		A2(
9309																			$elm$core$Maybe$withDefault,
9310																			0,
9311																			$elm$core$String$toInt(s)));
9312																})
9313															]),
9314														_List_Nil)
9315													])),
9316												A2(
9317												$elm$html$Html$div,
9318												_List_fromArray(
9319													[
9320														A2($elm$html$Html$Attributes$style, 'margin-bottom', '12px')
9321													]),
9322												_List_fromArray(
9323													[
9324														A2(
9325														$elm$html$Html$label,
9326														_List_fromArray(
9327															[
9328																A2($elm$html$Html$Attributes$style, 'display', 'block'),
9329																A2($elm$html$Html$Attributes$style, 'font-size', '12px'),
9330																A2($elm$html$Html$Attributes$style, 'color', '#aaa'),
9331																A2($elm$html$Html$Attributes$style, 'margin-bottom', '4px')
9332															]),
9333														_List_fromArray(
9334															[
9335																$elm$html$Html$text('Number of Miners')
9336															])),
9337														A2(
9338														$elm$html$Html$input,
9339														_List_fromArray(
9340															[
9341																$elm$html$Html$Attributes$type_('number'),
9342																$elm$html$Html$Attributes$min('1'),
9343																$elm$html$Html$Attributes$max('50'),
9344																$elm$html$Html$Attributes$value(
9345																$elm$core$String$fromInt(model.aq)),
9346																A2($elm$html$Html$Attributes$style, 'width', '100%'),
9347																A2($elm$html$Html$Attributes$style, 'padding', '4px'),
9348																A2($elm$html$Html$Attributes$style, 'background-color', '#333'),
9349																A2($elm$html$Html$Attributes$style, 'border', '1px solid #555'),
9350																A2($elm$html$Html$Attributes$style, 'color', '#fff'),
9351																A2($elm$html$Html$Attributes$style, 'border-radius', '3px'),
9352																$elm$html$Html$Events$onInput(
9353																function (s) {
9354																	return $author$project$Main$SetConfigNumMiners(
9355																		A2(
9356																			$elm$core$Maybe$withDefault,
9357																			10,
9358																			$elm$core$String$toInt(s)));
9359																})
9360															]),
9361														_List_Nil)
9362													])),
9363												A2(
9364												$elm$html$Html$div,
9365												_List_fromArray(
9366													[
9367														A2($elm$html$Html$Attributes$style, 'margin-bottom', '0px')
9368													]),
9369												_List_fromArray(
9370													[
9371														A2(
9372														$elm$html$Html$label,
9373														_List_fromArray(
9374															[
9375																A2($elm$html$Html$Attributes$style, 'display', 'block'),
9376																A2($elm$html$Html$Attributes$style, 'font-size', '12px'),
9377																A2($elm$html$Html$Attributes$style, 'color', '#aaa'),
9378																A2($elm$html$Html$Attributes$style, 'margin-bottom', '4px')
9379															]),
9380														_List_fromArray(
9381															[
9382																$elm$html$Html$text('Level')
9383															])),
9384														A2(
9385														$elm$html$Html$input,
9386														_List_fromArray(
9387															[
9388																$elm$html$Html$Attributes$type_('number'),
9389																$elm$html$Html$Attributes$min('1'),
9390																$elm$html$Html$Attributes$max('7'),
9391																$elm$html$Html$Attributes$value(
9392																$elm$core$String$fromInt(model.af)),
9393																A2($elm$html$Html$Attributes$style, 'width', '100%'),
9394																A2($elm$html$Html$Attributes$style, 'padding', '4px'),
9395																A2($elm$html$Html$Attributes$style, 'background-color', '#333'),
9396																A2($elm$html$Html$Attributes$style, 'border', '1px solid #555'),
9397																A2($elm$html$Html$Attributes$style, 'color', '#fff'),
9398																A2($elm$html$Html$Attributes$style, 'border-radius', '3px'),
9399																$elm$html$Html$Events$onInput(
9400																function (s) {
9401																	return $author$project$Main$SetConfigLevel(
9402																		A2(
9403																			$elm$core$Maybe$withDefault,
9404																			1,
9405																			$elm$core$String$toInt(s)));
9406																})
9407															]),
9408														_List_Nil)
9409													])),
9410												A2(
9411												$elm$html$Html$div,
9412												_List_fromArray(
9413													[
9414														A2($elm$html$Html$Attributes$style, 'margin-top', '16px')
9415													]),
9416												_List_fromArray(
9417													[
9418														A2(
9419														$elm$html$Html$button,
9420														_List_fromArray(
9421															[
9422																$elm$html$Html$Events$onClick($author$project$Main$StartNewWithConfig),
9423																A2($elm$html$Html$Attributes$style, 'width', '100%'),
9424																A2($elm$html$Html$Attributes$style, 'padding', '8px'),
9425																A2($elm$html$Html$Attributes$style, 'background-color', '#4CAF50'),
9426																A2($elm$html$Html$Attributes$style, 'border', 'none'),
9427																A2($elm$html$Html$Attributes$style, 'color', 'white'),
9428																A2($elm$html$Html$Attributes$style, 'border-radius', '4px'),
9429																A2($elm$html$Html$Attributes$style, 'cursor', 'pointer'),
9430																A2($elm$html$Html$Attributes$style, 'font-size', '14px'),
9431																A2($elm$html$Html$Attributes$style, 'font-weight', 'bold')
9432															]),
9433														_List_fromArray(
9434															[
9435																$elm$html$Html$text('Start New Game')
9436															]))
9437													]))
9438											])) : $elm$html$Html$text('')
9439									]))
9440							])),
9441						A2(
9442						$elm$html$Html$div,
9443						_List_fromArray(
9444							[
9445								A2($elm$html$Html$Attributes$style, 'flex-shrink', '0'),
9446								A2($elm$html$Html$Attributes$style, 'width', '640px'),
9447								A2($elm$html$Html$Attributes$style, 'max-width', '640px'),
9448								A2($elm$html$Html$Attributes$style, 'position', 'relative')
9449							]),
9450						_List_fromArray(
9451							[
9452								A2(
9453								$elm$html$Html$canvas,
9454								_List_fromArray(
9455									[
9456										$elm$html$Html$Attributes$id('gameCanvas'),
9457										$elm$html$Html$Attributes$width($author$project$Main$gameWidth),
9458										$elm$html$Html$Attributes$height($author$project$Main$gameHeight),
9459										A2($elm$html$Html$Attributes$style, 'border', '1px solid black'),
9460										A2($elm$html$Html$Attributes$style, 'display', 'block'),
9461										A2($elm$html$Html$Attributes$style, 'image-rendering', 'pixelated'),
9462										A2($elm$html$Html$Attributes$style, 'cursor', 'none'),
9463										A2($elm$html$Html$Attributes$style, 'max-width', '100%'),
9464										A2($elm$html$Html$Attributes$style, 'height', 'auto'),
9465										A2($elm$html$Html$Events$on, 'mousemove', $author$project$Main$mouseDecoder),
9466										A2($elm$html$Html$Events$preventDefaultOn, 'mousedown', $author$project$Main$mouseDownDecoderWithPrevent),
9467										A2($elm$html$Html$Events$preventDefaultOn, 'mouseup', $author$project$Main$mouseUpDecoderWithPrevent)
9468									]),
9469								_List_Nil),
9470								$author$project$Main$viewGameUI(model)
9471							])),
9472						A2(
9473						$elm$html$Html$div,
9474						_List_fromArray(
9475							[
9476								A2($elm$html$Html$Attributes$style, 'width', '250px'),
9477								A2($elm$html$Html$Attributes$style, 'padding', '20px'),
9478								A2($elm$html$Html$Attributes$style, 'background-color', '#2a2a2a'),
9479								A2($elm$html$Html$Attributes$style, 'border-radius', '8px'),
9480								A2($elm$html$Html$Attributes$style, 'line-height', '1.5'),
9481								A2($elm$html$Html$Attributes$style, 'font-size', '14px')
9482							]),
9483						_List_fromArray(
9484							[
9485								A2(
9486								$elm$html$Html$h3,
9487								_List_fromArray(
9488									[
9489										A2($elm$html$Html$Attributes$style, 'margin-top', '0'),
9490										A2($elm$html$Html$Attributes$style, 'color', '#ffffff'),
9491										A2($elm$html$Html$Attributes$style, 'border-bottom', '1px solid #444'),
9492										A2($elm$html$Html$Attributes$style, 'padding-bottom', '8px')
9493									]),
9494								_List_fromArray(
9495									[
9496										$elm$html$Html$text('Game Controls')
9497									])),
9498								A2(
9499								$elm$html$Html$ul,
9500								_List_fromArray(
9501									[
9502										A2($elm$html$Html$Attributes$style, 'margin', '0'),
9503										A2($elm$html$Html$Attributes$style, 'padding-left', '20px')
9504									]),
9505								_List_fromArray(
9506									[
9507										A2(
9508										$elm$html$Html$li,
9509										_List_fromArray(
9510											[
9511												A2($elm$html$Html$Attributes$style, 'margin-bottom', '8px')
9512											]),
9513										_List_fromArray(
9514											[
9515												A2(
9516												$elm$html$Html$strong,
9517												_List_Nil,
9518												_List_fromArray(
9519													[
9520														$elm$html$Html$text('Left Mouse Button:')
9521													])),
9522												$elm$html$Html$text(' Drag to build dirt (7×7 brush)')
9523											])),
9524										A2(
9525										$elm$html$Html$li,
9526										_List_fromArray(
9527											[
9528												A2($elm$html$Html$Attributes$style, 'margin-bottom', '8px')
9529											]),
9530										_List_fromArray(
9531											[
9532												A2(
9533												$elm$html$Html$strong,
9534												_List_Nil,
9535												_List_fromArray(
9536													[
9537														$elm$html$Html$text('Right Mouse / Double Touch (Trackpad):')
9538													])),
9539												$elm$html$Html$text(' Drag to dig terrain')
9540											])),
9541										A2(
9542										$elm$html$Html$li,
9543										_List_fromArray(
9544											[
9545												A2($elm$html$Html$Attributes$style, 'margin-bottom', '8px')
9546											]),
9547										_List_fromArray(
9548											[
9549												A2(
9550												$elm$html$Html$strong,
9551												_List_Nil,
9552												_List_fromArray(
9553													[
9554														$elm$html$Html$text('Arrow Keys:')
9555													])),
9556												$elm$html$Html$text(' Scroll camera around level')
9557											])),
9558										A2(
9559										$elm$html$Html$li,
9560										_List_fromArray(
9561											[
9562												A2($elm$html$Html$Attributes$style, 'margin-bottom', '8px')
9563											]),
9564										_List_fromArray(
9565											[
9566												A2(
9567												$elm$html$Html$strong,
9568												_List_Nil,
9569												_List_fromArray(
9570													[
9571														$elm$html$Html$text('P Key:')
9572													])),
9573												$elm$html$Html$text(' Portal mode (costs 20 gold)')
9574											])),
9575										A2(
9576										$elm$html$Html$li,
9577										_List_fromArray(
9578											[
9579												A2($elm$html$Html$Attributes$style, 'margin-bottom', '8px')
9580											]),
9581										_List_fromArray(
9582											[
9583												A2(
9584												$elm$html$Html$strong,
9585												_List_Nil,
9586												_List_fromArray(
9587													[
9588														$elm$html$Html$text('Space Key:')
9589													])),
9590												$elm$html$Html$text(' Time stop (costs 80 gold, digging still works)')
9591											]))
9592									])),
9593								A2(
9594								$elm$html$Html$h3,
9595								_List_fromArray(
9596									[
9597										A2($elm$html$Html$Attributes$style, 'margin-top', '0'),
9598										A2($elm$html$Html$Attributes$style, 'color', '#ffffff'),
9599										A2($elm$html$Html$Attributes$style, 'border-bottom', '1px solid #444'),
9600										A2($elm$html$Html$Attributes$style, 'padding-bottom', '8px')
9601									]),
9602								_List_fromArray(
9603									[
9604										$elm$html$Html$text('Objective')
9605									])),
9606								A2(
9607								$elm$html$Html$p,
9608								_List_Nil,
9609								_List_fromArray(
9610									[
9611										$elm$html$Html$text('Help miners collect gold and deliver it to the gray platforms. Levels are '),
9612										A2(
9613										$elm$html$Html$strong,
9614										_List_Nil,
9615										_List_fromArray(
9616											[
9617												A2(
9618												$elm$html$Html$i,
9619												_List_Nil,
9620												_List_fromArray(
9621													[
9622														$elm$html$Html$text('incomplete')
9623													]))
9624											])),
9625										$elm$html$Html$text('. Demo works well for first 2 levels.')
9626									]))
9627							]))
9628					]))
9629			]));
9630};
9631var $author$project$Main$main = $elm$browser$Browser$application(
9632	{
9633		bR: $author$project$Main$init,
9634		bY: $author$project$Main$UrlChanged,
9635		bZ: $author$project$Main$LinkClicked,
9636		b5: $author$project$Main$subscriptions,
9637		b8: $author$project$Main$update,
9638		b9: function (model) {
9639			return {
9640				bE: _List_fromArray(
9641					[
9642						$author$project$Main$view(model)
9643					]),
9644				b7: 'Miners4k Elm - Level ' + $elm$core$String$fromInt(model.q 
9644+ 1)
9645			};
9646		}
9647	});
9648_Platform_export({'Main':{'init':$author$project$Main$main(
9649	$elm$json$Json$Decode$succeed(0))(0)}});}(this));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.