/
game.jsc.min.js
215 lines (215 loc) · 41.5 KB
/
game.jsc.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
/*
MIT
@copyright notrubp@gmail.com 2015
*/
(function(g){function f(a){for(var c=0;c<a.length;c++){var b=a[c].string,d=a[c].prop;e=a[c].versionSearch||a[c].identity;if(b){if(-1!=b.indexOf(a[c].substring))return a[c].identity}else if(d)return a[c].identity}}function d(a){var b=a.indexOf(e);if(-1!=b)return parseFloat(a.substring(b+e.length+1))}var a={},b=[{string:navigator.userAgent,substring:"Windows Phone",identity:"windowsphone"},{string:navigator.platform,substring:"Win",identity:"windows"},{string:navigator.platform,substring:"Mac",identity:"mac",
versionSearch:"X"},{string:navigator.userAgent,substring:"iPhone",identity:"iphone"},{string:navigator.userAgent,substring:"iPod",identity:"ipod"},{string:navigator.userAgent,substring:"iPad",identity:"ipad"},{string:navigator.userAgent,substring:"Android",identity:"android"},{string:navigator.platform,substring:"Linux",identity:"linux"}],e;a.browser=f([{string:navigator.userAgent,substring:"Chrome",versionSearch:"Chrome",identity:"chrome"},{string:navigator.userAgent,substring:"OmniWeb",identity:"omniweb",
versionSearch:"OmniWeb/"},{string:navigator.userAgent,substring:"Android",identity:"safari",versionSearch:"Version"},{string:navigator.vendor,substring:"Apple",identity:"safari",versionSearch:"Version"},{prop:window.opera,identity:"opera",versionSearch:"Version"},{string:navigator.vendor,substring:"iCab",identity:"icab",versionSearch:"iCab"},{string:navigator.vendor,substring:"KDE",identity:"konqueror",versionSearch:"Konqueror"},{string:navigator.userAgent,substring:"Firefox",identity:"firefox",versionSearch:"Firefox"},
{string:navigator.vendor,substring:"Camino",identity:"camino",versionSearch:"Camino"},{string:navigator.userAgent,substring:"Netscape",identity:"netscape",versionSearch:"netscape"},{string:navigator.userAgent,substring:"MSIE",identity:"explorer",versionSearch:"MSIE"},{string:navigator.userAgent,substring:"Trident/7.0",identity:"explorer11",versionSearch:"rv"},{string:navigator.userAgent,substring:"Gecko",identity:"mozilla",versionSearch:"rv"},{string:navigator.userAgent,substring:"Mozilla",identity:"netscape",
versionSearch:"Mozilla"}])||"unknown";a.version=d(navigator.userAgent)||d(navigator.appVersion)||0;a.os=f(b)||"unknown";a.osVersion=""+(d(navigator.userAgent)||d(navigator.appVersion)||0);a.isChrome="chrome"===a.browser;a.isOmniweb="omniweb"===a.browser;a.isSafari="safari"===a.browser;a.isOpera="opera"===a.browser;a.isiCab="icab"===a.browser;a.isKonqueror="konqueror"===a.browser;a.isFirefox="firefox"===a.browser;a.isCamino="camino"===a.browser;a.isNetscape="netscape"===a.browser;a.isExplorer="explorer"===
a.browser;a.isExplorer9=a.isExplorer&&9===a.version;a.isExplorer10=a.isExplorer&&10===a.version;a.isExplorer11="explorer11"===a.browser;a.isMozilla="mozilla"===a.browser;a.isGecko=a.isFirefox||a.isMozilla||a.isKonqueror;a.isTrident=a.isExplorer;a.isWebKit=a.isSafari||a.isChrome||a.isOmniweb||a.isOpera||a.isCamino;a.isWindows="windows"===a.os;a.isMac="mac"===a.os;a.isiPod="ipod"==a.os;a.isiPhone="iphone"===a.os;a.isiPad="ipad"===a.os;a.isLinux="linux"===a.os;a.isAndroid="android"===a.os;a.isWindowsPhone=
"windowsphone"===a.os;a.isiOS=a.isIpod||a.isIphone||a.isIpad;a.isiOS5=!1;a.isiOS6=!1;a.isiOS7=!1;a.isiOS8=!1;b=function(){var a=navigator.userAgent,b=a.indexOf("Android");return-1!=b?parseFloat(a.substring(b+7)):0}();a.isAndroid15=4.4<=b&&4.4>b;a.isAndroid16=4.4<=b&&4.4>b;a.isAndroid17=4.4<=b&&4.4>b;a.isAndroid18=4.4<=b&&4.4>b;a.isAndroid19=4.4<=b&&4.4>b;a.isAndroid20=5<=b;a.isTouch="ontouchstart"in window||"onmsgesturechange"in window;a.isDesktop=a.isWindows||a.isMac||a.isLinux;a.isMobile=a.isiOS||
a.isAndroid||a.isWindowsphone;g.Platform=a})(window);
/*
MIT
@copyright notrubp@gmail.com 2015
*/
(function(b){var a=function(a,c){this.first=a;this.second=c};a.make=function(b,c){return new a(b,c)};b.Pair=a})(window);
/*
MIT
@copyright notrubp@gmail.com 2015
*/
(function(e){var d={makeDaisyChain:function(b,a){return function(){return a.apply(new b,arguments)}},inherit:function(b,a){a.prototype=Object.create(b.prototype);a.prototype.constructor=a},merge:function(b,a){for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b},extend:function(b,a){return d.merge(b.prototype,a)}};e.Util=d})(window);
/*
MIT
@copyright notrubp@gmail.com 2015
*/
(function(a){a.Time={now:function(){return(new Date).getTime()}}})(window);
/*
MIT
@copyright notrubp@gmail.com 2015
*/
(function(a){a.Random={ratio:function(){return Math.random()},number:function(){return Math.floor(4294967296*Math.random())-2147483648},range:function(a){return Math.floor(Math.random()*a)}}})(window);
/*
MIT
@copyright notrubp@gmail.com 2015
*/
(function(d){function c(e,a,c){if(-1!=b.indexOf(a))return e.call(this,"["+a+"]: "+c)}var a={},b=[];a.info=c.bind(console,console.info);a.debug=c.bind(console,console.debug);a.warn=c.bind(console,console.warn);a.error=c.bind(console,console.error);a.Tags={};a.Tags.enable=function(a){-1==b.indexOf(a)&&b.push(a)};a.Tags.disable=function(a){a=b.indexOf(a);-1!=a&&b.splice(a,1)};a.Tags.enabled=function(a){return-1!=b.indexOf(a)};a.Tags.disableAll=function(){b=[]};d.Log=a})(window);
/*
MIT
@copyright notrubp@gmail.com 2015
*/
(function(d){function g(a,c,b){a=e.range(f.length);return f[19==c?a&3|8:a&15]}var e=d.Random,b={},f="0123456789abcdef";b.rfc4122=function(){return"00000000-0000-4000-0000-000000000000".replace(/0/g,g)};b.letters=function(a){a=a||36;for(var c="",b=0;b<a;++b)var d=e.range(26),c=c+"abcdefghijklmnopqrstuvwxyz"[d];return c};d.Uuid=b})(window);
/*
MIT
@copyright notrubp@gmail.com 2015
*/
(function(g){for(var d={deferred:function(c){return setTimeout(c,0)},at:function(c,e){return setTimeout(e,c)},interval:function(c,e){var a=setInterval(e,c);return{cancel:function(){clearInterval(a)}}}},b=["ms","moz","webkit","o"],a=0;a<b.length&&!window.requestAnimationFrame;++a)window.requestAnimationFrame=window[b[a]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[b[a]+"CancelAnimationFrame"]||window[b[a]+"CancelRequestAnimationFrame"];var f=0;window.polyfillRequestAnimationFrame=function(c){var a=
(new Date).getTime(),b=Math.max(0,16-(a-f)),d=setTimeout(function(){c(a+b)},b);f=a+b;return d};window.polyfillCancelAnimationFrame=function(a){clearTimeout(a)};window.isPolyfillRequestAnimationFrame=!window.requestAnimationFrame;window.isPolyfillRequestAnimationFrame&&(window.requestAnimationFrame=window.polyfillRequestAnimationFrame,window.cancelAnimationFrame=window.polyfillCancelAnimationFrame);d.raf=function(a){return window.requestAnimationFrame(a)};g.Scheduler=d})(window);
/*
MIT
@copyright notrubp@gmail.com 2015
*/
(function(b){var c=b.Log,d=b.Scheduler;b.Exception={handle:function(a){c.error("exception",a.hasOwnProperty("stack")?a.stack:a)},deferred:function(a){d.deferred(this.handle.bind(this,a))}}})(window);
/*
MIT
@copyright notrubp@gmail.com 2015
*/
(function(c){var b=c.Util,g=c.Scheduler,a=function(){this.clear()};a.prototype.append=function(a){this.links.push(a);return this};a.prototype.success=function(a){this.successCallbacks.push(a);return this};a.prototype.failure=function(a){this.failureCallbacks.push(a);return this};a.prototype.commit=function(){if(0<this.links.length){var a=this.links,b=this.successCallbacks,c=this.failureCallbacks,f=this.ordered,h=[],k=!1,e=function(a){g.deferred(a.bind(null,n.bind(null,a),p.bind(null,a)))},l=function(d){d=
a.indexOf(d);-1!=d&&a.splice(d,1)},q=function(){f&&0<a.length?e(a.shift()):0==a.length&&(k?m():b.forEach(function(a){a()}))},m=function(){f&&0<a.length?e(a.shift()):0==a.length&&c.forEach(function(a){a(h)})},n=function(a){l(a);q()},p=function(a,b){k=!0;b&&h.push(b);l(a);m()};f?e(a.shift()):a.forEach(e)}else this.successCallbacks.forEach(function(a){g.deferred(a)});return this.clear()};a.prototype.setOrdered=function(a){this.ordered=a;return this};a.prototype.isOrdered=function(){return this.ordered};
a.prototype.clear=function(){this.links=[];this.successCallbacks=[];this.failureCallbacks=[];this.ordered=!1;return this};a.append=b.makeDaisyChain(a,a.prototype.append);a.success=b.makeDaisyChain(a,a.prototype.success);a.failure=b.makeDaisyChain(a,a.prototype.failure);a.commit=b.makeDaisyChain(a,a.prototype.commit);a.setOrdered=b.makeDaisyChain(a,a.prototype.setOrdered);a.clear=b.makeDaisyChain(a,a.prototype.clear);c.Chain=a})(window);
/*
MIT
@copyright notrubp@gmail.com 2015
*/
(function(c){function b(a,b){return b+a}var a={};a.val=b.bind(null,"");a.mm=b.bind(null,"mm");a.cm=b.bind(null,"cm");a.ch=b.bind(null,"ch");a.rem=b.bind(null,"rem");a.vh=b.bind(null,"vh");a.vw=b.bind(null,"vw");a.vmin=b.bind(null,"vmin");a.vmax=b.bind(null,"vmax");a.in=b.bind(null,"in");a.pc=b.bind(null,"pc");a.pt=b.bind(null,"pt");a.ex=b.bind(null,"ex");a.em=b.bind(null,"em");a.pct=b.bind(null,"%");a.px=b.bind(null,"px");a.Zero=a.px(0);c.Unit=a})(window);
/*
MIT
@copyright notrubp@gmail.com 2015
*/
(function(c){var b=c.Util,d=c.Random,a=function(a,b,e,c){this.r=a||0;this.g=b||0;this.b=e||0;this.a=c||1};a.prototype.__propertyHook=function(){return"rgba("+this.r+","+this.g+","+this.b+","+this.a+")"};a.prototype.rgb=function(a,b,c){this.r=a;this.g=b;this.b=c;return this};a.prototype.rgba=function(a,b,c,d){this.r=a;this.g=b;this.b=c;this.a=d;return this};a.prototype.randomRgb=function(){return this.randomRgba(1)};a.prototype.randomRgba=function(a){return this.rgba(d.range(255),d.range(255),d.range(255),
a)};a.prototype.setRed=function(a){this.r=a;return this};a.prototype.getRed=function(){return this.r};a.prototype.setGreen=function(a){this.g=a;return this};a.prototype.getGreen=function(){return this.g};a.prototype.setBlue=function(a){this.b=a;return this};a.prototype.getBlue=function(){return this.b};a.prototype.setAlpha=function(a){this.a=a;return this};a.prototype.getAlpha=function(){return this.a};a.rgb=b.makeDaisyChain(a,a.prototype.rgb);a.rgba=b.makeDaisyChain(a,a.prototype.rgba);a.randomRgb=
b.makeDaisyChain(a,a.prototype.randomRgb);a.randomRgba=b.makeDaisyChain(a,a.prototype.randomRgba);a.setRed=b.makeDaisyChain(a,a.prototype.setRed);a.setGreen=b.makeDaisyChain(a,a.prototype.setGreen);a.setBlue=b.makeDaisyChain(a,a.prototype.setBlue);a.setAlpha=b.makeDaisyChain(a,a.prototype.setAlpha);a.Transparent=a.rgba(0,0,0,0);a.Black=a.rgb(0,0,0);a.White=a.rgb(1,1,1);a.Red=a.rgb(1,0,0);a.Green=a.rgb(0,1,0);a.Blue=a.rgb(0,0,1);c.Color=a})(window);
/*
MIT
@copyright notrubp@gmail.com 2015
*/
(function(c){var e=c.Unit,a=function(b,a,d){this.css=(typeof b===Number?e.px(b):b)+" "+a+" "+d.__propertyHook()};a.prototype.__propertyHook=function(){return this.css};a.make=function(b,c,d){return new a(b,c,d)};c.Border=a})(window);
/*
MIT
@copyright notrubp@gmail.com 2015
*/
(function(k){var d=k.Math||{};d.lerp=function(a,c,b){return n+b*(c-a)};d.Ease={};d.Ease.inQuad=function(a,c,b,e){return b*(a/=e)*a+c};d.Ease.outQuad=function(a,c,b,e){return-b*(a/=e)*(a-2)+c};d.Ease.inOutQuad=function(a,c,b,e){return 1>(a/=e/2)?b/2*a*a+c:-b/2*(--a*(a-2)-1)+c};d.Ease.inCubic=function(a,c,b,e){return b*(a/=e)*a*a+c};d.Ease.outCubic=function(a,c,b,e){return b*((a=a/e-1)*a*a+1)+c};d.Ease.inOutCubic=function(a,c,b,e){return 1>(a/=e/2)?b/2*a*a*a+c:b/2*((a-=2)*a*a+2)+c};d.Ease.inQuart=function(a,
c,b,e){return b*(a/=e)*a*a*a+c};d.Ease.outQuart=function(a,c,b,e){return-b*((a=a/e-1)*a*a*a-1)+c};d.Ease.inOutQuart=function(a,c,b,e){return 1>(a/=e/2)?b/2*a*a*a*a+c:-b/2*((a-=2)*a*a*a-2)+c};d.Ease.inQuint=function(a,c,b,e){return b*(a/=e)*a*a*a*a+c};d.Ease.outQuint=function(a,c,b,e){return b*((a=a/e-1)*a*a*a*a+1)+c};d.Ease.inOutQuint=function(a,c,b,e){return 1>(a/=e/2)?b/2*a*a*a*a*a+c:b/2*((a-=2)*a*a*a*a+2)+c};d.Ease.inSine=function(a,c,b,e){return-b*d.cos(a/e*(d.PI/2))+b+c};d.Ease.outSine=function(a,
c,b,e){return b*d.sin(a/e*(d.PI/2))+c};d.Ease.inOutSine=function(a,c,b,e){return-b/2*(d.cos(d.PI*a/e)-1)+c};d.Ease.inExpo=function(a,c,b,e){return 0==a?c:b*d.pow(2,10*(a/e-1))+c};d.Ease.outExpo=function(a,c,b,e){return a==e?c+b:b*(-d.pow(2,-10*a/e)+1)+c};d.Ease.inOutExpo=function(a,c,b,e){return 0==a?c:a==e?c+b:1>(a/=e/2)?b/2*d.pow(2,10*(a-1))+c:b/2*(-d.pow(2,-10*--a)+2)+c};d.Ease.inCirc=function(a,c,b,e){return-b*(d.sqrt(1-(a/=e)*a)-1)+c};d.Ease.outCirc=function(a,c,b,e){return b*d.sqrt(1-(a=a/e-
1)*a)+c};d.Ease.inOutCirc=function(a,c,b,e){return 1>(a/=e/2)?-b/2*(d.sqrt(1-a*a)-1)+c:b/2*(d.sqrt(1-(a-=2)*a)+1)+c};d.Ease.inElastic=function(a,c,b,e){var f=1.70158,g=0,h=b;if(0==a)return c;if(1==(a/=e))return c+b;g||(g=0.3*e);h<d.abs(b)?(h=b,f=g/4):f=g/(2*d.PI)*d.asin(b/h);return-(h*d.pow(2,10*(a-=1))*d.sin(2*(a*e-f)*d.PI/g))+c};d.Ease.outElastic=function(a,c,b,e){var f=1.70158,g=0,h=b;if(0==a)return c;if(1==(a/=e))return c+b;g||(g=0.3*e);h<d.abs(b)?(h=b,f=g/4):f=g/(2*d.PI)*d.asin(b/h);return h*
d.pow(2,-10*a)*d.sin(2*(a*e-f)*d.PI/g)+b+c};d.Ease.inOutElastic=function(a,c,b,e){var f=1.70158,g=0,h=b;if(0==a)return c;if(2==(a/=e/2))return c+b;g||(g=0.3*1.5*e);h<d.abs(b)?(h=b,f=g/4):f=g/(2*d.PI)*d.asin(b/h);return 1>a?-0.5*h*d.pow(2,10*(a-=1))*d.sin(2*(a*e-f)*d.PI/g)+c:0.5*h*d.pow(2,-10*(a-=1))*d.sin(2*(a*e-f)*d.PI/g)+b+c};d.Ease.inBack=function(a,c,b,e,d){void 0==d&&(d=1.70158);return b*(a/=e)*a*((d+1)*a-d)+c};d.Ease.outBack=function(a,c,b,d,f){void 0==f&&(f=1.70158);return b*((a=a/d-1)*a*((f+
1)*a+f)+1)+c};d.Ease.inOutBack=function(a,c,b,d,f){void 0==f&&(f=1.70158);return 1>(a/=d/2)?b/2*a*a*(((f*=1.525)+1)*a-f)+c:b/2*((a-=2)*a*(((f*=1.525)+1)*a+f)+2)+c};d.Ease.inBounce=function(a,c,b,e){return b-d.Ease.outBounce(e-a,0,b,e)+c};d.Ease.outBounce=function(a,c,b,d){return(a/=d)<1/2.75?7.5625*b*a*a+c:a<2/2.75?b*(7.5625*(a-=1.5/2.75)*a+0.75)+c:a<2.5/2.75?b*(7.5625*(a-=2.25/2.75)*a+0.9375)+c:b*(7.5625*(a-=2.625/2.75)*a+0.984375)+c};d.Ease.inOutBounce=function(a,c,b,e){return a<e/2?0.5*d.Ease.inBounce(2*
a,0,b,e)+c:0.5*d.Ease.outBounce(2*a-e,0,b,e)+0.5*b+c};k.Math=d})(window);
/*
MIT
@copyright notrubp@gmail.com 2015
*/
(function(d){var a=function(a,c){this.x=a||0;this.y=c||0};a.prototype.__propertyHook=function(){return this.x+","+this.y};a.prototype.set=function(a,c){this.x=a;this.y=c;return this};a.prototype.copy=function(a){this.x=a.x;this.y=a.y;return this};a.prototype.setX=function(a){this.x=a;return this};a.prototype.getX=function(){return this.x};a.prototype.setY=function(a){this.y=a;return this};a.prototype.getY=function(){return this.y};a.prototype.add=function(b){return new a(this.x+b.x,this.y+b.y)};a.prototype.sub=
function(b){return new a(this.x-b.x,this.y-b.y)};a.prototype.scale=function(b){return new a(this.x*b,this.y*y)};a.prototype.lengthSq=function(){return this.x*this.x+this.y*this.y};a.prototype.length=function(){return Math.sqrt(this.lengthSq())};a.prototype.dot=function(a){return this.x*a.x+this.y*a.y};a.prototype.normalize=function(){var b=this.length();return new a(this.x/b,this.y/b)};a.set=Util.makeDaisyChain(a,a.prototype.set);a.copy=Util.makeDaisyChain(a,a.prototype.copy);a.setX=Util.makeDaisyChain(a,
a.prototype.setX);a.setY=Util.makeDaisyChain(a,a.prototype.setY);d.Point=a})(window);
/*
MIT
@copyright notrubp@gmail.com 2015
*/
(function(g){var f=g.Point,a=function(a,b,c,d){this.tl=new f(a,b);this.br=new f(c,d)};a.prototype.__propertyHook=function(){return"rect("+this.tl.x+","+this.tl.y+","+this.br.x+","+this.br.y+")"};a.prototype.set=function(a,b,c,d){this.tl.set(a,b);this.br.set(c,d);return this};a.prototype.copy=function(a){this.tl.copy(a.tl);this.br.copy(a.br);return this};a.prototype.setLeft=function(a){this.tl.x=a;return this};a.prototype.getLeft=function(){return this.tl.x};a.prototype.setTop=function(a){this.tl.y=
a;return this};a.prototype.getTop=function(){return this.tl.y};a.prototype.setRight=function(a){this.br.x=a;return this};a.prototype.getRight=function(){return this.br.x};a.prototype.setBottom=function(a){this.br.y=a;return this};a.prototype.getBottom=function(){return this.br.y};a.prototype.setWidth=function(a){this.setRight(this.tl.x+a);return this};a.prototype.getWidth=function(){return this.br.x-this.tl.x};a.prototype.setHeight=function(a){this.setBottom(this.tl.y+a);return this};a.prototype.getHeight=
function(){return this.br.y-this.tl.y};a.prototype.centroid=function(){return new f((this.tl.x+this.br.x)/2,(this.tl.y+this.br.y)/2)};a.prototype.contains=function(a){return a.tl.x>=this.tl.x&&a.tl.x<=this.br.x&&a.tl.y>=this.tl.y&&a.tl.y<=this.br.y};a.prototype.intersects=function(a){return!(a.tl.x>this.br.x||a.br.x<this.tl.x||a.tl.y>this.br.y||a.br.y<this.tl.y)};a.set=Util.makeDaisyChain(a,a.prototype.set);a.copy=Util.makeDaisyChain(a,a.prototype.copy);a.setLeft=Util.makeDaisyChain(a,a.prototype.setLeft);
a.setTop=Util.makeDaisyChain(a,a.prototype.setTop);a.setRight=Util.makeDaisyChain(a,a.prototype.setRight);a.setBottom=Util.makeDaisyChain(a,a.prototype.setBottom);a.setWidth=Util.makeDaisyChain(a,a.prototype.setWidth);a.setHeight=Util.makeDaisyChain(a,a.prototype.setHeight);a.make=function(e,b,c,d){return new a(e,b,c,d)};a.makeXywh=function(e,b,c,d){return new a(e,b,e+c,b+d)};g.Rect=a})(window);
/*
MIT
@copyright notrubp@gmail.com 2015
*/
(function(d){var a=function(b,c){this.css="steps("+b+","+(a.Direction.Start===c?"start":"end")+")"};a.prototype.__propertyHook=function(){return this.css};a.make=function(b,c){return new a(b,c||a.Direction.End)};a.Direction={Start:0,End:1};Object.freeze(a.Direction);d.Steps=a})(window);
/*
MIT
@copyright notrubp@gmail.com 2015
*/
(function(h){function t(b,r,c){var a=b.__propertyUid;return k[a]?k[a].reduce(B.bind(null,b,r,c),!1):!1}function B(b,r,c,a,e){return!0===e(b,r,c)||a}function m(b){b.__propertyUid||(b.__propertyUid=u.letters())}function v(b){b=b.__propertyUid;l[b]||(l[b]=[]);return l[b]}function C(b){g.info("property","flushing");n="flushing";s=w.now();p=!1;Object.keys(l).forEach(D);p?x():(g.info("property","sleeping"),n="sleeping",y.raf(E))}function D(b){for(var a=l[b];0<a.length;){var c=a[0];if(c.waitForNextFrame){g.info("property",
"blocking -> "+b);c.waitForNextFrame=!1;break}var f="none";try{f=s<c.time||!1===c.callback()?"none":"ok"}catch(e){F.deferred(e),f="fail"}var d=!1;switch(f){case "ok":g.info("property","applied -> "+b);0<a.length&&a[0]===c&&a.shift();c.breakCurrentFrame&&(d=!0);break;case "fail":g.error("property","fail -> "+b),0<a.length&&a[0]===c&&a.shift();default:d=!0}if(d)break}p=p||0<a.length}function E(b){}function x(){switch(n){case "sleeping":g.info("property","awake"),s=w.now();case "flushing":n="awake",
y.raf(C)}}function G(b){return b.replace(/-(\w)/g,function(b,a){return a.toUpperCase()})}function z(b,a,c){m(b);a=this.fixup(a);c=null!=c&&"function"===typeof c.__propertyHook?c.__propertyHook():c;g.info("property","set("+b.__propertyUid+", "+a+", "+c+")");t(this.global,a,c)||t(b,a,c)||(b.style[a]=c)}var q=h.Platform,F=h.Exception,w=h.Time,y=h.Scheduler,g=h.Log,u=h.Uuid,d={global:{}};d.global.style={};d.global.__propertyUid=u.letters();var k={};d.hook=function(b,a){m(b);var c=b.__propertyUid;k[c]||
(k[c]=[]);k[c].push(a);return a};var l={},n="sleeping",p=!1,s=0,a={},A=!1;q.isGecko&&(A=!0,a.animation="-moz-animation",a["animation-delay"]="-moz-animation-delay",a["animation-name"]="-moz-animation-name",a["animation-duration"]="-moz-animation-duration",a["animation-timing-function"]="-moz-animation-timing-function",a["animation-iteration-count"]="-moz-animation-iteration-count",a["animation-direction"]="-moz-animation-direction",a["animation-fill-mode"]="-moz-animation-fill-mode",a["animation-play-state"]=
"-moz-animation-play-state",a["box-sizing"]="-moz-box-sizing",a.transform="-moz-transform",a["transform-origin"]="-moz-transform-origin",a.transition="-moz-transition");q.isTrident&&(a.transform="-ms-transform",a["transform-origin"]="-ms-transform-origin",a.transition="-ms-transition");q.isOpera&&(a.transform="-o-transform",a["transform-origin"]="-o-transform-origin",a.transition="-o-transition");q.isWebKit&&(a.animation="-webkit-animation",a["animation-delay"]="-webkit-animation-delay",a["animation-name"]=
"-webkit-animation-name",a["animation-duration"]="-webkit-animation-duration",a["animation-timing-function"]="-webkit-animation-timing-function",a["animation-iteration-count"]="-webkit-animation-iteration-count",a["animation-direction"]="-webkit-animation-direction",a["animation-fill-mode"]="-webkit-animation-fill-mode",a["animation-play-state"]="-webkit-animation-play-state",a.transform="-webkit-transform",a["transform-origin"]="-webkit-transform-origin",a.transition="-webkit-transition");d.fixup=
function(b){b=this.fixupNocc(b);return b=A?G(b):b};d.fixupNocc=function(b){return a[b]||b};d.set=function(b,a,c,d,e){null!=d?this.enqueue(b,z.bind(this,b,a,c),d,e):z.call(this,b,a,c)};d.get=function(b,a){return b.style[a]};d.remove=function(b,a){g.info("property","remove("+b.__propertyUid+", "+a+")");this.set(b,a,null)};d.enqueue=function(a,d,c,f){m(a);x();a=queue=v(a);c=c||0;d={callback:d,time:c,breakCurrentFrame:0<c,waitForNextFrame:f};f=-1;if(0<c)for(var e=0;e<a.length;++e){if(c<a[e].time){f=e;
break}}else for(e=0;e<a.length;++e)if(0<a[e].time){f=e;break}-1!=f?a.splice(f,0,d):a.push(d)};d.clear=function(a){m(a);queue=v(a);queue.splice(0,queue.length)};d.forceReflow=function(a){a.offsetWidth=a.offsetWidth};h.Property=d})(window);
/*
MIT
@copyright notrubp@gmail.com 2015
*/
(function(b){var e=b.Util,f=b.Property,a=function(){this.clear()};a.prototype.__propertyHook=function(){return this.css};a.prototype.clear=function(){this.css="";return this};a.prototype.set=function(a,b,c,d){b=b||1;c=c||"ease";d=d||0;0<this.css.length&&(this.css+=", ");a=f.fixupNocc(a);this.css+=a+" "+b+"s "+c+" "+d+"s";return this};a.clear=e.makeDaisyChain(a,a.prototype.clear);a.set=e.makeDaisyChain(a,a.prototype.set);b.Transition=a})(window);
/*
MIT
@copyright notrubp@gmail.com 2015
*/
(function(e){function c(a){"none"===a.css?a.css="":0<a.css.length&&(a.css+=" ")}var b=e.Util,a=function(){this.none()};a.prototype.__propertyHook=function(){return this.css};a.prototype.equals=function(f){return null==f?!1:this===f?!0:f instanceof a?this.css===f.css:!1};a.prototype.none=function(){this.css="none";return this};a.prototype.matrix=function(a,b,d,g,h,k){c(this);this.css+="matrix("+a+","+b+","+d+","+g+","+h+","+k+")";return this};a.prototype.matrix3d=function(a,b,d,g,h,k,e,l,m,n,p,q,r,
s,t,u){c(this);this.css+="matrix3d("+a+","+b+","+d+","+g+","+h+","+k+","+e+","+l+","+m+","+n+","+p+","+q+","+r+","+s+","+t+","+u+")";return this};a.prototype.translate=function(a,b){c(this);this.css+="translate("+a+","+b+")";return this};a.prototype.translate3d=function(a,b,d){c(this);this.css+="translate3d("+a+","+b+","+d+")";return this};a.prototype.translateX=function(a){c(this);this.css+="translateX("+a+")";return this};a.prototype.translateY=function(a){c(this);this.css+="translateY("+a+")";
return this};a.prototype.translateZ=function(a){c(this);this.css+="translateZ("+a+")";return this};a.prototype.scale=function(a,b){c(this);this.css+="scale("+a+","+b+")";return this};a.prototype.scale3d=function(a,b,d){c(this);this.css+="scale3d("+a+","+b+","+d+")";return this};a.prototype.scaleX=function(a){c(this);this.css+="scaleX("+a+")";return this};a.prototype.scaleY=function(a){c(this);this.css+="scaleY("+a+")";return this};a.prototype.scaleZ=function(a){c(this);this.css+="scaleZ("+a+")";return this};
a.prototype.rotate=function(a){c(this);this.css+="rotate("+a+"rad)";return this};a.prototype.rotate3d=function(a,b,d){c(this);this.css+="rotate3d("+a+"rad,"+b+"rad,"+d+"rad)";return this};a.prototype.rotateX=function(a){c(this);this.css+="rotateX("+a+"rad)";return this};a.prototype.rotateY=function(a){c(this);this.css+="rotateY("+a+"rad)";return this};a.prototype.rotateZ=function(a){c(this);this.css+="rotateZ("+a+"rad)";return this};a.prototype.skew=function(a,b){c(this);this.css+="skew("+a+"rad,"+
b+"rad)";return this};a.prototype.skewX=function(a){c(this);this.css+="skewX("+a+"rad)";return this};a.prototype.skewY=function(a){c(this);this.css+="skewY("+a+"rad)";return this};a.none=b.makeDaisyChain(a,a.prototype.none);a.matrix=b.makeDaisyChain(a,a.prototype.matrix);a.matrix3d=b.makeDaisyChain(a,a.prototype.matrix3d);a.translate=b.makeDaisyChain(a,a.prototype.translate);a.translate3d=b.makeDaisyChain(a,a.prototype.translate3d);a.translateX=b.makeDaisyChain(a,a.prototype.translateX);a.translateY=
b.makeDaisyChain(a,a.prototype.translateY);a.translateZ=b.makeDaisyChain(a,a.prototype.translateZ);a.scale=b.makeDaisyChain(a,a.prototype.scale);a.scale3d=b.makeDaisyChain(a,a.prototype.scale3d);a.scaleX=b.makeDaisyChain(a,a.prototype.scaleX);a.scaleY=b.makeDaisyChain(a,a.prototype.scaleY);a.scaleZ=b.makeDaisyChain(a,a.prototype.scaleZ);a.rotate=b.makeDaisyChain(a,a.prototype.rotate);a.rotate3d=b.makeDaisyChain(a,a.prototype.rotate3d);a.rotateX=b.makeDaisyChain(a,a.prototype.rotateX);a.rotateY=b.makeDaisyChain(a,
a.prototype.rotateY);a.rotateZ=b.makeDaisyChain(a,a.prototype.rotateZ);a.skew=b.makeDaisyChain(a,a.prototype.skew);a.skewX=b.makeDaisyChain(a,a.prototype.skewX);a.skewY=b.makeDaisyChain(a,a.prototype.skewY);a.Origin=a.translate("0px","0px");e.Transform=a})(window);
/*
MIT
@copyright notrubp@gmail.com 2015
*/
(function(h){var d=h.Unit,l=h.Color,n=h.Border,m=h.Transform,a=h.Property,g={createRect:function(c,b,k,e){var f=document.createElement("div");a.set(f,"-ms-backface-visibility","hidden");a.set(f,"-moz-backface-visibility","hidden");a.set(f,"-webkit-backface-visibility","hidden");a.set(f,"-transform-style","preserve-3d");a.set(f,"-webkit-transform-style","preserve-3d");a.set(f,"perspective","500px");a.set(f,"-webkit-perspective","500px");a.set(f,"position","absolute");a.set(f,"margin",d.Zero);a.set(f,
"transform",b||m.Origin);a.set(f,"background-color",k||l.Transparent);a.set(f,"border",e||n.make(d.Zero,"none",l.Black));null!=c?(a.set(f,"left",d.px(c.getLeft())),a.set(f,"top",d.px(c.getTop())),a.set(f,"width",d.px(c.getWidth())),a.set(f,"height",d.px(c.getHeight()))):(a.set(f,"left",d.Zero),a.set(f,"top",d.Zero),a.set(f,"width",d.Zero),a.set(f,"height",d.Zero));a.set(f,"right","auto");a.set(f,"bottom","auto");g.setSelectable(f,!1);return f},createImage:function(c,b,k){var e=document.createElement("img");
null!=b&&g.setImageSrc(e,b);a.set(e,"-ms-backface-visibility","hidden");a.set(e,"-moz-backface-visibility","hidden");a.set(e,"-webkit-backface-visibility","hidden");a.set(e,"-transform-style","preserve-3d");a.set(e,"-moz-transform-style","preserve-3d");a.set(e,"-webkit-transform-style","preserve-3d");a.set(e,"perspective","500px");a.set(e,"-moz-perspective","500px");a.set(e,"-webkit-perspective","500px");a.set(e,"position","absolute");a.set(e,"margin","0px");a.set(e,"transform",k||m.Origin);null!=
c?(e.width=c.getWidth(),e.height=c.getHeight(),a.set(e,"left",d.px(c.getLeft())),a.set(e,"top",d.px(c.getTop())),a.set(e,"width",d.px(c.getWidth())),a.set(e,"height",d.px(c.getHeight()))):(a.set(e,"left",d.Zero),a.set(e,"top",d.Zero));a.set(e,"right","auto");a.set(e,"bottom","auto");g.setSelectable(e,!1);return e},createTextBox:function(a,b,d,e,f,g){},createCanvas:function(c){var b=document.createElement("canvas");a.set(b,"-ms-backface-visibility","hidden");a.set(b,"-moz-backface-visibility","hidden");
a.set(b,"-webkit-backface-visibility","hidden");a.set(b,"-transform-style","preserve-3d");a.set(b,"-webkit-transform-style","preserve-3d");a.set(b,"perspective","500px");a.set(b,"-webkit-perspective","500px");a.set(b,"position","absolute");a.set(b,"margin",d.Zero);a.set(b,"right","auto");a.set(b,"bottom","auto");b.width=c.getWidth();b.height=c.getHeight();g.setSelectable(b,!1);return b},setSelectable:function(c,b){b?(a.set(c,"-webkit-user-select","text"),a.set(c,"-khtml-user-select","text"),a.set(c,
"-moz-user-select","text"),a.set(c,"-ms-user-select","text"),a.set(c,"user-select","text"),a.set(c,"-webkit-touch-callout","default"),c.removeAttribute("unselectable")):(a.set(c,"-webkit-user-select","none"),a.set(c,"-khtml-user-select","none"),a.set(c,"-moz-user-select","-moz-none"),a.set(c,"-ms-user-select","none"),a.set(c,"user-select","none"),a.set(c,"-webkit-touch-callout","none"),c.setAttribute("unselectable","on"))},setImageSrc:function(c,b){"string"==typeof b?c.src=b:(c.src=b.url,c.width=
b.width,c.height=b.height,a.set(c,"width",d.px(b.width)),a.set(c,"height",d.px(b.height)))},append:function(a,b){a.appendChild(b)},remove:function(a,b){a.removeChild(b)},insertBefore:function(a,b,d){a.insertBefore(sibling,d)},insertAfter:function(a,b,d){d=d.nextSibling;null!=d?g.insertBefore(a,b,d):g.append(a,b)},replace:function(a,b,d){a.replaceChild(b,d)},listen:function(a,b,d){a.addEventListener(b,d,!1);return function(){a.removeEventListener(b,d,!1)}}};h.Dom=g})(window);
/*
MIT
@copyright notrubp@gmail.com 2015
*/
(function(d){function f(a,c,b){c+=" "+100*Number(b)+"% {";a=a[b];b=" ";for(var d=0;d<a.length;++d){var e=a[d];c+=b+e.property+": "+e.value;b="; "}return c+(b+"}")}var g=d.Uuid,h=d.Platform,k=d.Property,a=function(a){this.name=a||g.letters();this.keyframes={}};a.prototype.at=function(a,c,b){a=Math.min(1,a);a=Math.max(0,a);this.keyframes[a]=this.keyframes[a]||[];c=k.fixupNocc(c);b=null!=b&&"function"===typeof b.__propertyHook?b.__propertyHook():b;this.keyframes[a].push({property:c,value:b});return this};
a.prototype.after=function(a,c,b){return this.at(a+0.001,c,b)};a.prototype.before=function(a,c,b){return this.at(a-0.001,c,b)};a.prototype.setName=function(a){this.name=a;return this};a.prototype.clear=function(){this.keyframes={};return this};a.prototype.getName=function(){return this.name};var l=h.isWebKit?"@-webkit-keyframes":"@keyframes";a.prototype.generate=function(){return Object.keys(this.keyframes).sort().reduce(f.bind(null,this.keyframes),l+" "+this.name+" {")+"}"};var e=[];a.prototype.inject=
function(){var d=document.createElement("style");d.language="text/css";d.appendChild(document.createTextNode(this.generate()));document.getElementsByTagName("head")[0].appendChild(d);a.isNotInjected(this.name)&&e.push(this.name);return this};a.at=Util.makeDaisyChain(a,a.prototype.at);a.after=Util.makeDaisyChain(a,a.prototype.after);a.before=Util.makeDaisyChain(a,a.prototype.before);a.setName=Util.makeDaisyChain(a,a.prototype.setName);a.clear=Util.makeDaisyChain(a,a.prototype.clear);a.isNotInjected=
function(a){return-1==e.indexOf(a)};d.Keyframes=a})(window);
/*
MIT
@copyright notrubp@gmail.com 2015
*/
(function(d){var a={},c={};a.get=function(b){if(b in c)return c[b];var a=document.createElement("img");a.src=b;return c[b]=a};d.Image=a})(window);
/*
MIT
@copyright notrubp@gmail.com 2015
*/
(function(g){function f(){this.Container_constructor()}var e=createjs.extend(f,createjs.Container);e.load=function(a,c,d){this.config=a;this.on("reset",function(){this.reset()}.bind(this));this.on("gameOver",function(a){this.gameOver(a.win)}.bind(this));var b=new Chain;b.append(function(a,b){this.spriteSheet=new createjs.SpriteSheet(this.config.spriteSheet);this.spriteSheet.numbers="zero one two three four five six seven eight nine".split(" ");this.spriteSheet.nodeNumbers="node_empty node_1 node_2 node_3 node_4 node_5 node_6 node_7 node_8".split(" ");
a()}.bind(this));b.append(function(b,d){this.board=new Board(this,a.board.x,a.board.y,a.board.width,a.board.height,a.board.nodeWidth,a.board.nodeHeight,a.board.numberOfMines);this.board.load(b,d);this.addChild(this.board)}.bind(this));b.append(function(a,b){this.ui=new Ui(this);this.ui.load(a,b);this.addChild(this.ui)}.bind(this));this.reset(b);b.success(function(){c&&c()}.bind(this));b.failure(function(){d&&d()}.bind(this));b.setOrdered(!0);b.commit()};e.reset=function(a){this.mouseEnabled=!1;var c=
null!=a;c||(a=new Chain);a.append(function(a,b){this.board.reset(a,b)}.bind(this));a.append(function(a,b){this.ui.reset(a,b)}.bind(this));a.append(function(a,b){this.minesLeft=this.board.numberOfMines;this.ui.left.setValue(this.minesLeft);a()}.bind(this));a.success(function(){this.mouseEnabled=!0;this.board.mouseEnabled=!0}.bind(this));c||(a.setOrdered(!0),a.commit())};e.gameOver=function(a){this.board.mouseEnabled=!1;this.ui.stop();a?(this.ui.smiley.cool(),this.board.flagAllMines()):(this.ui.smiley.dead(),
this.board.showAllMines())};g.Game=createjs.promote(f,"Container")})(window);
/*
MIT
@copyright notrubp@gmail.com 2015
*/
(function(c){function d(a){this.Container_constructor();this.game=a}var e=c.Scheduler,b=createjs.extend(d,createjs.Container);b.load=function(a,b){this.left=new CounterText(this.game,this.game.config.ui.left.x,this.game.config.ui.left.y,this.game.config.ui.left.length,this.game.config.ui.left.charWidth,this.game.config.ui.left.charHeight);this.left.load();this.addChild(this.left);this.right=new CounterText(this.game,this.game.config.ui.right.x,this.game.config.ui.right.y,this.game.config.ui.right.length,
this.game.config.ui.right.charWidth,this.game.config.ui.right.charHeight);this.right.load();this.addChild(this.right);this.smiley=new Smiley(this.game,this.game.config.ui.smiley.x,this.game.config.ui.smiley.y);this.smiley.load();this.addChild(this.smiley);a&&a()};b.reset=function(a,b){this.stop();this.seconds=0;var c=function(){++this.seconds;1E3>this.seconds&&this.right.setValue(this.seconds)}.bind(this);this.timer=e.interval(1E3,c);this.right.setValue(this.seconds);this.smiley.reset();a&&a()};b.stop=
function(){null!=this.timer&&(this.timer.cancel(),this.timer=null)};b.onNumberOfNodesFlaggedChanged=function(a){this.left.setValue(this.game.config.board.numberOfMines-a)};c.Ui=createjs.promote(d,"Container")})(window);
/*
MIT
@copyright notrubp@gmail.com 2015
*/
(function(e){function c(a,b,f,c,d,e){this.Container_constructor();this.game=a;this.lookup=this.game.spriteSheet.numbers;this.x=b;this.y=f;this.sprites=[];this.length=c;this.charWidth=d;this.charHeight=e}var d=createjs.extend(c,createjs.Container);d.load=function(){for(var a=0;a<this.length;++a){var b=new createjs.Sprite(this.game.spriteSheet,this.lookup[0]);b.x=a*this.charWidth;this.sprites.push(b);this.addChild(b)}};d.setValue=function(a){a=Math.floor(a);a=String(a);a=a.split("");for(var b=0;b<this.length;++b){var c=
a.length-(this.length-b);this.sprites[b].gotoAndStop(this.lookup[0>c?0:Number(a[c])])}};e.CounterText=createjs.promote(c,"Container")})(window);
/*
MIT
@copyright notrubp@gmail.com 2015
*/
(function(c){function b(a,b,c){this.Container_constructor();this.game=a;this.x=b;this.y=c}var a=createjs.extend(b,createjs.Container);a.load=function(){this.on("gameOver",function(){Log.info("game","Smiley.gameOver()")}.bind(this));this.sprite=new createjs.Sprite(this.game.spriteSheet,"smiley");this.sprite.buttonHelper=new createjs.ButtonHelper(this.sprite,"smiley",null,"smiley_pressed",!1);this.sprite.addEventListener("click",function(){this.game.dispatchEvent("reset")}.bind(this));this.addChild(this.sprite)};
a.reset=function(){this.sprite.gotoAndStop("smiley")};a.dead=function(){this.sprite.gotoAndStop("smiley_dead")};a.cool=function(){this.sprite.gotoAndStop("smiley_cool")};a.scared=function(){this.sprite.gotoAndStop("smiley_scared")};c.Smiley=createjs.promote(b,"Container")})(window);
/*
MIT
@copyright notrubp@gmail.com 2015
*/
(function(s){function k(b,d,a,f,g,c,h,e){this.Container_constructor();this.game=b;this.x=d;this.y=a;this.width=f;this.height=g;this.nodeWidth=c;this.nodeHeight=h;this.numberOfMines=e;this.numberOfNodesFlagged=this.numberOfNodesLeft=0;this.nodes=[]}var e=createjs.extend(k,createjs.Container);e.load=function(b,d){for(var a=new Chain,f=0;f<this.width;++f)for(var g=f*this.nodeHeight,c=0;c<this.height;++c){var h=new Node(this.game,this,f*this.width+c,c*this.nodeWidth,g);a.append(Node.prototype.load.bind(h));
this.nodes.push(h);this.addChild(h)}a.append(function(b,g){for(var a=function(c,a){if(!(0>c||c>=this.nodes.length)){var b=this.nodes[c];0<=a&&a<this.nodes.length&&b.neighbors.push(this.nodes[a])}}.bind(this),c=0;c<this.nodes.length;++c){var h=Math.floor(c/this.width),d=c-this.width,f=Math.floor(d/this.width),e=d+1,k=c+1,l=c+this.width,m=Math.floor(l/this.width),n=l+1,p=l-1,q=c-1,r=d-1;a(c,d);f==Math.floor(e/this.width)&&a(c,e);h==Math.floor(k/this.width)&&a(c,k);m==Math.floor(n/this.width)&&a(c,n);
a(c,l);m==Math.floor(p/this.width)&&a(c,p);h==Math.floor(q/this.width)&&a(c,q);f==Math.floor(r/this.width)&&a(c,r)}b()}.bind(this));a.success(b).failure(d).setOrdered(!0).commit()};e.reset=function(b,d){Chain.append(function(a,b){this.nodes.forEach(function(a){a.reset()});a()}.bind(this)).append(function(a,b){for(var g=this.nodes.slice(),c=0;c<this.numberOfMines;++c)if(0<g.length){var d=Random.range(g.length);g[d].mine=!0;g.splice(d,1)}else break;a()}.bind(this)).append(function(a,b){this.nodes.forEach(function(a){a.mine||
(a.numberOfAdjacentMines=a.neighbors.reduce(function(a,b){b.mine&&++a;return a},0))}.bind(this));this.numberOfNodesLeft=this.nodes.length;this.numberOfNodesFlagged=0;a()}.bind(this)).success(b).failure(d).setOrdered(!0).commit()};e.showAllMines=function(){this.nodes.forEach(function(b){b.mine&&(b.state==Node.State.Hidden?b.sprite.gotoAndStop("node_mine"):b.state==Node.State.Flagged&&b.sprite.gotoAndStop("node_minemarked"))})};e.flagAllMines=function(){this.nodes.forEach(function(b){b.mine&&b.state==
Node.State.Hidden&&b.sprite.gotoAndStop("node_flagged")});this.game.ui.onNumberOfNodesFlaggedChanged(this.numberOfMines)};e.evaluate=function(b){if(this.nodes.reduce(function(b,a){a.mine&&a.state==Node.State.Flagged&&++b;return b},0)==this.numberOfMines||this.numberOfNodesLeft<=this.numberOfMines)b=new createjs.Event("gameOver"),b.win=!0,this.game.dispatchEvent(b)};e.onNodeStateChanged=function(b,d,a){if(d==Node.State.Flagged)--this.numberOfNodesFlagged,this.game.ui.onNumberOfNodesFlaggedChanged(this.numberOfNodesFlagged);
else switch(a){case Node.State.Touched:--this.numberOfNodesLeft;break;case Node.State.Flagged:++this.numberOfNodesFlagged,this.game.ui.onNumberOfNodesFlaggedChanged(this.numberOfNodesFlagged),this.evaluate()}};e.expand=function(b,d){this.mouseEnabled=!1;if(!(0>b||b>=this.nodes.length)){var a=function(b,d,c){if(-1!=b.indexOf(d))c&&c();else{var e=new Chain;b.push(d);d.isBlank()?(d.setState(Node.State.Touched),d.neighbors.forEach(function(c){e.append(a.bind(null,b,c))})):d.mine||d.setState(Node.State.Touched);
e.success(c);e.commit()}};a([],this.nodes[b],function(){this.mouseEnabled=!0;d&&d()}.bind(this))}};s.Board=createjs.promote(k,"Container")})(window);
/*
MIT
@copyright notrubp@gmail.com 2015
*/
(function(d){function a(b,c,e,d,f){this.Container_constructor();this.game=b;this.lookup=b.spriteSheet.nodeNumbers;this.board=c;this.neighbors=[];this.index=e;this.x=d;this.y=f;this.mine=!1;this.state=a.State.Hidden;this.numberOfAdjacentMines=0;this.flagging=!1}a.State={Hidden:0,Flagged:1,Touched:2};Object.freeze(a.State);var c=createjs.extend(a,createjs.Container);c.load=function(b,c){this.sprite=new createjs.Sprite(this.game.spriteSheet,"node_blank");this.sprite.on("mousedown",function(b){this.flagging=
2==b.nativeEvent.button;Log.info("game","mousedown flagging="+this.flagging);this.flagging||this.state==a.State.Flagged||(this.sprite.gotoAndStop("node_empty"),this.game.ui.smiley.scared())}.bind(this));this.sprite.on("mouseout",function(){this.mouseEnabled&&(this.state!=a.State.Flagged&&(this.sprite.gotoAndStop("node_blank"),this.game.ui.smiley.reset()),this.flagging=!1)}.bind(this));this.sprite.addEventListener("click",function(){this.game.ui.smiley.reset();this.flagging?(this.state==a.State.Hidden&&
this.board.numberOfNodesFlagged<this.board.numberOfMines?this.setState(a.State.Flagged):this.setState(a.State.Hidden),this.flagging=!1):this.state!=a.State.Flagged&&(this.mouseEnabled=!1,this.choose())}.bind(this));this.addChild(this.sprite);b&&b()};c.reset=function(){this.mouseEnabled=!0;this.mine=this.flagging=!1;this.numberOfAdjacentMines=0;this.setState(a.State.Hidden);this.sprite.gotoAndStop("node_blank")};c.choose=function(){this.setState(a.State.Touched);if(this.mine){var b=new createjs.Event("gameOver");
b.win=!1;this.game.dispatchEvent(b)}else this.board.expand(this.index,function(){this.board.evaluate()}.bind(this))};c.isBlank=function(){return!this.mine&&0==this.numberOfAdjacentMines};c.setState=function(b){if(this.state!=b){var c=this.state;this.state=b;switch(b){case a.State.Hidden:this.sprite.gotoAndStop("node_blank");break;case a.State.Flagged:this.sprite.gotoAndStop("node_flagged");break;case a.State.Touched:0<this.numberOfAdjacentMines?this.sprite.gotoAndStop(this.lookup[this.numberOfAdjacentMines]):
this.mine?this.sprite.gotoAndStop("node_hit"):this.sprite.gotoAndStop("node_empty"),this.mouseEnabled=!1}this.board.onNodeStateChanged(this,c,b)}};d.Node=createjs.promote(a,"Container")})(window);
/*
MIT
@copyright notrubp@gmail.com 2015
*/
(function(){Dom.listen(document,"DOMContentLoaded",function(){Log.Tags.enable("game");var f=new Game,b=null,c=null,d=null,e=new Chain;e.append(function(a,c){b=Dom.createImage();b.onload=a;b.onerror=a;Dom.setImageSrc(b,"img/sprites.png")}.bind(this));e.append(function(a,d){c=Dom.createImage();c.onload=a;c.onerror=a;Dom.setImageSrc(c,"img/board.png");Property.set(c,"display","none");Dom.append(document.body,c)}.bind(this));e.success(function(){d=Dom.createCanvas(Rect.makeXywh(0,0,288,322));Property.set(d,
"display","none");Dom.append(document.body,d);d.oncontextmenu=function(){return!1};var a=new createjs.Stage(d);a.enableMouseOver(10);createjs.Touch.enable(a);f.load({spriteSheet:{images:[b],frames:[[87,0,13,23],[87,23,13,23],[100,0,13,23],[74,0,13,23],[100,23,13,23],[87,69,13,23],[74,69,13,23],[87,46,13,23],[74,23,13,23],[74,46,13,23],[0,78,26,26],[0,0,26,26],[0,26,26,26],[26,0,26,26],[0,52,26,26],[52,0,16,16],[58,64,16,16],[42,90,16,16],[58,80,16,16],[42,42,16,16],[26,90,16,16],[26,42,16,16],[26,
26,16,16],[58,16,16,16],[58,48,16,16],[42,58,16,16],[58,32,16,16],[42,74,16,16],[26,74,16,16],[42,26,16,16],[26,58,16,16]],animations:{one:0,two:1,three:2,four:3,five:4,six:5,seven:6,eight:7,nine:8,zero:9,smiley:10,smiley_pressed:11,smiley_scared:12,smiley_cool:13,smiley_dead:14,node_blank:15,node_empty:16,node_flagged:17,node_question:18,node_question_pressed:19,node_mine:20,node_hit:21,node_minemarked:22,node_1:23,node_2:24,node_3:25,node_4:26,node_5:27,node_6:28,node_7:29,node_8:30}},board:{x:15,
y:50,width:16,height:16,nodeWidth:16,nodeHeight:16,numberOfMines:10},ui:{left:{x:16,y:18,length:3,charWidth:13,charHeight:18},right:{x:233,y:18,length:3,charWidth:13,charHeight:18},smiley:{x:130,y:15}}},function(){Property.remove(c,"display");Property.remove(d,"display");Property.set(document.querySelector(".loading"),"display","none");var b=function(){a.update();Scheduler.raf(b)};b()});a.addChild(f)});e.commit()})})();