waves/public/assets/g/bounce/js/main-built.js
2025-04-09 17:11:14 -05:00

4 lines
146 KiB
JavaScript

/*
(c) 2013-2022 GameMix Inc. All rights reserved.
*/
!function(){var t,u,a,o,c,p,m,f,g,y,i,s,w,e=document.getElementById("gameCanvas"),n=e.getContext("2d");function v(t,e){return i.call(t,e)}function r(t,e){var i,s,n,a,o,r,h,l,d,u,c=e&&e.split("/"),p=g.map,m=p&&p["*"]||{};if(t&&"."===t.charAt(0))if(e){for(c=c.slice(0,c.length-1),e=(t=t.split("/")).length-1,g.nodeIdCompat&&w.test(t[e])&&(t[e]=t[e].replace(w,"")),t=c.concat(t),l=0;l<t.length;l+=1)if("."===(u=t[l]))t.splice(l,1),--l;else if(".."===u){if(1===l&&(".."===t[2]||".."===t[0]))break;0<l&&(t.splice(l-1,2),l-=2)}t=t.join("/")}else 0===t.indexOf("./")&&(t=t.substring(2));if((c||m)&&p){for(l=(i=t.split("/")).length;0<l;--l){if(s=i.slice(0,l).join("/"),c)for(d=c.length;0<d;--d)if(n=(n=p[c.slice(0,d).join("/")])&&n[s]){a=n,o=l;break}if(a)break;!r&&m&&m[s]&&(r=m[s],h=l)}!a&&r&&(a=r,o=h),a&&(i.splice(0,o,a),t=i.join("/"))}return t}function b(t,e){return function(){return o.apply(u,s.call(arguments,0).concat([t,e]))}}function S(t){var e;if(v(f,t)&&(e=f[t],delete f[t],y[t]=!0,a.apply(u,e)),v(m,t)||v(y,t))return m[t];throw new Error("No "+t)}function h(t){var e,i=t?t.indexOf("!"):-1;return-1<i&&(e=t.substring(0,i),t=t.substring(i+1,t.length)),[e,t]}n.save(),n.fillStyle="#000000",n.fillRect(0,0,e.width,e.height),n.restore(),n.save(),n.font="30px Arial",n.fillStyle="#ffffff",n.textAlign="center",n.textBaseline="middle",n.fillText("Loading",e.width/2,e.height/2),n.restore(),m={},f={},g={},y={},i=Object.prototype.hasOwnProperty,s=[].slice,w=/\.js$/,c=function(t,e){var i,s,n=h(t),a=n[0];return t=n[1],a&&(i=S(a=r(a,e))),a?t=i&&i.normalize?i.normalize(t,(s=e,function(t){return r(t,s)})):r(t,e):(a=(n=h(t=r(t,e)))[0],t=n[1],a&&(i=S(a))),{f:a?a+"!"+t:t,n:t,pr:a,p:i}},p={require:function(t){return b(t)},exports:function(t){var e=m[t];return void 0!==e?e:m[t]={}},module:function(t){return{id:t,uri:"",exports:m[t],config:(e=t,function(){return g&&g.config&&g.config[e]||{}})};var e}},a=function(t,e,i,s){var n,a,o,r,h,l=[],d=typeof i;if(s=s||t,"undefined"==d||"function"==d){for(e=!e.length&&i.length?["require","exports","module"]:e,r=0;r<e.length;r+=1)if("require"===(a=(o=c(e[r],s)).f))l[r]=p.require(t);else if("exports"===a)l[r]=p.exports(t),h=!0;else if("module"===a)n=l[r]=p.module(t);else if(v(m,a)||v(f,a)||v(y,a))l[r]=S(a);else{if(!o.p)throw new Error(t+" missing "+a);o.p.load(o.n,b(s,!0),function(e){return function(t){m[e]=t}}(a),{}),l[r]=m[a]}d=i?i.apply(m[t],l):void 0,t&&(n&&n.exports!==u&&n.exports!==m[t]?m[t]=n.exports:d===u&&h||(m[t]=d))}else t&&(m[t]=i)},e=t=o=function(t,e,i,s,n){if("string"==typeof t)return p[t]?p[t](e):S(c(t,e).f);if(!t.splice){if((g=t).deps&&o(g.deps,g.callback),!e)return;e.splice?(t=e,e=i,i=null):t=u}return e=e||function(){},"function"==typeof i&&(i=s,s=n),s?a(u,t,e,i):setTimeout(function(){a(u,t,e,i)},4),o},o.config=function(t){return o(t)},e._defined=m,(n=function(t,e,i){e.splice||(i=e,e=[]),v(m,t)||v(f,t)||(f[t]=[t,e,i])}).amd={jQuery:!0},n("requireLib",function(){}),n("j13e/utils/J13Polyfills",["require","exports","module"],function(t,e,i){"use strict";Function.prototype.bind||(Function.prototype.bind=function(t){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var e=this;return function(){return e.apply(t,arguments)}});for(var n,a,o,r,s,h=0,l=["webkit","moz"],d=0;d<l.length&&!window.requestAnimationFrame;++d)window.requestAnimationFrame=window[l[d]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[l[d]+"CancelAnimationFrame"]||window[l[d]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(t,e){var i=(new Date).getTime(),s=Math.max(0,16-(i-h)),n=window.setTimeout(function(){t(i+s)},s);return h=i+s,n}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(t){clearTimeout(t)}),Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),Array.prototype.forEach||(Array.prototype.forEach=function(t,e){if(null==this)throw new TypeError;var i,s=this.length>>>0;if("function"!=typeof t)throw new TypeError;for(i=0;i<s;i++)void 0!==this[i]&&t.call(e,this[i],i,this)}),Array.prototype.every||(Array.prototype.every=function(t,e){if(null==this)throw new TypeError;var i,s=this.length>>>0;if("function"!=typeof t)throw new TypeError;for(i=0;i<s;i++)if(void 0!==this[i]&&!t.call(e,this[i],i,this))return!1;return!0}),Object.keys||(Object.keys=(n=Object.prototype.hasOwnProperty,a=!{toString:null}.propertyIsEnumerable("toString"),r=(o=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"]).length,function(t){if("object"!=typeof t&&("function"!=typeof t||null===t))throw new TypeError("Object.keys called on non-object");var e,i,s=[];for(e in t)n.call(t,e)&&s.push(e);if(a)for(i=0;i<r;i++)n.call(t,o[i])&&s.push(o[i]);return s})),"function"!=typeof Object.create&&(Object.create=function(t,e){function i(){}if(i.prototype=t,e&&"object"==typeof e)for(var s in e)e.hasOwnProperty(s)&&(i[s]=e[s]);return new i}),"function"!=typeof Object.getPrototypeOf&&(s="__proto__",Object.getPrototypeOf="object"==typeof"test"[s]?function(t){return t[s]}:function(t){return t.constructor.prototype})}),n("j13e/main",["./utils/J13Polyfills"],function(t){"use strict";return{status:"rawr"}}),n("j13e",["j13e/main"],function(t){return t}),n("cocoonjs/CocoonInclude",["require","exports","module"],function(t,e,i){"use strict";return null}),n("src/utils/Common",["require","exports","module"],function(t,e,i){"use strict";var s={clamp:function(t,e,i){return i<e?i:e<t?t:e},rangedRandom:function(t,e){var i,e=t<e?(i=t,e):(i=e,t);return i+Math.random()*(e-i)},objectToParamString:function(t){var e,i=[];for(e in t)t.hasOwnProperty(e)&&i.push(e+"="+t[e]);return i.join("&")},paramStringToObject:function(t){var e,i,s,n,a,o,r={};if(t&&"string"==typeof t&&1<t.length)for(i=(e="?"===(e=t)[0]?t.substr(1):e).split("&"),s=0;s<i.length;s+=1)2===(n=i[s].split("=",2)).length?(a=n[0],o=n[1],a&&o&&(r[a]=o)):1===n.length&&(r[n[0]]=null);return r}};return s}),n("src/Settings",["require","exports","module","cocoonjs/CocoonInclude","src/utils/Common"],function(t,e,i){"use strict";var s=t("cocoonjs/CocoonInclude"),t=t("src/utils/Common").paramStringToObject(window.location.search);return{cocoon:!!s,kik:!(!window.kik||!window.kik.enabled),gaId:"UA-54030208-1",gmgaId:"bouncyflappy",gmapiId:"bouncyflappy",ftaContainerId:"fta-ef",ftaId:"bouncyflappy",inAppGames:t.hasOwnProperty("inappgames")||"ubersocialios"===t.utm_source&&"inapp"===t.utm_medium,crazyGames:"true"===t.crazygames||"1"===t.crazygames,width:480,height:690}}),n("src/gmapi",["require","exports","module","src/Settings"],function(t,e,i){"use strict";var s,n,a,o,r,t=t("src/Settings");return s=window,n=document,a="//gmapi.gamemix.com",o="gmapi",s.GameMixAPIName=o,s[o]=s[o]||function(t){s[o].q=s[o].q||[],s[o].q.push(t)},s[o]({apiDomain:a}),r=n.createElement("script"),n=n.getElementsByTagName("script")[0],r.type="text/javascript",r.async=!0,r.src=a+"/v1/gm.js",n.parentNode.insertBefore(r,n),window.gmapi&&window.gmapi(t.gmapiId),function(){window.gmapi&&window.gmapi.apply(window.gmapi,arguments)}}),n("src/fta",["require","exports","module","src/Settings"],function(t,e,i){"use strict";var t=t("src/Settings"),s=window,n=document,a="//demo.gamemix.com/flappytrilogy/fta.js",o="fta";return s["GM-FTA-Name"]=o,s.fta=s.fta||function(){s.fta.q=s.fta.q||[],s.fta.q.push(arguments)},s.fta({jsUrl:a}),o=n.createElement("script"),n=n.getElementsByTagName("script")[0],o.type="text/javascript",o.async=!0,o.src=a,n.parentNode.insertBefore(o,n),window.fta&&window.fta(t.ftaContainerId,t.ftaId),function(){window.fta&&window.fta.apply(window.fta,arguments)}}),n("j13e/math/J13Vec2",["require","exports","module"],function(t,e,i){"use strict";function s(t,e){this.x=t||0,this.y=e||0}return s.prototype={abs:function(){this.x<0&&(this.x=-this.x),this.y<0&&(this.y=-this.y)},add:function(t){this.x+=t.x,this.y+=t.y},subtract:function(t){this.x-=t.x,this.y-=t.y},multiply:function(t){this.x*=t,this.y*=t},mulM:function(t){var e=this.x;this.x=t.col1.x*e+t.col2.x*this.y,this.y=t.col1.y*e+t.col2.y*this.y},mulTM:function(t){},crossVF:function(t){var e=this.x;this.x=t*this.y,this.y=-t*e},crossFV:function(t){var e=this.x;this.x=-t*this.y,this.y=t*e},min:function(t){this.x=(this.x<t.x?this:t).x,this.y=(this.y<t.y?this:t).y},max:function(t){this.x=(this.x>t.x?this:t).x,this.y=(this.y>t.y?this:t).y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthSquared:function(){return this.x*this.x+this.y*this.y},normalize:function(){var t,e=Math.sqrt(this.x*this.x+this.y*this.y);return e<Number.MIN_VALUE?0:(this.x*=t=1/e,this.y*=t,e)},copy:function(){return new s(this.x,this.y)},setZero:function(){this.x=0,this.y=0},getNegative:function(){return new s(-this.x,-this.y)},negativeSelf:function(){this.x=-this.x,this.y=-this.y},set:function(t,e){"number"==typeof t&&"number"==typeof e?(this.x=t,this.y=e):t&&t.hasOwnProperty("x")&&t.hasOwnProperty("y")&&(this.x=t.x,this.y=t.y)},setAngle:function(t){this.x=Math.cos(t),this.y=Math.sin(t)}},s}),n("j13e/math/J13Math",["require","exports","module","./J13Vec2"],function(t,e,i){"use strict";var s=t("./J13Vec2"),t={dot:function(t,e){return t.x*e.x+t.y*e.y},crossVV:function(t,e){return t.x*e.y-t.y*e.x},crossVF:function(t,e){return new s(e*t.y,-e*t.x)},crossFV:function(t,e){return new s(-t*e.y,t*e.x)},mulMV:function(t,e){return new s(t.col1.x*e.x+t.col2.x*e.y,t.col1.y*e.x+t.col2.y*e.y)},distance:function(t,e){var i=t.x-e.x,t=t.y-e.y;return Math.sqrt(i*i+t*t)},distanceSquared:function(t,e){var i=t.x-e.x,t=t.y-e.y;return i*i+t*t},intersectCircCirc:function(t,e,i,s,n,a){return(t-s)*(t-s)+(e-n)*(e-n)<(i+a)*(i+a)},intersectRectCirc:function(t,e,i,s,n,a,o){n=Math.abs(n-t),t=Math.abs(a-e);return!(i/2+o<n)&&(!(i/2+o<t)&&(n<=i/2||(t<=s/2||(n-i/2)*(n-i/2)+(t-s/2)*(t-s/2)<=o*o)))},intersectRectRect:function(t,e,i,s,n,a,o,r){return 2*Math.abs(t-n)<i+o&&2*Math.abs(e-a)<s+r}};return t}),n("j13e/math/J13Rect",["require","exports","module","./J13Vec2","./J13Math"],function(t,e,i){"use strict";var s=t("./J13Vec2"),n=t("./J13Math");function a(t){t=t||{};this.left=t.left||0,this.top=t.top||0,this.right=t.right||0,this.bottom=t.bottom||0,t.hasOwnProperty("x")&&(this.left=t.x),t.hasOwnProperty("y")&&(this.top=t.y),t.hasOwnProperty("width")&&(this.right=this.left+t.width),t.hasOwnProperty("height")&&(this.bottom=this.top+t.height),this.checkDimensions()}return a.doRectsIntersect=function(t,e){return n.intersectRectRect(t.getCenterX(),t.getCenterY(),t.getWidth(),t.getHeight(),e.getCenterX(),e.getCenterY(),e.getWidth(),e.getHeight())},a.combine=function(t,e){var i=new a;return i.combine(t,e),i},a.isJ13Rect=function(t,e){if(!t)return!1;for(var i in a.IDENTITY)if(a.IDENTITY.hasOwnProperty(i)&&!t.hasOwnProperty(i))return!1;if(e)for(i in a.prototype)if(a.prototype.hasOwnProperty(i)&&!t.hasOwnProperty(i))return!1;return!0},a.canBeJ13Rect=function(t){t=t||{};return!(!t.hasOwnProperty("x")&&!t.hasOwnProperty("left")||!t.hasOwnProperty("y")&&!t.hasOwnProperty("top")||!t.hasOwnProperty("width")&&!t.hasOwnProperty("right")||!t.hasOwnProperty("height")&&!t.hasOwnProperty("bottom"))},a.prototype={getCenter:function(){return new s(this.getCenterX(),this.getCenterY())},getCenterX:function(){return(this.left+this.right)/2},getCenterY:function(){return(this.top+this.bottom)/2},setX:function(t){var e=this.getWidth();this.left=t,this.right=t+e},setY:function(t){var e=this.getHeight();this.top=t,this.bottom=t+e},setPosition:function(t,e){this.setX(t),this.setY(e)},checkDimensions:function(){var t;this.left>this.right&&(t=this.left,this.left=this.right,this.right=t),this.top>this.bottom&&(t=this.top,this.top=this.bottom,this.bottom=t)},translate:function(t,e){this.translateX(t),this.translateY(e)},translateX:function(t){this.left+=t,this.right+=t},translateY:function(t){this.top+=t,this.bottom+=t},getWidth:function(){return this.right-this.left},getHeight:function(){return this.bottom-this.top},setWidth:function(t){this.right=this.left+t},setHeight:function(t){this.bottom=this.top+t},containsPoint:function(t,e){return t>=this.left&&t<this.right&&e>=this.top&&e<this.bottom},intersectsRect:function(t){return a.doRectsIntersect(this,t)},copy:function(){return new a({left:this.left,top:this.top,right:this.right,bottom:this.bottom})},contains:function(t){return this.left<=t.left&&this.top<=t.top&&t.right<=this.right&&t.bottom<=this.bottom},combine:function(t,e){this.left=Math.min(t.left,e.left),this.top=Math.min(t.top,e.top),this.right=Math.max(t.right,e.right),this.bottom=Math.max(t.bottom,e.bottom)}},a.IDENTITY=new a,a}),n("src/Resources",["require","exports","module","j13e/math/J13Rect"],function(t,e,i){"use strict";t=t("j13e/math/J13Rect");return{kikEnabled:!1,images:{bgDay:"imgs/Bg_day.png",bgNight:"imgs/Bg_night.png",topBar:"imgs/Top.png",bottomBar:"imgs/Bottom_fill.png",flappyYellowSprite:"imgs/flappy_yellow_sprite.png",retryButton:"imgs/Button_retry.png",kikButton:"imgs/Button_kikit.png",rankButton:"imgs/Button_leaderboard.png",pipe:"imgs/Pipe.png",volumeSprite:"imgs/volumesprite.png",crazyGamesBackButton:"imgs/Button_crazygames.png"},soundNames:{crash:"crash",fall:"fall",flap:"flap",menu:"menu",point:"point"},sounds:{crash:{urls:["sounds/s_crash.mp3","sounds/s_crash.ogg","sounds/s_crash.wav"],volume:1},fall:{urls:["sounds/s_fall.mp3","sounds/s_fall.ogg","sounds/s_fall.wav"],volume:1},flap:{urls:["sounds/s_flap.mp3","sounds/s_flap.ogg","sounds/s_flap.wav"],volume:1},menu:{urls:["sounds/s_menu.mp3","sounds/s_menu.ogg","sounds/s_menu.wav"],volume:1},point:{urls:["sounds/s_point.mp3","sounds/s_point.ogg","sounds/s_point.wav"],volume:1}},loadedImages:{},spriteMap:{birds:{yellow:{frameMap:{mid:new t({x:0,y:0,width:51,height:36}),up:new t({x:54,y:0,width:51,height:36}),down:new t({x:108,y:0,width:51,height:36})},anchorX:25,anchorY:18,destRect:new t({x:0,y:0,width:51,height:36})}},volume:{main:{frameMap:{on:new t({x:0,y:0,width:100,height:90}),off:new t({x:110,y:0,width:100,height:90})},destRect:new t({x:0,y:0,width:50,height:45})}}},patterns:{},gameStates:{init:"init",preload:"preload",mainMenu:"mainmenu",intro:"intro",level:"level",paused:"paused",gameOver:"gameover",hiScore:"hiscore",appCache:"appcache"},anims:{},buttons:{start:"start",hiScore:"hiscore",kik:"kik",menu:"menu",retry:"retry",version:"version",rank:"rank",volume:"volume"},hitTypes:{ceiling:"ceiling",floor:"floor",pipe:"pipe"},events:{gameInitted:"gameinitted"}}}),n("j13e/utils/J13Utils",["require","exports","module"],function(t,e,i){"use strict";var a={},s=window.Node,n=window.HTMLElement,o=window.navigator;a.nativeTypes=["Boolean","Number","String","Function","Array","Date","RegExp","Object"],a.class2type={};for(var r=0;r<a.nativeTypes.length;r+=1)a.class2type["[object "+a.nativeTypes[r]+"]"]=a.nativeTypes[r].toLowerCase();a.isNode=function(t){return"object"==typeof s?t instanceof s:t&&"object"==typeof t&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName},a.isElement=function(t){return"object"==typeof n?t instanceof n:t&&"object"==typeof t&&null!==t&&1===t.nodeType&&"string"==typeof t.nodeName},a.isArray=Array.isArray||function(t){return"array"===a.getType(t)},a.getType=function(t){return null===t?String(t):a.class2type[window.toString.call(t)]||"object"},a.isNativeObject=function(t){var e=t;return"object"==typeof t&&null!==t&&function(){for(;e=Object.getPrototypeOf(e););return Object.getPrototypeOf(t)===e}()},a.makeUnselectable=function(t,e){if(t&&(1===t.nodeType&&t.setAttribute("unselectable","on"),e))for(var i=t.firstChild;i;)a.makeUnselectable(i,e),i=i.nextSibling},a.addClass=function(t,e){var i,s,n=t.hasOwnProperty("className"),a=n?t.className:t.getAttribute("class"),o=[],r="object"==typeof e&&"number"==typeof e.length?e:[e];for("string"==typeof a&&0<a.length&&(o=a.split(" ")),s=0;s<r.length;s+=1)i=r[s],-1===o.indexOf(i)&&o.push(i);n?t.className=o.join(" "):t.setAttribute("class",o.join(" "))},a.removeClass=function(t,e){var i,s,n=t.hasOwnProperty("className"),a=n?t.className:t.getAttribute("class"),o=[],r="object"==typeof e&&"number"==typeof e.length?e:[e];for("string"==typeof a&&0<a.length&&(o=a.split(" ")),i=0;i<r.length;i+=1)s=r[i],-1!==(s=o.indexOf(s))&&o.splice(s,1);n?t.className=o.join(" "):t.setAttribute("class",o.join(" "))},a.hasClass=function(t,e){var i=[];return!!t.getAttribute&&-1!==(i="string"==typeof(t=t.hasOwnProperty("className")?t.className:t.getAttribute("class"))&&0<t.length?t.split(" "):i).indexOf(e)},a.extendObj=function(t,e,i){var s,n=a.cloneObject(e,i);for(s in t)t.hasOwnProperty(s)&&(i&&n.hasOwnProperty(s)&&"object"==typeof n[s]&&"object"==typeof t[s]&&(n[s]=a.extendObj(t[s],n[s],i)),n.hasOwnProperty(s)||(a.isNativeObject(t[s])?t[s]?n[s]=a.cloneObject(t[s],i):n[s]=null:n[s]=t[s]));return n},a.cloneObject=function(t,e){var i,s;if("string"==typeof t)i=t;else for(s in i={},t)t.hasOwnProperty(s)&&(e&&"object"==typeof t[s]?i[s]=a.cloneObject(t[s],e):i[s]=t[s]);return i},a.inherit=function(){for(var t,e,i=null,s=0;s<arguments.length;s+=1)if(e=null,arguments[s]&&("function"==typeof arguments[s]?e=new arguments[s]:"object"==typeof arguments[s]&&(e=arguments[s])),e)if(i)for(t in e)e.hasOwnProperty(t)&&(i[t]=e[t]);else i=e;return i};var h={Android:function(){return o.userAgent.match(/Android/i)},FirefoxOS:function(){return-1==o.userAgent.indexOf("Android")&&0<=o.userAgent.indexOf("Firefox")&&0<=o.userAgent.indexOf("Mobile")},BlackBerry:function(){return o.userAgent.match(/BlackBerry/i)},iOS:function(){return o.userAgent.match(/iPhone|iPad|iPod/i)},iPod:function(){return o.userAgent.match(/iPod/i)},iPhone:function(){return o.userAgent.match(/iPhone/i)},iPad:function(){return o.userAgent.match(/iPad/i)},Opera:function(){return o.userAgent.match(/Opera Mini/i)},Windows:function(){return o.userAgent.match(/IEMobile/i)},any:function(){return h.Android()||h.BlackBerry()||h.iOS()||h.Opera()||h.Windows()||h.FirefoxOS()},Safari:function(){return h.iOS()&&!h.ChromeIOS()&&o.userAgent.match(/AppleWebKit/i)},iPhoneSafari:function(){return(h.iPhone()||h.iPod())&&!h.ChromeIOS()&&o.userAgent.match(/AppleWebKit/i)},ChromeIOS:function(){return h.iOS()&&o.userAgent.match("CriOS")},ChromeAndroid:function(){return o.userAgent.match(/Android.+Chrome|CrMo/i)}};return a.isMobile=h,a.addOnClick=function(t,e,i){t.onclick=e,i&&t.addEventListener("touchstart",function(t){return t.currentTarget.onclick(t),t.preventDefault(),t.stopPropagation(),!1},!1)},a}),n("j13e/utils/J13DOM",["require","exports","module","./J13Utils"],function(t,e,i){"use strict";var s=t("./J13Utils");return new function(){var e={};this.get=function(t){return e[t]||(e[t]=document.getElementById(t)),e[t]},this.create=function(t,e,i){t=document.createElement(t);return t.hasOwnProperty("id")?t.id=e:t.setAttribute("id",e),s.addClass(t,i),t}}}),n("src/efs/Ef",["require","exports","module","j13e/utils/J13Utils"],function(t,e,i){"use strict";var s=t("j13e/utils/J13Utils");function n(t){t=t||{};this.game=t.game||null,this.shouldShowFunction=t.shouldShowFunction||function(){return!1},this.enabled=!t.hasOwnProperty("enabled")||t.enabled,this.platforms=t.platforms||n.platforms.DESKTOP|n.platforms.MOBILE|n.platforms.TABLET,this.adInterval=t.adInterval||1,this.initted=!1,this.started=!1}return n.platforms={DESKTOP:1,MOBILE:2,TABLET:4},n.getCurrentPlatform=function(){return s.isMobile.any()?768<=(window.innerWidth||document.documentElement.clientWidth)?n.platforms.TABLET:n.platforms.MOBILE:n.platforms.DESKTOP},n.prototype={init:function(){this.enabled&&(this.initted=!0)},start:function(){this.enabled&&(this.started=!0)},rotate:function(){},show:function(){},hide:function(){},showContainer:function(){},hideContainer:function(){},shouldShow:function(t){return!(!this.initted||!this.enabled)&&this.shouldShowFunction(t||this.adInterval)}},n}),n("src/efs/EfInits",["require","exports","module"],function(t,e,i){"use strict";return[]}),n("src/efs/EfMopub",["require","exports","module","./Ef","./EfInits","j13e/utils/J13DOM","j13e/utils/J13Utils"],function(t,e,i){"use strict";var a=t("./Ef"),s=t("./EfInits"),n=t("j13e/utils/J13DOM"),o=t("j13e/utils/J13Utils");function r(t){var e=t||{};a.call(this,t),this.adUnitId=e.adUnitId||null,this.adContainerId=e.adContainerId||null,this.size=e.size||null,this.keywords=e.keywords||"",r.slotsToDefine.push(this)}return r.slotsToDefine=[],r.mopubInit=function(){if(0<r.slotsToDefine.length){window.mopub=[];for(var t,e,i,s=a.getCurrentPlatform(),n=0;n<r.slotsToDefine.length;n+=1)(t=r.slotsToDefine[n])&&0<(t.platforms&s)&&t.enabled&&t.adUnitId&&t.size&&t.adContainerId&&(window.mopub.push({ad_unit:t.adUnitId,ad_container_id:t.adContainerId,ad_width:t.size[0],ad_height:t.size[1],keywords:t.keywords}),t.init());0<window.mopub.length&&((e=document.createElement("script")).async=!0,e.type="text/javascript",e.src="//d1zg4cyg8u4pko.cloudfront.net/mweb/mobileweb.min.js",(i=document.getElementsByTagName("script")[0]).parentNode.insertBefore(e,i))}},r.prototype=o.inherit(new a,{start:function(){this.initted&&!this.started&&this.canRun()&&a.prototype.start.call(this)},rotate:function(){this.initted&&this.canRun()&&(this.started||this.start())},show:function(){this.initted&&this.canRun()&&o.addClass(n.get(this.adContainerId),"show")},hide:function(){this.initted&&this.canRun()&&o.removeClass(n.get(this.adContainerId),"show")},showContainer:function(){this.initted&&this.adContainerId&&n.get(this.adContainerId)&&this.canRun()&&o.addClass(n.get(this.adContainerId),"show")},hideContainer:function(){this.initted&&this.adContainerId&&n.get(this.adContainerId)&&this.canRun()&&o.removeClass(n.get(this.adContainerId),"show")},shouldShow:function(t){return!!this.canRun()&&a.prototype.shouldShow.call(this,t)},canRun:function(){return this.enabled&&this.adUnitId&&this.size&&this.adContainerId}}),s.push(r.mopubInit),r}),n("src/efs/EfCocoon",["require","exports","module","./Ef","./EfInits","j13e/utils/J13DOM","j13e/utils/J13Utils","cocoonjs/CocoonInclude"],function(t,e,i){"use strict";var s=t("./Ef"),n=t("./EfInits"),a=(t("j13e/utils/J13DOM"),t("j13e/utils/J13Utils")),o=t("cocoonjs/CocoonInclude");function r(t){s.call(this,t),this.hasCocoonJS=!(!o||!o.Ad),this.hasCocoonJS||(this.enabled=!1),r.adsToInitialize.push(this)}return r.adsToInitialize=[],r.cocoonAdInit=function(t){var e;o&&o.Ad&&0<r.adsToInitialize.length&&(e=!1,r.adsToInitialize.forEach(function(t){t.enabled&&(e=!0),t.init()}),e&&(o.Ad.onFullScreenShown.addEventListener(function(){console.log("fullscreen shown"),o.Ad.refreshFullScreen()}),o.Ad.onFullScreenHidden.addEventListener(function(){console.log("fullscreen hidden"),t.hideInterstitial()}),o.Ad.onFullScreenReady.addEventListener(function(){console.log("fullscreen ready"),r.adsToInitialize.forEach(function(t){t.start()})}),setTimeout(function(){o.Ad.preloadFullScreen()},1e3)))},r.prototype=a.inherit(new s,{start:function(){this.initted&&!this.started&&this.canRun()&&s.prototype.start.call(this)},rotate:function(){},show:function(){this.initted&&this.canRun()&&o.Ad.showFullScreen()},hide:function(){},shouldShow:function(t){return!(!this.started||!this.canRun())&&s.prototype.shouldShow.call(this,t)},canRun:function(){return this.enabled&&this.hasCocoonJS}}),n.push(r.cocoonAdInit),r}),n("src/efs/EfGoogleTag",["require","exports","module","./Ef","./EfInits","j13e/utils/J13DOM","j13e/utils/J13Utils","src/Settings"],function(t,e,i){"use strict";var s=t("./Ef"),n=t("./EfInits"),a=t("j13e/utils/J13DOM"),o=t("j13e/utils/J13Utils");t("src/Settings");function r(t){var e=t||{};s.call(this,t),this.adSlot=null,this.unitName=e.unitName||null,this.size=e.size||null,this.divId=e.divId||null,this.containerDivId=e.containerDivId||null,this.hasGoogleTag=!1,this.started=!1,window.googletag?this.hasGoogleTag=!0:this.enabled=!1,r.slotsToDefine.push(this)}return r.slotsToDefine=[],r.googletagInit=function(){window.googletag=window.googletag||{},window.googletag.cmd=window.googletag.cmd||[],window.googletag.cmd.push(function(){for(var t,e=s.getCurrentPlatform(),i=0;i<r.slotsToDefine.length;i+=1)(t=r.slotsToDefine[i])&&0<(t.platforms&e)&&t.enabled&&t.unitName&&t.size&&t.divId&&(t.adSlot=window.googletag.defineSlot(t.unitName,t.size,t.divId).addService(window.googletag.pubads()),t.init());window.googletag.pubads().enableSingleRequest(),window.googletag.enableServices()})},r.prototype=o.inherit(new s,{start:function(){var t;this.initted&&!this.started&&this.canRun()&&(s.prototype.start.call(this),t=this.divId,window.googletag.cmd.push(function(){window.googletag.display(t)}))},rotate:function(){var t,e;this.initted&&this.canRun()&&(t=!1,this.started||(this.start(),t=!0),t||(e=this.adSlot,window.googletag.cmd.push(function(){window.googletag.pubads().refresh([e])})))},show:function(){this.initted&&this.canRun()&&(a.get(this.divId).style.width=this.size[0]+"px",a.get(this.divId).style.height=this.size[1]+"px",o.addClass(a.get(this.divId),"show"))},hide:function(){this.initted&&this.canRun()&&o.removeClass(a.get(this.divId),"show")},showContainer:function(){this.initted&&this.containerDivId&&a.get(this.containerDivId)&&this.canRun()&&o.addClass(a.get(this.containerDivId),"show")},hideContainer:function(){this.initted&&this.containerDivId&&a.get(this.containerDivId)&&this.canRun()&&o.removeClass(a.get(this.containerDivId),"show")},shouldShow:function(t){return!!this.canRun()&&s.prototype.shouldShow.call(this,t)},canRun:function(){return this.enabled&&this.hasGoogleTag&&this.unitName&&this.size&&this.divId&&a.get(this.divId)}}),n.push(r.googletagInit),r}),n("src/efs/EfLeadBolt",["require","exports","module","./Ef","./EfInits","j13e/utils/J13DOM","j13e/utils/J13Utils"],function(t,e,i){"use strict";var s=t("./Ef"),n=t("./EfInits"),a=t("j13e/utils/J13DOM"),o=t("j13e/utils/J13Utils");function r(t){var e=t||{};s.call(this,t),this.url=e.url||null,this.divId=e.divId||null,this.size=e.size||null,this.type=e.type||null,r.adsToInitialize.push(this)}return r.types={banner:"banner",iframe:"iframe"},r.adsToInitialize=[],r.adsInit=function(t){r.adsToInitialize.forEach(function(t){t&&t.enabled&&t.divId&&t.type&&(t.type===r.types.iframe&&t.url&&t.size||t.type===r.types.banner)&&t.init()})},r.prototype=o.inherit(new s,{start:function(){var t,e;this.initted&&!this.started&&this.canRun()&&(this.type===r.types.iframe&&(t=a.get(this.divId))&&((e=a.create("iframe","meow")).src=this.url,e.style.width=this.size[0]+"px",e.style.height=this.size[1]+"px",e.style.margin="0 0",e.setAttribute("frameborder","0"),e.setAttribute("allowtransparency","true"),e.setAttribute("scrolling","no"),t.appendChild(e)),s.prototype.start.call(this))},rotate:function(){},show:function(){var t;this.initted&&this.canRun()&&((t=a.get(this.divId))&&(this.started||this.start(),o.addClass(t,"show")))},hide:function(){var t;this.initted&&this.canRun()&&((t=a.get(this.divId))&&o.removeClass(t,"show"))},shouldShow:function(t){return!(!this.initted||!this.canRun())&&s.prototype.shouldShow.call(this,t)},canRun:function(){return this.enabled&&this.divId&&this.type}}),n.push(r.adsInit),r}),n("src/efs/EfInApp",["require","exports","module","./Ef","j13e/utils/J13DOM","j13e/utils/J13Utils","./EfInits"],function(t,e,i){"use strict";var s=t("./Ef"),n=(t("j13e/utils/J13DOM"),t("j13e/utils/J13Utils")),t=t("./EfInits");function a(t){s.call(this,t),a.adsToInitialize.push(this)}return a.adsToInitialize=[],a.inAppGamesInit=function(t){window.G=window.G||{},window.G.initAds&&(a.adsToInitialize.forEach(function(t){t.enabled,t.adInterval=window.G.adInterval||t.adInterval,t.init()}),window.G.initAds())},a.prototype=n.inherit(new s,{init:function(){s.prototype.init.call(this),this.start()},start:function(){this.initted&&!this.started&&this.canRun()&&s.prototype.start.call(this)},rotate:function(){},show:function(){this.initted&&this.canRun()&&window.G.showAd()},hide:function(){},shouldShow:function(t){return!(!this.started||!this.canRun())&&s.prototype.shouldShow.call(this,t)},canRun:function(){return this.enabled&&window.G.hasOwnProperty("initAds")&&window.G.hasOwnProperty("showAd")}}),t.push(a.inAppGamesInit),a}),n("src/efs/InterstitialEfs",["require","exports","module","./Ef","./EfMopub","./EfCocoon","./EfGoogleTag","./EfLeadBolt","./EfInApp"],function(t,e,i){"use strict";var s=t("./Ef"),n=t("./EfMopub"),a=t("./EfCocoon"),o=t("./EfGoogleTag"),r=t("./EfLeadBolt"),h=t("./EfInApp");return{getInAppAds:function(e){return[new h({game:e,adInterval:1,shouldShowFunction:function(t){return 1<e.getNumPlays()&&e.getNumPlays()%t==0},enabled:!0})]},getNativeAds:function(e){return[new a({game:e,adInterval:1,shouldShowFunction:function(t){return 1<e.getNumPlays()&&e.getNumPlays()%t==0},enabled:!0})]},getWebAds:function(e){return[new o({game:e,adInterval:1,shouldShowFunction:function(t){return 1<e.getNumPlays()&&e.getNumPlays()%t==0},platforms:s.platforms.TABLET,unitName:"/20973361/game12_iPad_300x600",size:[300,600],divId:"div-gpt-ad",enabled:!1}),new o({game:e,adInterval:1,shouldShowFunction:function(t){return 1<e.getNumPlays()&&e.getNumPlays()%t==0},platforms:s.platforms.DESKTOP,unitName:"/20973361/game12_desktop_300x600",size:[300,600],divId:"div-gpt-ad",enabled:!1}),new o({game:e,adInterval:1,shouldShowFunction:function(t){return 1<e.getNumPlays()&&e.getNumPlays()%t==0},platforms:s.platforms.MOBILE,unitName:"/20973361/game12_mobile_300x250",size:[300,250],divId:"div-gpt-ad",enabled:!1}),new r({game:e,adInterval:1,url:"http://ad.leadboltmobile.net/show_app_wall?section_id=847177248",size:[300,400],shouldShowFunction:function(t){return 1<e.getNumPlays()&&e.getNumPlays()%t==0},platforms:s.platforms.MOBILE,divId:"div-leadbolt-ad",type:r.types.iframe,enabled:!1}),new n({game:e,adInterval:1,shouldShowFunction:function(t){return 1<e.getNumPlays()&&e.getNumPlays()%t==0},platforms:s.platforms.MOBILE,adUnitId:"3ef726589db6451faec326bc53b9cf55",adContainerId:"div-mopub-ad",size:[300,250],keywords:"",enabled:!0}),new n({game:e,adInterval:1,shouldShowFunction:function(t){return 1<e.getNumPlays()&&e.getNumPlays()%t==0},platforms:s.platforms.TABLET,adUnitId:"52af61684ad34228b67c071ac230a58f",adContainerId:"div-mopub-ad",size:[300,250],keywords:"",enabled:!0})]}}}),n("j13e/utils/J13Event",["require","exports","module"],function(t,e,i){"use strict";return function(t){t=t||{},this.name=t.name,this.source=t.source,this.data=t.data}}),n("j13e/utils/J13EventDispatcher",["require","exports","module","./J13Event"],function(t,e,i){"use strict";var s=t("./J13Event");function n(t){this.eventMap={}}return n.prototype={addListener:function(t,e){return!(!t||!e||(this.eventMap[t]||(this.eventMap[t]=[]),-1!==this.eventMap[t].indexOf(e)))&&(this.eventMap[t].push(e),!0)},removeListener:function(t,e){if(t&&e&&this.eventMap[t]){e=this.eventMap[t].indexOf(e);if(-1!==e)return this.eventMap[t].splice(e,1),!0}return!1},dispatch:function(t,e){if(t&&this.eventMap[t])for(var i=0;i<this.eventMap[t].length;i+=1)this.eventMap[t][i](new s({source:this,data:e,name:t}))}},n}),n("src/efs/EfManager",["require","exports","module","./Ef","./EfGoogleTag","./EfCocoon","./EfInApp","./EfInits","j13e/utils/J13Utils","j13e/utils/J13EventDispatcher"],function(t,e,i){"use strict";var s=t("./Ef"),n=(t("./EfGoogleTag"),t("./EfCocoon"),t("./EfInApp"),t("./EfInits")),a=t("j13e/utils/J13Utils"),t=t("j13e/utils/J13EventDispatcher");function o(t){t=t||{};this.interstitialScreen=t.interstitialScreen,this.interstitialClose=t.interstitialClose,this.gameOverAdScreen=t.gameOverAdScreen,this.interstitialAds=t.interstitialAds||[],this.currentInterstitialAd=null,this.gameOverAds=t.gameOverAds||[],this.currentGameOverAd=null,this.lastGameOverAdRotate=0,this.enabled=!0,this.interestitialHideCallback=null,this.gameOverHideCallback=null,this.game=t.game||null,this.events=o.events,this.desktopPage=!1,this.init()}return o.GAMEOVERROTATEDELAY=3e4,o.events={INTERSTITIALREFRESHED:"interstitialrefreshed",INTERSTITIALSHOWN:"interstitialshown",INTERSTITIALHIDDEN:"interstitialhidden",GAMEOVERADREFRESHED:"gameoveradrefreshed",GAMEOVERADSHOWN:"gameoveradshown",GAMEOVERADHIDDEN:"gameoveradhidden"},o.prototype=a.inherit(new t,{init:function(){var i=this;this.interstitialScreen&&a.addOnClick(this.interstitialScreen,function(t){for(var e=t.target;e=t.currentTarget===e?(i.hideInterstitial(),null):a.hasClass(e,"dismissableArea")?e.parentNode:null;);},!0),this.interstitialClose&&a.addOnClick(this.interstitialClose,this.hideInterstitial.bind(this),!0),n.forEach(function(t){"function"==typeof t&&t(i)})},setGame:function(t){var e;for(this.game=t,e=0;e<this.interstitialAds.length;e+=1)this.interstitialAds[e].game=t;for(e=0;e<this.gameOverAds.length;e+=1)this.gameOverAds[e].game=t},isInterstitialShowing:function(){return!(!this.enabled||!this.interstitialScreen)&&a.hasClass(this.interstitialScreen,"show")},refreshInterstitial:function(){var t;this.enabled&&(t=this.getInterstitialAd())&&(t.rotate(),this.dispatch(o.events.INTERSTITIALREFRESHED,{ad:t}))},showInterstitial:function(t){this.enabled&&(this.interestitialHideCallback=t,this.currentInterstitialAd&&this.currentInterstitialAd.show(),this.interstitialScreen&&a.addClass(this.interstitialScreen,"show"),this.dispatch(o.events.INTERSTITIALSHOWN,{ad:this.currentInterstitialAd}))},hideInterstitial:function(){this.interstitialScreen&&a.removeClass(this.interstitialScreen,"show"),this.currentInterstitialAd&&this.currentInterstitialAd.hide(),this.interestitialHideCallback&&(this.interestitialHideCallback(),this.interestitialHideCallback=null),this.dispatch(o.events.INTERSTITIALHIDDEN,{ad:this.currentInterstitialAd})},shouldShowInterstitial:function(){var t;return!!this.enabled&&(!!(t=this.getInterstitialAd())&&t.shouldShow())},getInterstitialAd:function(){if(this.enabled&&!this.currentInterstitialAd)for(var t=s.getCurrentPlatform(),e=0;e<this.interstitialAds.length&&!this.currentInterstitialAd;e+=1)this.interstitialAds[e].shouldShow()&&0<(this.interstitialAds[e].platforms&t)&&(this.currentInterstitialAd=this.interstitialAds[e]);return this.currentInterstitialAd},isGameOverAdShowing:function(){return!(!this.enabled||!this.gameOverAdScreen)&&a.hasClass(this.gameOverAdScreen,"show")},refreshGameOverAd:function(){var t,e;this.enabled&&(t=(new Date).getTime(),(e=this.getGameOverAd())&&t-this.lastGameOverAdRotate>=o.GAMEOVERROTATEDELAY&&(e.rotate(),this.lastGameOverAdRotate=t,this.dispatch(o.events.GAMEOVERADREFRESHED,{ad:e})))},showGameOverAd:function(t){this.enabled&&this.gameOverAdScreen&&(this.gameOverHideCallback=t,a.addClass(this.gameOverAdScreen,"show"),this.dispatch(o.events.GAMEOVERADSHOWN,{ad:this.currentGameOverAd}))},hideGameOverAd:function(){this.gameOverAdScreen&&a.removeClass(this.gameOverAdScreen,"show"),this.gameOverHideCallback&&(this.gameOverHideCallback(),this.gameOverHideCallback=null),this.dispatch(o.events.GAMEOVERADHIDDEN,{ad:this.currentGameOverAd})},shouldShowGameOverAd:function(){var t;return!!this.enabled&&(!!(t=this.getGameOverAd())&&t.shouldShow())},getGameOverAd:function(){if(this.enabled&&!this.currentGameOverAd)for(var t=s.getCurrentPlatform(),e=0;e<this.gameOverAds.length&&!this.currentGameOverAd;e+=1)this.gameOverAds[e].shouldShow()&&0<(this.gameOverAds[e].platforms&t)&&(this.currentGameOverAd=this.gameOverAds[e],this.currentGameOverAd.show());return this.currentGameOverAd}}),o}),n("j13e/display/J13DisplayItem",["require","exports","module","../utils/J13Utils","../utils/J13EventDispatcher"],function(t,e,i){"use strict";var s=t("../utils/J13Utils"),t=t("../utils/J13EventDispatcher");function n(t){t=t||{};this.parent=null,this.x=t.x||0,this.y=t.y||0,this.anchorX=t.anchorX||0,this.anchorY=t.anchorY||0,this.scaleX=t.hasOwnProperty("scaleX")?t.scaleX:1,this.scaleY=t.hasOwnProperty("scaleY")?t.scaleY:1,this.angle=t.angle||0,this.opacity=t.hasOwnProperty("opacity")?t.opacity:1,this.visible=!t.hasOwnProperty("visible")||t.visible,t.hasOwnProperty("scale")&&(this.scaleX=this.scaleY=t.scale)}return n.events={addedToStage:"addedtostage",removedFromStage:"removedfromstage",added:"added",removed:"removed"},n.prototype=s.inherit(new t,{events:n.events,stageRender:function(t,e,i,s){this.visible&&0<this.opacity&&(this.preRender(t,e,i,s),this.render(t,e,i,s),this.postRender(t,e,i,s))},preRender:function(t,e,i,s){s=s.canvasContext;s.save(),this.opacity<1&&(s.globalAlpha=s.globalAlpha*this.opacity),s.translate(this.x,this.y),s.rotate(this.angle),s.scale(this.scaleX,this.scaleY),s.translate(-this.anchorX,-this.anchorY)},render:function(t,e,i,s){},postRender:function(t,e,i,s){s.canvasContext.restore()},dispatchAddedToStage:function(t){this.dispatch(n.events.addedToStage,{stage:t})},dispatchRemovedFromStage:function(t){this.dispatch(n.events.removedFromStage,{stage:t})},getStageX:function(){return this.parent?this.parent.getStageX()+this.x:this.x},getStageY:function(){return this.parent?this.parent.getStageY()+this.y:this.y},isOnStage:function(){return!!this.parent&&this.parent.isOnStage()},isVisibleOnStage:function(){return!!this.parent&&(this.visible&&this.parent.isVisibleOnStage())}}),n}),n("j13e/display/J13DisplayButton",["require","exports","module","../utils/J13Utils","../utils/J13EventDispatcher","./J13DisplayItem"],function(t,e,i){"use strict";var s=t("../utils/J13Utils"),n=t("../utils/J13EventDispatcher"),a=t("./J13DisplayItem");function o(t){var e=t||{};a.call(this,t),n.call(this,t),this.id=e.id||"button-"+o.IDPOOL++,this.state=o.states.UP,this.width=e.width||0,this.height=e.height||0,this._enabled=!e.hasOwnProperty("enabled")||e.enabled,e.clickFunction&&this.addListener(o.events.CLICK,e.clickFunction)}return o.IDPOOL=0,o.states={UP:"up",DOWN:"down",HOVER:"hover",DISABLED:"disabled"},o.events={CLICK:"click",DOWN:"down",UP:"up",HOVER:"hover",STATECHANGE:"statechange"},o.isButton=function(t,e){if(!t)return!1;for(var i in o.IDENTITY)if(o.IDENTITY.hasOwnProperty(i)&&!t.hasOwnProperty(i))return!1;if(e)for(i in o.prototype)if(o.prototype.hasOwnProperty(i)&&!t.hasOwnProperty(i))return!1;return!0},o.prototype=s.inherit(new a,n.prototype,{events:o.events,states:o.states,click:function(t){this._enabled&&this.dispatch(o.events.CLICK,{originalEvent:t})},down:function(t){this._enabled&&(this.setState(o.states.DOWN),this.dispatch(o.events.DOWN,{originalEvent:t}))},up:function(t){this._enabled&&(this.setState(o.states.UP),this.dispatch(o.events.UP,{originalEvent:t}))},hover:function(t){this._enabled&&(this.setState(o.states.HOVER),this.dispatch(o.events.HOVER,{originalEvent:t}))},setState:function(t){this.state=t,this.dispatch(o.events.STATECHANGE,{state:this.state})},setEnabled:function(t){this._enabled=t,this._enabled?this.setState(o.states.UP):this.setState(o.states.DISABLED)},isEnabled:function(){return this._enabled},contains:function(t,e){var i=this.getStageX(),s=this.getStageY();return i<=t&&t<i+this.width&&s<=e&&e<s+this.height}}),o.IDENTITY=new o,o}),n("j13e/display/J13ButtonManager",["require","exports","module","../utils/J13Utils","../utils/J13EventDispatcher","./J13DisplayButton"],function(t,e,i){"use strict";var s=t("../utils/J13Utils"),n=t("../utils/J13EventDispatcher"),a=t("./J13DisplayButton");function o(t){var e,i=(t||{}).buttons||[];for(this.buttons=[],this.downedButton=null,this.hoveredButton=null,e=0;e<i.length;e+=1)this.addButton(i[e])}return o.events={DOWN:"down",UP:"up",HOVERIN:"hoverin",HOVEROUT:"hoverout",MOVE:"move",CLICK:"click"},o.prototype=s.inherit(new n,{events:o.events,addButton:function(t){return-1===this.buttons.indexOf(t)&&(this.buttons.push(t),!0)},removeButton:function(t){t=this.buttons.indexOf(t);return-1!==t&&(this.buttons.splice(t,1),!0)},onDown:function(t){var e,i;this.downedButton||(e=t.data.scaledX,i=t.data.scaledY,this.downedButton=this.getButtonFromCoords(e,i),this.downedButton&&(this.hoveredButton=null,this.downedButton.down(t),this.dispatch(o.events.DOWN,{button:this.downedButton})))},onMove:function(t){var e=t.data.scaledX,i=t.data.scaledY;this.downedButton?this.downedButton.state===a.states.UP&&this.downedButton.contains(e,i)?this.downedButton.down(t):this.downedButton.state!==a.states.DOWN||this.downedButton.contains(e,i)||this.downedButton.up(t):this.hoveredButton?this.hoveredButton.contains(e,i)||(this.hoveredButton.up(t),this.dispatch(o.events.HOVEROUT,{button:this.hoveredButton}),this.hoveredButton=null):(e=this.getButtonFromCoords(e,i))&&((this.hoveredButton=e).hover(t),this.dispatch(o.events.HOVERIN,{button:this.hoveredButton}))},onUp:function(t){this.downedButton&&(this.downedButton.state===a.states.DOWN&&(this.downedButton.click(),this.dispatch(o.events.CLICK,{button:this.downedButton})),this.downedButton.up(t),this.dispatch(o.events.UP,{button:this.downedButton}),this.downedButton=null)},getButtonFromCoords:function(t,e){for(var i=this.buttons.length-1;0<=i;--i)if(this.buttons[i].isEnabled()&&this.buttons[i].isVisibleOnStage()&&this.buttons[i].contains(t,e))return this.buttons[i];return null}}),o}),n("j13e/anim/J13Anim",["require","exports","module"],function(t,e,i){"use strict";function s(t){t=t||{};this.id=t.id||"anim-"+s.IDPOOL++,this.manager=t.manager,this.startValue=t.startValue||0,this.endValue=t.endValue||0,this.timeFunction=t.timeFunction||s.easingFunctions.linear,this.startCallback=t.startCallback||null,this.stepCallback=t.stepCallback||null,this.endCallback=t.endCallback||null,this.duration=t.hasOwnProperty("duration")?t.duration:0,this.restartRequested=!1,this.prepared=!1,this.startTime=-1,this.endTime=-1}return s.IDPOOL=0,s.easingFunctions={linear:function(t){return t},easeInQuad:function(t){return t*t},easeOutQuad:function(t){return t*(2-t)},easeInOutQuad:function(t){return t<.5?2*t*t:(4-2*t)*t-1},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return--t*t*t+1},easeInOutCubic:function(t){return t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return 1- --t*t*t*t},easeInOutQuart:function(t){return t<.5?8*t*t*t*t:1-8*--t*t*t*t},easeInQuint:function(t){return t*t*t*t*t},easeOutQuint:function(t){return 1+--t*t*t*t*t},easeInOutQuint:function(t){return t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t}},s.prototype={recalculateDuration:function(){},requestRestart:function(){this.restartRequested=!0},preStart:function(){this.prepared=!1,this.startTime=-1,this.endTime=-1,this.restartRequested=!1,this.recalculateDuration()},start:function(t){this.prepared=!0,this.startTime=t,this.endTime=t+this.duration,this.restartRequested=!1,this.startCallback&&this.startCallback(this.startValue,0,0)},step:function(t,e){var i=this.timeFunction(t),s=this.startValue+(this.endValue-this.startValue)*i;this.stepCallback&&this.stepCallback(s,i,t)},end:function(){this.prepared=!1,this.startTime=-1,this.endTime=-1,this.endCallback&&this.endCallback(this.endValue,1,1)},stop:function(){this.prepared=!1,this.startTime=-1,this.endTime=-1}},s}),n("j13e/anim/J13AnimSequence",["require","exports","module","../utils/J13Utils","./J13Anim"],function(t,e,i){"use strict";var s=t("../utils/J13Utils"),a=t("./J13Anim");function n(t){var e=t||{};a.call(this,t),this.anims=e.anims||[],this.recalculateDuration(),this.currentIndex=this.anims.length}return n.prototype=s.inherit(new a,{recalculateDuration:function(){for(var t=0,e=0;e<this.anims.length;e+=1)t+=this.anims[e].duration;this.duration=t},preStart:function(){for(var t=0;t<this.anims.length;t+=1)this.anims[t].preStart();a.prototype.preStart.call(this)},start:function(t){var e,i,s=0;for(this.currentIndex=0,a.prototype.start.call(this,t),e=0;e<this.anims.length;e+=1)(i=this.anims[e]).startTime=t+s,i.endTime=i.startTime+i.duration,s+=i.duration},step:function(t,e){if(a.prototype.step.call(this,t,e),this.currentIndex<this.anims.length)for(var i,s,n;n=!1,(i=this.anims[this.currentIndex])&&(i.prepared||i.start(i.startTime),e>=i.startTime&&e<i.endTime?(s=(e-i.startTime)/i.duration,i.step(s,e),n=!1):e>=i.endTime&&(i.step(1,e),i.end(),this.currentIndex+=1,n=!0)),n;);},end:function(){a.prototype.end.call(this),this.currentIndex=this.anims.length},stop:function(){var t;for(a.prototype.stop.call(this),this.currentIndex=this.anims.length,t=0;t<this.anims.length;t+=1)this.anims[t].stop()}}),n}),n("src/utils/GameStateManager",["require","exports","module","j13e/utils/J13Utils","j13e/anim/J13Anim","j13e/anim/J13AnimSequence","j13e/utils/J13EventDispatcher"],function(t,e,i){"use strict";var s=t("j13e/utils/J13Utils"),a=t("j13e/anim/J13Anim"),o=t("j13e/anim/J13AnimSequence"),t=t("j13e/utils/J13EventDispatcher");function r(t){var e=t||{};this.game=e.game||null,this.animManager=e.animManager||null,this.states={},this.currentState=null,this.oldState=null,this.newState=null,this.transitioning=!1,this.queue=[],e.states&&(Array.isArray(e.states)?e.states.forEach(function(t){this.states[t.id]=t},this):s.isNativeObject(e.states)&&Object.keys(e.states).forEach(function(t){this.states[t]=e.states[t]},this)),e.startState&&this.toState(e.startState)}return r.events={stageChanged:"statechanged",transitionStarted:"transitionstarted",transitionEnded:"transitionended"},r.prototype=s.inherit(new t,{events:r.events,getCurrentStateId:function(){return this.currentState?this.currentState.id:null},addState:function(t,e){e=e||t.id,this.states[e]=t},removeState:function(t){t="string"==typeof t?t:t.id;t&&delete this.states[t]},toState:function(t,e,i,s){var n;this.transitioning&&s?this.queue.push({stateOrId:t,data:e,noAnim:i}):(n="string"==typeof t?this.states[t]:t,s=[],this.transitioning=!0,this.dispatch(r.events.transitionStarted,{oldState:this.currentState,newState:n}),s.push(new a({duration:0,startCallback:function(){this.newState=n,this.newState&&this.newState.preStart(this.game,e),this.currentState&&this.currentState.preEnd(this.game,e)}.bind(this)})),this.currentState&&this.currentState.endAnim&&s.push(this.currentState.endAnim),s.push(new a({duration:0,startCallback:function(){this.oldState=this.currentState,this.currentState=this.newState,this.newState=null,this.dispatch(r.events.stageChanged,{newState:this.currentState,oldState:this.oldState}),this.oldState&&this.oldState.end(this.game,e),this.currentState&&this.currentState.start(this.game,e)}.bind(this)})),n&&n.startAnim&&s.push(n.startAnim),s.push(new a({duration:0,startCallback:function(){this.currentState&&this.currentState.postStart(this.game,e),this.oldState&&this.oldState.postEnd(this.game,e);var t=this.oldState;this.oldState=null,this.transitioning=!1,this.dispatch(r.events.transitionEnded,{oldState:t,newState:this.currentState}),0<this.queue.length&&(t=this.queue.shift(),this.toState(t.stateOrId,t.data,t.noAnim))}.bind(this)})),this.animManager&&!i?(t=new o({anims:s}),this.animManager.startAnim(t)):s.forEach(function(t){t.startCallback(t.startValue,0,0),t.stepCallback(t.startValue,0,0),t.stepCallback(t.endValue,1,1),t.endCallback(t.endValue,1,1)}))}}),r}),n("src/utils/Scouter",["require","exports","module","src/Resources","src/utils/Common","src/Settings","src/Game","src/efs/EfManager","j13e/utils/J13Utils","j13e/display/J13ButtonManager","src/utils/GameStateManager"],function(t,e,i){"use strict";var s=t("src/Resources"),o=t("src/utils/Common"),r=t("src/Settings"),n=(t("src/Game"),t("src/efs/EfManager")),a=t("j13e/utils/J13Utils"),h=t("j13e/display/J13ButtonManager"),l=t("src/utils/GameStateManager");function d(t){t=t||{};this.game=t.game||null,this.pageObj={page:r.cocoon?"/native":location.pathname,title:document.title},this.platform=d.web,this.debugTrace=t.debugTrace||!1,this.sendToGA=!t.hasOwnProperty("sendToGA")||t.sendToGA,this.init()}return d.platforms={kik:"kik",web:"web",native:"native"},d.prototype={init:function(){this.game.addListener(s.events.gameInitted,this.gameInitted.bind(this)),this.game.engine.buttonManager.addListener(h.events.CLICK,this.onButtonClick.bind(this)),s.adManager.addListener(n.events.INTERSTITIALSHOWN,this.onAdShow.bind(this)),s.adManager.addListener(n.events.INTERSTITIALHIDDEN,this.onAdClose.bind(this)),s.gsm.addListener(l.events.stageChanged,this.onStateChange.bind(this))},gameInitted:function(t){var e,i={},s=!1,n=this.game.initialUrlQuery,a=o.paramStringToObject(window.location.hash.replace("#",""));for(e in r.kik&&(s=i.kik=!0),n)n.hasOwnProperty(e)&&(i[e]=n[e],s=!0);for(e in a)if(a.hasOwnProperty(e))switch(e){case"utm_source":case"utm_medium":case"utm_term":case"utm_content":case"utm_campaign":i[e]=a[e],s=!0}s&&this.gaSetCurrentPage((r.cocoon?"/native?":"/?")+o.objectToParamString(i),document.title),this.gaPageView(),r.kik?this.platform=d.platforms.kik:"true"===n.native||"1"===n.native||r.cocoon?this.platform=d.platforms.native:this.platform=d.platforms.web},onButtonClick:function(t){if(t&&t.data&&t.data.button&&t.data.button.id){var e="button-clicked-"+this.platform,i=null;switch(t.data.button.id){case s.buttons.start:i="button-play";break;case s.buttons.retry:i="button-retry";break;case s.buttons.hiScore:i="button-hi-score";break;case s.buttons.menu:i="button-menu";break;case s.buttons.kik:i="button-kik-share";break;case s.buttons.version:i="button-version";break;case s.buttons.volume:i="button-volume"}e&&(i&&(i+="-"+this.platform),this.gaEvent("gameevent",e,i))}},onAdShow:function(t){var e;t.data&&t.data.ad&&(t="ad-"+this.platform,e="ad-show-"+this.platform,this.gaEvent("gameevent",t,e))},onAdClose:function(t){var e;t.data&&t.data.ad&&(t="ad-"+this.platform,e="ad-close-"+this.platform,this.gaEvent("gameevent",t,e))},onStateChange:function(t){var e,i;t&&t.data&&t.data.newState&&t.data.newState.id&&(i=e=null,t.data.newState.id===s.gameStates.hiScore&&(e="gameover-"+this.platform,i="gameover-bounces-"+this.game.playScreen.playViewport.bounces+"-"+this.platform,window.gmga&&window.gmga("gamedone")),e&&this.gaEvent("gameevent",e,i,null))},sendGameOver:function(){var t="gameover-"+this.platform,e="gameover-bounces-"+this.game.playScreen.playViewport.bounces+"-"+this.platform;window.gmga&&window.gmga("gamedone"),t&&this.gaEvent("gameevent",t,e,null)},gaSend:function(t){window.ga&&(this.sendToGA&&window.ga("send",t),this.debugTrace&&console.log("gaevent:",t))},gaEvent:function(t,e,i,s){window.ga&&(this.sendToGA&&window.ga("send","event",t,e,i,s),this.debugTrace&&console.log("gaevent:","event",t,e,i,s))},gaNonInteractionEvent:function(t,e,i,s){this.gaSend({hitType:"event",eventCategory:t,eventAction:e,eventLabel:i,eventValue:s,nonInteraction:1})},gaPageView:function(t){window.ga&&(t=t?a.extendObj(this.pageObj,t):this.pageObj,this.sendToGA&&window.ga("send","pageview",t),this.debugTrace&&console.log("gaevent:","pageview",t))},gaSetCurrentPage:function(t,e){this.pageObj={page:t,title:e},this.gaSet(this.pageObj)},gaSet:function(t){window.ga&&(this.sendToGA&&window.ga("set",t),this.debugTrace&&console.log("gaevent:","set",t))}},d}),n("src/utils/GameState",["require","exports","module"],function(t,e,i){"use strict";return function(t){t=t||{},this.id=t.id||null,this.preStart=t.preStart||function(){},this.startAnim=t.startAnim||null,this.start=t.start||function(){},this.postStart=t.postStart||function(){},this.preEnd=t.preEnd||function(){},this.endAnim=t.endAnim||null,this.end=t.end||function(){},this.postEnd=t.postEnd||function(){}}}),n("j13e/display/J13DisplayDrawOptions",["require","exports","module","../utils/J13Utils"],function(t,e,i){"use strict";var s=t("../utils/J13Utils");function n(t){t=t||{};this.fillStyle=t.fillStyle||null,this.strokeStyle=t.strokeStyle||null,this.lineCap=t.lineCap||null,this.lineJoin=t.lineJoin||null,this.lineWidth=t.hasOwnProperty("lineWidth")?t.lineWidth:null,this.shadowColor=t.shadowColor||null,this.shadowBlur=t.hasOwnProperty("shadowBlur")?t.shadowBlur:null,this.shadowOffsetX=t.hasOwnProperty("shadowOffsetX")?t.shadowOffsetX:null,this.shadowOffsetY=t.hasOwnProperty("shadowOffsetY")?t.shadowOffsetY:null,this.miterLimit=t.hasOwnProperty("miterLimit")?t.miterLimit:null,this.postPathOptions=s.extendObj({x:null,y:null,anchorX:null,anchorY:null,angle:null,scaleX:null,scaleY:null},t.postPathOptions||{}),t.postPathOptions&&t.postPathOptions.hasOwnProperty("scale")&&(this.postPathOptions.scaleX=this.postPathOptions.scaleY=t.postPathOptions.scale)}return n.prototype={drawFlags:n.drawFlags={OUTLINE_BEHIND:1,FILL:2,OUTLINE_FRONT:4},applyOptions:function(t){null!==this.fillStyle&&(t.fillStyle=this.fillStyle),null!==this.strokeStyle&&(t.strokeStyle=this.strokeStyle),null!==this.lineCap&&(t.lineCap=this.lineCap),null!==this.lineJoin&&(t.lineJoin=this.lineJoin),null!==this.lineWidth&&(t.lineWidth=this.lineWidth),null!==this.shadowColor&&(t.shadowColor=this.shadowColor),null!==this.shadowBlur&&(t.shadowBlur=this.shadowBlur),null!==this.shadowOffsetX&&(t.shadowOffsetX=this.shadowOffsetX),null!==this.shadowOffsetY&&(t.shadowOffsetY=this.shadowOffsetY),null!==this.miterLimit&&(t.miterLimit=this.miterLimit)},applyPostPathOptions:function(t){null!==this.postPathOptions.x&&t.translate(this.postPathOptions.x,0),null!==this.postPathOptions.y&&t.translate(0,this.postPathOptions.y),null!==this.postPathOptions.anchorX&&t.translate(this.postPathOptions.anchorX,0),null!==this.postPathOptions.anchorY&&t.translate(0,this.postPathOptions.anchorY),null!==this.postPathOptions.angle&&t.rotate(this.postPathOptions.angle),null!==this.postPathOptions.scaleX&&t.scale(this.postPathOptions.scaleX,1),null!==this.postPathOptions.scaleY&&t.scale(1,this.postPathOptions.scaleY),null!==this.postPathOptions.anchorX&&t.translate(-this.postPathOptions.anchorX,0),null!==this.postPathOptions.anchorY&&t.translate(0,-this.postPathOptions.anchorY)}},n}),n("j13e/display/J13DisplayRect",["require","exports","module","../math/J13Rect","./J13DisplayDrawOptions","./J13DisplayItem","../utils/J13Utils"],function(t,e,i){"use strict";var s=t("../math/J13Rect"),n=t("./J13DisplayDrawOptions"),a=t("./J13DisplayItem"),t=t("../utils/J13Utils");function o(t){var e=t||{};a.call(this,t),this.rect=e.rect||new s(e),this.rect&&!s.isJ13Rect(this.rect,!0)&&s.canBeJ13Rect(this.rect)&&(this.rect=new s(this.rect)),this.drawOptions=e.drawOptions||new n(t),this.drawFlags=e.drawFlags||n.drawFlags.FILL}return o.prototype=t.inherit(new a,{render:function(t,e,i,s){s=s.canvasContext;this.drawOptions.applyOptions(s),s.beginPath(),s.rect(this.rect.left,this.rect.top,this.rect.getWidth(),this.rect.getHeight()),s.closePath(),this.drawOptions.applyPostPathOptions(s),0<(this.drawFlags&n.drawFlags.OUTLINE_BEHIND)&&s.stroke(),0<(this.drawFlags&n.drawFlags.FILL)&&s.fill(),0<(this.drawFlags&n.drawFlags.OUTLINE_FRONT)&&s.stroke()}}),o}),n("j13e/display/J13DisplayItemContainer",["require","exports","module","./J13DisplayItem","../utils/J13Utils"],function(t,e,i){"use strict";var s=t("./J13DisplayItem"),t=t("../utils/J13Utils");function n(t){s.call(this,t),this.children=[]}return n.events={childAdded:"childadded",childRemoved:"childremoved",anyChildAdded:"anychildadded",anyChildRemoved:"anychildremoved"},n.prototype=t.inherit(new s,{events:n.events,render:function(t,e,i,s){for(var n=-1;++n<this.children.length;)this.children[n].stageRender(t,e,i,s)},addChild:function(t){return-1===this.children.indexOf(t)&&((t.parent=this).children.push(t),t.dispatch(s.events.added,{parent:this}),this.dispatch(n.events.childAdded,{child:t}),this.dispatchAnyChildAdded(t),!0)},addChildAt:function(t,e){var i=this.children.indexOf(t);return-1!==i&&this.children.splice(i,1),e>=this.children.length?(t.parent=this).children.push(t):this.children.splice(i,0,t),-1===i&&(t.dispatch(s.events.added,{parent:this}),this.dispatch(n.events.childAdded,{child:t}),this.dispatchAnyChildAdded(t)),this.children.length},removeChild:function(t){var e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatch(s.events.removed,{parent:this}),this.dispatch(n.events.childRemoved,{child:t}),this.dispatchAnyChildRemoved(t),!0)},removeChildAt:function(t){var e;return t<this.children.length?((e=this.children[t]).parent=null,this.children.splice(t,1),e.dispatch(s.events.removed,{parent:this}),this.dispatch(n.events.childRemoved,{child:e}),this.dispatchAnyChildRemoved(e),e):null},getAllChildren:function(){for(var t=[],e=0;e<this.children;e+=1)t.push(this.children[e]),this.children[e].getAllChildren&&(t=t.concat(this.children[e].getAllChildren()));return t},dispatchAddedToStage:function(t){for(var e=0;e<this.children.length;e+=1)this.children[e].dispatchAddedToStage(t);s.prototype.dispatchAddedToStage.call(this,t)},dispatchRemovedFromStage:function(t){for(var e=0;e<this.children.length;e+=1)this.children[e].dispatchRemovedFromStage(t);s.prototype.dispatchRemovedFromStage.call(this,t)},dispatchAnyChildAdded:function(t){this.dispatch(n.events.anyChildAdded,{child:t}),this.parent&&this.parent.dispatchAnyChildAdded(t)},dispatchAnyChildRemoved:function(t){this.dispatch(n.events.anyChildRemoved,{child:t}),this.parent&&this.parent.dispatchAnyChildRemoved(t)}}),n}),n("j13e/display/J13DisplayText",["require","exports","module","./J13DisplayDrawOptions","../utils/J13Utils","./J13DisplayItem","../utils/J13DOM"],function(t,e,i){"use strict";var n=t("./J13DisplayDrawOptions"),s=t("../utils/J13Utils"),a=t("./J13DisplayItem"),o=t("../utils/J13DOM");function r(t){var e=t||{};a.call(this,t),this.drawOptions=e.drawOptions||new n(t),this.drawFlags=e.drawFlags||n.drawFlags.FILL,this.textAlign=e.textAlign||"left",this.textBaseline=e.textBaseline||"top",this.text=e.text||"",this.font=e.font||null}return r.textMeasureCanvas=null,r.prototype=s.inherit(new a,{render:function(t,e,i,s){s=s.canvasContext;this.font&&(s.font=this.font),this.drawOptions.applyOptions(s),s.textAlign=this.textAlign,s.textBaseline=this.textBaseline,0<(this.drawFlags&n.drawFlags.OUTLINE_BEHIND)&&s.strokeText(this.text,0,0),0<(this.drawFlags&n.drawFlags.FILL)&&s.fillText(this.text,0,0),0<(this.drawFlags&n.drawFlags.OUTLINE_FRONT)&&s.strokeText(this.text,0,0)},getTextWidth:function(){null===r.textMeasureCanvas&&((r.textMeasureCanvas=o.create("canvas")).width=1,r.textMeasureCanvas.height=1);var t=r.textMeasureCanvas.getContext("2d");return t.font=this.font,t.measureText(this.text).width}}),r}),n("src/screens/PreloadScreen",["require","exports","module","src/Resources","j13e/utils/J13Utils","j13e/math/J13Rect","j13e/display/J13DisplayRect","j13e/display/J13DisplayItemContainer","j13e/display/J13DisplayText"],function(t,e,i){"use strict";t("src/Resources");var s=t("j13e/utils/J13Utils"),n=t("j13e/math/J13Rect"),a=t("j13e/display/J13DisplayRect"),o=t("j13e/display/J13DisplayItemContainer"),r=t("j13e/display/J13DisplayText");function h(t){var e=t||{};o.call(this,t),this.width=e.width||0,this.height=e.height||0,this.prefix=e.prefix||"",this.suffix=e.suffix||"",this.bg=new a({rect:new n({width:this.width,height:this.height}),fillStyle:"rgb("+h.bgColors.start.r+","+h.bgColors.start.g+","+h.bgColors.start.b+")",opacity:1}),this.addChild(this.bg),this.preloadText=new r({font:"30px Arial",fillStyle:"#ffffff",text:"Loading..",textBaseline:"middle",textAlign:"center",x:this.width/2,y:this.height/2}),this.addChild(this.preloadText),this.overlay=new a({rect:new n({width:this.width,height:this.height}),fillStyle:"#000000",opacity:0}),this.addChild(this.overlay)}return h.bgColors={start:{r:0,g:135,b:147},end:{r:78,g:192,b:202}},h.prototype=s.inherit(new o,{setBar:function(t){var e=h.bgColors.start,i=h.bgColors.end,s=Math.round((i.r-e.r)*t+e.r),n=Math.round((i.g-e.g)*t+e.g),i=Math.round((i.b-e.b)*t+e.b);this.bg.drawOptions.fillStyle="rgb("+s+","+n+","+i+")"},setText:function(t,e){this.preloadText.text=t},setPrefix:function(t){this.prefix=t},setSuffix:function(t){this.suffix=t},setPercent:function(t,e){this.preloadText.text=this.prefix+Math.floor(t)+"%"+this.suffix,this.setBar(t/100)},show:function(){this.visible=!0},hide:function(){this.visible=!1}}),h}),n("src/utils/Updatable",["require","exports","module"],function(t,e,i){"use strict";function s(t){}return s.prototype={update:function(t,e,i,s){}},s}),n("src/utils/ActionObject",["require","exports","module","./Updatable","j13e/math/J13Rect","j13e/utils/J13Utils","j13e/math/J13Vec2"],function(t,e,i){"use strict";var s=t("./Updatable"),n=t("j13e/math/J13Rect"),a=t("j13e/utils/J13Utils"),o=t("j13e/math/J13Vec2");function r(t){var e=t||{};s.call(this,t),this.x=e.x||0,this.y=e.y||0,this.angle=e.angle||0,this.anchorX=e.anchorX||0,this.anchorY=e.anchorY||0,this.scaleX=e.hasOwnProperty("scaleX")?e.scaleX:1,this.scaleY=e.hasOwnProperty("scaleY")?e.scaleY:1,e.hasOwnProperty("scale")&&(this.scaleX=this.scaleY=e.scale),this.opacity=e.hasOwnProperty("opacity")?e.opacity:1,this.visible=!e.hasOwnProperty("visible")||e.visible,this.velocity=e.velocity||new o,this.accel=e.accel||new o,this.angularVelocity=0,this.prevAngle=this.angle,this.angleVec=new o(Math.cos(this.angle),Math.sin(this.angle)),this._hitRect=e.hitRect||new n,this.hitRect=new n(this._hitRect),this.displayItem=e.displayItem||null,this.updateHitRect(),this.updateDisplayItem()}return r.prototype=a.inherit(new s,{maxAccel:Number.MAX_VALUE,maxSpeed:Number.MAX_VALUE,maxAngularSpeed:Number.MAX_VALUE,update:function(t,e,i,s){this.updatePosition(t,e,i,s),this.updateHitRect(),this.updateDisplayItem()},calculateAngleVec:function(){this.angle!==this.prevAngle&&(this.angleVec.x=Math.cos(this.angle),this.angleVec.y=Math.sin(this.angle),this.prevAngle=this.angle)},limitVelocity:function(t){this.maxSpeed<Number.MAX_VALUE&&this.velocity.lengthSquared()>t*t&&(this.velocity.normalize(),this.velocity.multiply(t))},limitAccel:function(t){this.maxAccel<Number.MAX_VALUE&&this.accel.lengthSquared()>t*t&&(this.accel.normalize(),this.accel.multiply(t))},limitAngularVelocity:function(t){this.maxAngularSpeed<Number.MAX_VALUE&&Math.abs(this.angularVelocity)>t&&(this.angularVelocity=0<this.angularVelocity?t:-t)},updatePosition:function(t,e,i,s){this.limitAngularVelocity(this.maxAngularSpeed),this.angle+=this.angularVelocity*e,this.limitAccel(this.maxAccel),this.velocity.x+=this.accel.x*e,this.velocity.y+=this.accel.y*e,this.limitVelocity(this.maxSpeed),this.x+=this.velocity.x*e,this.y+=this.velocity.y*e},updateHitRect:function(){this.hitRect.setPosition(this.x+this._hitRect.left,this.y+this._hitRect.top),this.hitRect.setWidth(this._hitRect.getWidth()),this.hitRect.setHeight(this._hitRect.getHeight())},updateDisplayItem:function(){this.displayItem&&(this.displayItem.x=this.x,this.displayItem.y=this.y,this.displayItem.angle=this.angle,this.displayItem.anchorX=this.anchorX,this.displayItem.anchorY=this.anchorY,this.displayItem.scaleX=this.scaleX,this.displayItem.scaleY=this.scaleY,this.displayItem.opacity=this.opacity,this.displayItem.visible=this.visible)}}),r}),n("src/viewports/playparts/Bird",["require","exports","module","src/utils/ActionObject","src/Resources","j13e/display/J13DisplayItemContainer","j13e/utils/J13Utils"],function(t,e,i){"use strict";var a=t("src/utils/ActionObject"),s=t("src/Resources"),n=t("j13e/display/J13DisplayItemContainer"),t=t("j13e/utils/J13Utils");function o(t){a.call(this,t),this.sprite=s.birdSheet.getSprite("yellow"),this.displayItem=new n({}),this.displayItem.addChild(this.sprite),this.width=this.sprite.destRect.getWidth(),this.height=this.sprite.destRect.getHeight(),this._hitRect.setWidth(this.height),this._hitRect.setHeight(this.height),this._hitRect.setX(-this._hitRect.getWidth()/2),this._hitRect.setY(-this._hitRect.getHeight()/2),this.state=o.states.idle,this.startingX=this.x,this.startingY=this.y}return o.frameDelay={flapping:50,idle:200},o.frameOrder=["mid","up","mid","down"],o.states={idle:1,flapping:2,falling:3,dying:4,dead:5},o.minAngle=-Math.PI/4,o.maxAngle=Math.PI/2,o.flappingAngularVelocity=2*-Math.PI,o.fallingAngularVelocity=Math.PI,o.idleAccelY=0,o.aliveAccelY=1500,o.flapSpeedX=225,o.flapSpeedY=-450,o.prototype=t.inherit(new a,{isIdle:function(){return this.state===o.states.idle},isAlive:function(){return this.state===o.states.flapping||this.state===o.states.falling},isDying:function(){return this.state===o.states.dying},isDead:function(){return this.state===o.states.dead},reset:function(){this.changeToState(o.states.idle),this.x=this.startingX,this.y=this.startingY,this.scaleX=1},changeToState:function(t){var e=this.state;switch(t){case o.states.idle:this.sprite.angle=0,this.accel.y=o.idleAccelY;break;case o.states.flapping:e===o.states.idle&&(this.velocity.x=o.flapSpeedX),this.accel.y=o.aliveAccelY,this.velocity.y=o.flapSpeedY;break;case o.states.falling:this.sprite.setFrameId("mid");break;case o.states.dying:this.sprite.setFrameId("mid"),this.velocity.x=0;break;case o.states.dead:this.sprite.setFrameId("mid"),this.accel.y=o.idleAccelY,this.velocity.y=0}this.state=t},flap:function(){(this.isAlive()||this.isIdle())&&this.changeToState(o.states.flapping)},flip:function(){this.velocity.x*=-1,this.scaleX*=-1},kill:function(){this.changeToState(o.states.dying)},hitGround:function(t){this.changeToState(o.states.dead),this.y=t},update:function(t,e,i,s){var n;this.state===o.states.idle?(n=Math.floor(i/o.frameDelay.idle)%o.frameOrder.length,this.sprite.setFrameId(o.frameOrder[n])):this.state===o.states.flapping?(n=Math.floor(i/o.frameDelay.flapping)%o.frameOrder.length,this.sprite.setFrameId(o.frameOrder[n]),this.sprite.angle>o.minAngle&&(this.sprite.angle+=o.flappingAngularVelocity*e),0<this.velocity.y&&this.changeToState(o.states.falling)):this.state===o.states.falling?this.sprite.angle<o.maxAngle&&(this.sprite.angle+=o.fallingAngularVelocity*e):this.state===o.states.dying?0<this.velocity.y&&this.sprite.angle<o.maxAngle&&(this.sprite.angle+=o.fallingAngularVelocity*e):this.state===o.states.dead&&this.sprite.angle<o.maxAngle&&(this.sprite.angle+=o.fallingAngularVelocity*e),a.prototype.update.call(this,t,e,i,s),this.state!==o.states.flapping&&this.state!==o.states.falling&&this.state!==o.states.dying||(this.sprite.angle<=o.minAngle?this.sprite.angle=o.minAngle:this.sprite.angle>=o.maxAngle&&(this.sprite.angle=o.maxAngle))}}),o}),n("j13e/display/J13DisplayImg",["require","exports","module","./J13DisplayItem","../math/J13Rect","../utils/J13Utils"],function(t,e,i){"use strict";var s=t("./J13DisplayItem"),n=t("../math/J13Rect"),t=t("../utils/J13Utils");function a(t){var e=t||{};s.call(this,t),this.image=e.image||e.img||null,this.sourceRect=e.sourceRect||null,this.destRect=e.destRect||null,this.sourceRect&&!n.isJ13Rect(this.sourceRect,!0)&&n.canBeJ13Rect(this.sourceRect)&&(this.sourceRect=new n(this.sourceRect)),this.destRect&&!n.isJ13Rect(this.destRect,!0)&&n.canBeJ13Rect(this.destRect)&&(this.destRect=new n(this.destRect)),!this.sourceRect&&this.image&&(this.sourceRect=new n({left:0,top:0,right:this.image.width,bottom:this.image.height})),!this.destRect&&this.image&&(this.destRect=this.sourceRect.copy())}return a.prototype=t.inherit(new s,{render:function(t,e,i,s){s=s.canvasContext;try{s.drawImage(this.image,this.sourceRect.left,this.sourceRect.top,this.sourceRect.getWidth(),this.sourceRect.getHeight(),this.destRect.left,this.destRect.top,this.destRect.getWidth(),this.destRect.getHeight())}catch(t){console.log(t.message),console.log(this)}},setSourceRectFromImage:function(t){this.sourceRect.setPosition(0,0),this.sourceRect.setWidth(t.width),this.sourceRect.setHeight(t.height)},setDestRectFromImage:function(t){this.destRect.setPosition(0,0),this.destRect.setWidth(t.width),this.destRect.setHeight(t.height)}}),a}),n("src/viewports/playparts/Pipe",["require","exports","module","src/Resources","j13e/math/J13Rect","j13e/display/J13DisplayImg","j13e/utils/J13Utils"],function(t,e,i){"use strict";var s=t("src/Resources"),n=t("j13e/math/J13Rect"),a=t("j13e/display/J13DisplayImg"),o=t("j13e/utils/J13Utils");function r(t){var t=t||{},e=(this.side=t.side||r.sides.left,this.leftWallX=t.leftWallX||0,this.rightWallX=t.rightWallX||0,s.loadedImages[s.images.pipe]);a.call(this,o.extendObj({img:e,anchorY:e.height,scaleY:-1},t)),this.side===r.sides.left?(this.anchorX=0,this.scaleX=1,this.x=this.leftWallX,this.hitRect=new n({x:0,y:this.y,width:e.width,height:e.height})):this.side===r.sides.right&&(this.anchorX=0,this.scaleX=-1,this.x=this.rightWallX,this.hitRect=new n({x:this.rightWallX-e.width,y:this.y,width:e.width,height:e.height}))}return r.sides={left:1,right:2},r.prototype=o.inherit(new a,{}),r}),n("j13e/display/J13DisplayCircle",["require","exports","module","../utils/J13Utils","./J13DisplayItem","./J13DisplayDrawOptions"],function(t,e,i){"use strict";var s=t("../utils/J13Utils"),n=t("./J13DisplayItem"),a=t("./J13DisplayDrawOptions");function o(t){var e=t||{};n.call(this,t),this.radius=e.radius||5,this.startAngle=e.hasOwnProperty("startAngle")?e.startAngle:0,this.endAngle=e.hasOwnProperty("endAngle")?e.endAngle:2*Math.PI,this.counterclockwise=!!e.hasOwnProperty("counterclockwise")&&e.counterclockwise,this.closeLoop=!e.hasOwnProperty("closeLoop")||e.closeLoop,e.hasOwnProperty("ccw")&&(this.counterclockwise=e.ccw),this.drawOptions=e.drawOptions||new a(t),this.drawFlags=e.drawFlags||a.drawFlags.FILL}return o.prototype=s.inherit(new n,{render:function(t,e,i,s){s=s.canvasContext;this.drawOptions.applyOptions(s),s.beginPath(),s.arc(0,0,this.radius,this.startAngle,this.endAngle,this.counterclockwise),this.closeLoop&&s.closePath(),this.drawOptions.applyPostPathOptions(s),0<(this.drawFlags&a.drawFlags.OUTLINE_BEHIND)&&s.stroke(),0<(this.drawFlags&a.drawFlags.FILL)&&s.fill(),0<(this.drawFlags&a.drawFlags.OUTLINE_FRONT)&&s.stroke(),this.closeLoop||s.closePath()}}),o}),n("j13e/anim/J13AnimGroup",["require","exports","module","./J13Anim","../utils/J13Utils"],function(t,e,i){"use strict";var s=t("./J13Anim"),t=t("../utils/J13Utils");function n(t){var e=t||{};s.call(this,t),this.anims=e.anims||[],this.applyDuration=e.hasOwnProperty("applyDuration")||-1,this.recalculateDuration()}return n.prototype=t.inherit(new s,{recalculateDuration:function(){var t,e,i=0;if(-1!==this.applyDuration)for(this.duration=this.applyDuration,t=0;t<this.anims.length;t+=1)this.anims[t].duration=this.duration;else{for(t=0;t<this.anims.length;t+=1)(e=this.anims[t]).duration>i&&(i=e.duration);this.duration=i}},preStart:function(){for(var t=0;t<this.anims.length;t+=1)this.anims[t].preStart();s.prototype.preStart.call(this)},start:function(t){var e;for(s.prototype.start.call(this,t),e=0;e<this.anims.length;e+=1)this.anims[e].start(t)},step:function(t,e){var i;for(s.prototype.step.call(this,t,e),i=0;i<this.anims.length;i+=1)this.anims[i].step(t,e)},end:function(){var t;for(s.prototype.end.call(this),t=0;t<this.anims.length;t+=1)this.anims[t].end()},stop:function(){var t;for(s.prototype.stop.call(this),t=0;t<this.anims.length;t+=1)this.anims[t].stop()}}),n}),n("src/viewports/PlayViewport",["require","exports","module","src/Resources","src/utils/Updatable","./playparts/Bird","./playparts/Pipe","src/utils/Common","j13e/math/J13Vec2","j13e/utils/J13Utils","j13e/math/J13Math","j13e/math/J13Rect","j13e/display/J13DisplayImg","j13e/display/J13DisplayText","j13e/display/J13DisplayRect","j13e/display/J13DisplayCircle","j13e/display/J13DisplayItemContainer","j13e/utils/J13EventDispatcher","j13e/anim/J13Anim","j13e/anim/J13AnimGroup","j13e/anim/J13AnimSequence"],function(t,e,i){"use strict";var r=t("src/Resources"),s=t("src/utils/Updatable"),h=t("./playparts/Bird"),l=t("./playparts/Pipe"),n=(t("src/utils/Common"),t("j13e/math/J13Vec2"),t("j13e/utils/J13Utils")),d=(t("j13e/math/J13Math"),t("j13e/math/J13Rect")),u=t("j13e/display/J13DisplayImg"),c=t("j13e/display/J13DisplayText"),p=t("j13e/display/J13DisplayRect"),m=(t("j13e/display/J13DisplayCircle"),t("j13e/display/J13DisplayItemContainer")),f=t("j13e/utils/J13EventDispatcher"),g=t("j13e/anim/J13Anim"),y=t("j13e/anim/J13AnimGroup");t("j13e/anim/J13AnimSequence");function o(t){var e,i,s=t||{},n=this,a=(m.call(this,t),f.call(this,t),this.width=s.width||0,this.height=s.height||0,this.bgs=[new u({image:r.loadedImages[r.images.bgDay],visible:!1}),new u({image:r.loadedImages[r.images.bgNight],visible:!1})],this.bgs.forEach(function(t){this.addChild(t)},this),this.scoreText=new c({font:"70px Pixel5x5",x:this.width/2,y:250,text:"0",textAlign:"center",textBaseline:"top",fillStyle:"#ffffff",opacity:.25})),o=(this.addChild(this.scoreText),r.loadedImages[r.images.pipe]);this.leftPipeLayer=new m({x:-o.width}),this.rightPipeLayer=new m({x:o.width});for(this.addChild(this.leftPipeLayer),this.addChild(this.rightPipeLayer),this.bird=new h({x:290,y:330}),this.addChild(this.bird.displayItem),this.topBar=new u({x:0,y:0,image:r.loadedImages[r.images.topBar]}),this.addChild(this.topBar),this.bottomBar=new u({x:0,y:this.height-29,image:r.loadedImages[r.images.bottomBar]}),this.addChild(this.bottomBar),this.deathOverlay=new p({rect:new d({width:this.width,height:this.height}),fillStyle:"#ffffff",opacity:0}),this.addChild(this.deathOverlay),this.topBarHitRect=new d({left:0,top:-29,right:this.width,bottom:29}),this.bottomBarHitRect=new d({left:0,top:this.height-29,right:this.width,bottom:this.height+29}),this.pipeRange=this.height-29-29,this.pipeNumPlacements=Math.floor(this.pipeRange/o.height)-4,this.pipeAllowedPlacements=[],e=0;e<this.pipeNumPlacements;e+=1)this.pipeAllowedPlacements.push(this.pipeRange/(this.pipeNumPlacements+1)+this.pipeRange/(this.pipeNumPlacements+1)*e-o.height/2+29);for(this.leftPipes=[],this.rightPipes=[],e=0;e<this.pipeAllowedPlacements.length;e+=1)i=new l({leftWallX:0,rightWallX:this.width,y:this.pipeAllowedPlacements[e],side:l.sides.left,visible:!1}),this.leftPipes.push(i),this.leftPipeLayer.addChild(i),i=new l({leftWallX:0,rightWallX:this.width,y:this.pipeAllowedPlacements[e],side:l.sides.right,visible:!1}),this.rightPipes.push(i),this.rightPipeLayer.addChild(i);this.bounces=0,this.leftPipeShowAnim=new g({startValue:-r.loadedImages[r.images.pipe].width,endValue:0,duration:200,timeFunction:g.easingFunctions.easeOutCubic,stepCallback:function(t){n.leftPipeLayer.x=t}}),this.leftPipeHideAnim=new g({startValue:0,endValue:-r.loadedImages[r.images.pipe].width,duration:200,timeFunction:g.easingFunctions.easeInCubic,stepCallback:function(t){n.leftPipeLayer.x=t},endCallback:function(){for(var t=0;t<n.leftPipes.length;t+=1)n.leftPipes[t].visible=!1}}),this.rightPipeShowAnim=new g({startValue:r.loadedImages[r.images.pipe].width,endValue:0,duration:200,timeFunction:g.easingFunctions.easeOutCubic,stepCallback:function(t){n.rightPipeLayer.x=t}}),this.rightPipeHideAnim=new g({startValue:0,endValue:r.loadedImages[r.images.pipe].width,duration:200,timeFunction:g.easingFunctions.easeInCubic,stepCallback:function(t){n.rightPipeLayer.x=t},endCallback:function(){for(var t=0;t<n.rightPipes.length;t+=1)n.rightPipes[t].visible=!1}}),this.incrementBounceAnim=new g({startValue:.5,endValue:.25,duration:500,stepCallback:function(t){a.opacity=t}}),this.lostAnim=new y({anims:[new g({duration:500,stepCallback:function(){n.anchorX=20*Math.random()-10,n.anchorY=20*Math.random()-10,n.deathOverlay.anchorX=-n.anchorX,n.deathOverlay.anchorY=-n.anchorY},endCallback:function(){n.anchorX=0,n.anchorY=0,n.deathOverlay.anchorX=0,n.deathOverlay.anchorY=0}}),new g({duration:500,startValue:1,endValue:0,stepCallback:function(t){n.deathOverlay.opacity=t}})]})}return o.events={dying:"dying",dead:"dead"},o.prototype=n.inherit(new m,s.prototype,f.prototype,{reset:function(){this.bgs.forEach(function(t){t.visible=!1});var t=Math.floor(Math.random()*this.bgs.length);this.bgs[t].visible=!0,this.bounces=0,this.bird.reset(),this.updateScore()},hideAllPipes:function(){r.animManager.restartAnim(this.leftPipeHideAnim),r.animManager.restartAnim(this.rightPipeHideAnim)},flap:function(){this.bird.flap(),r.soundManager.play(r.soundNames.flap)},killBird:function(t,e){this.bird.kill(),r.animManager.restartAnim(this.lostAnim),this.dispatch(o.events.dying,{hitType:e}),r.soundManager.play(r.soundNames.crash),t&&r.soundManager.play(r.soundNames.fall)},showScore:function(){this.scoreText.visible=!0},updateScore:function(){this.scoreText.text=this.bounces.toString()},hideScore:function(){this.scoreText.visible=!1},update:function(t,e,i,s){var n,a;if(this.bird.update(t,e,i,s),this.bird.isAlive()&&(this.bird.hitRect.intersectsRect(this.topBarHitRect)?this.killBird(!0,r.hitTypes.ceiling):this.bird.hitRect.intersectsRect(this.bottomBarHitRect)&&this.killBird(!1,r.hitTypes.floor)),this.bird.isAlive())if(0<this.bird.velocity.x){for(n=0;n<this.rightPipes.length;n+=1)(a=this.rightPipes[n]).visible&&this.bird.hitRect.intersectsRect(a.hitRect)&&this.killBird(!0,r.hitTypes.pipe);this.bird.isAlive()&&this.bird.hitRect.right>=this.width&&(this.bird.flip(),this.bird.x=this.width-(this.bird.hitRect.right-this.width)-this.bird._hitRect.right,this.incrementBounce(),this.setUpPipes(l.sides.left),this.bird.updateDisplayItem())}else if(this.bird.velocity.x<0){for(n=0;n<this.leftPipes.length;n+=1)(a=this.leftPipes[n]).visible&&this.bird.hitRect.intersectsRect(a.hitRect)&&this.killBird(!0,r.hitTypes.pipe);this.bird.isAlive()&&this.bird.hitRect.left<=0&&(this.bird.flip(),this.bird.x=-this.bird.hitRect.left-this.bird._hitRect.left,this.incrementBounce(),this.setUpPipes(l.sides.right),this.bird.updateDisplayItem())}this.bird.isDying()&&(this.bird.hitRect.intersectsRect(this.topBarHitRect)?(this.bird.y=this.topBarHitRect.bottom-this.bird._hitRect.top,this.bird.updateDisplayItem()):this.bird.hitRect.intersectsRect(this.bottomBarHitRect)&&(this.bird.hitGround(this.bottomBarHitRect.top-15),this.bird.updateDisplayItem(),this.dispatch(o.events.dead)))},incrementBounce:function(){this.bounces+=1,this.updateScore(),r.animManager.restartAnim(this.incrementBounceAnim),r.soundManager.play(r.soundNames.point)},setUpPipes:function(t){for(var e,i,s=Math.min(this.pipeNumPlacements-2,Math.floor(this.bounces/5)+1),s=this.bounces<5?1:this.bounces<10?2:this.bounces<20?3:this.bounces<40?4:5,n=[],a=0;a<this.pipeAllowedPlacements.length;a+=1)n.push(a);if(t===l.sides.left){for(a=0;a<s;a+=1)i=n[e=Math.floor(Math.random()*n.length)],n.splice(e,1),this.leftPipes[i].visible=!0;r.animManager.restartAnim(this.leftPipeShowAnim),r.animManager.restartAnim(this.rightPipeHideAnim)}else{for(a=0;a<s;a+=1)i=n[e=Math.floor(Math.random()*n.length)],n.splice(e,1),this.rightPipes[i].visible=!0;r.animManager.restartAnim(this.rightPipeShowAnim),r.animManager.restartAnim(this.leftPipeHideAnim)}}}),o}),n("j13e/display/J13DisplayContainerButton",["require","exports","module","./J13DisplayItemContainer","./J13DisplayButton","../utils/J13Utils"],function(t,e,i){"use strict";var n=t("./J13DisplayItemContainer"),s=t("./J13DisplayButton"),t=t("../utils/J13Utils");function a(t){n.call(this,t),s.call(this,t)}return a.prototype=t.inherit(new n,s.prototype,{render:function(t,e,i,s){n.prototype.render.call(this,t,e,i,s)}}),a}),n("j13e/display/J13DisplayImgButton",["require","exports","module","./J13DisplayButton","./J13DisplayImg","../utils/J13Utils"],function(t,e,i){"use strict";var s=t("./J13DisplayButton"),n=t("./J13DisplayImg"),t=t("../utils/J13Utils");function a(t){var e=t||{};s.call(this,t),n.call(this,t),this.upImage=e.upImage||this.image||null,this.downImage=e.downImage||null,this.hoverImage=e.hoverImage||null,this.disabledImage=e.disabledImage||null,e.hasOwnProperty("width")?this.width=e.width:this.width=this.destRect.getWidth(),e.hasOwnProperty("height")?this.height=e.height:this.height=this.destRect.getHeight(),this.addListener(s.events.STATECHANGE,this.onStateChange.bind(this))}return a.prototype=t.inherit(s.prototype,n.prototype,{onStateChange:function(t){switch(t.data.state){case s.states.UP:this.upImage&&(this.image=this.upImage,this.setSourceRectFromImage(this.image),this.setDestRectFromImage(this.image));break;case s.states.DOWN:this.downImage&&(this.image=this.downImage,this.setSourceRectFromImage(this.image),this.setDestRectFromImage(this.image));break;case s.states.HOVER:this.hoverImage&&(this.image=this.hoverImage,this.setSourceRectFromImage(this.image),this.setDestRectFromImage(this.image));break;case s.states.DISABLED:this.disabledImage&&(this.image=this.disabledImage,this.setSourceRectFromImage(this.image),this.setDestRectFromImage(this.image))}}}),a}),n("j13e/display/J13DisplaySprite",["require","exports","module","../utils/J13Utils","./J13DisplayImg","../math/J13Rect"],function(t,e,i){"use strict";var s=t("../utils/J13Utils"),n=t("./J13DisplayImg"),a=t("../math/J13Rect");function o(t){this.copyFromOptions(t)}return o.prototype=s.inherit(new n,{setFrameId:function(t){var e=this.frameMap[t];e?(this.currentFrameId=t,this.sourceRect=e):console.error("J13DisplaySprite: invalid frame ID.")},copy:function(){var t,e=s.cloneObject(this.options);if(e.frameMap)for(t in e.frameMap)e.frameMap.hasOwnProperty(t)&&(e.frameMap[t]=e.frameMap[t].copy());else e.rect&&(e.rect=e.rect.copy());return new o(e)},copyFromOptions:function(t){var e,i=t||{};if(n.call(this,t),this.options=t,this.frameMap=i.frameMap||null,this.currentFrameId=i.startFrameId||i.currentFrameId||null,this.frameMap){if(this.currentFrameId)this.setFrameId(this.currentFrameId);else for(e in this.frameMap)if(this.frameMap.hasOwnProperty(e)){this.setFrameId(e);break}}else i.rect&&(this.sourceRect=i.rect,this.sourceRect&&!a.isJ13Rect(this.sourceRect,!0)&&a.canBeJ13Rect(this.sourceRect)&&(this.sourceRect=new a(this.sourceRect)));i.destRect||(this.destRect=this.sourceRect.copy())}}),o}),n("j13e/display/J13DisplaySpriteButton",["require","exports","module","./J13DisplayButton","./J13DisplaySprite","../utils/J13Utils"],function(t,e,i){"use strict";var s=t("./J13DisplayButton"),n=t("./J13DisplaySprite"),t=t("../utils/J13Utils");function a(t){var e=t||{};s.call(this,t),n.call(this,t),e.hasOwnProperty("width")?this.width=e.width:this.width=this.destRect.getWidth(),e.hasOwnProperty("height")?this.height=e.height:this.height=this.destRect.getHeight(),this.addListener(s.events.STATECHANGE,this.onStateChange.bind(this))}return a.prototype=t.inherit(new s,n.prototype,{onStateChange:function(t){if(this.frameMap)switch(t.data.state){case s.states.UP:this.frameMap.hasOwnProperty("up")&&this.setFrameId("up");break;case s.states.DOWN:this.frameMap.hasOwnProperty("down")&&this.setFrameId("down");break;case s.states.HOVER:this.frameMap.hasOwnProperty("hover")&&this.setFrameId("hover");break;case s.states.DISABLED:this.frameMap.hasOwnProperty("disabled")&&this.setFrameId("disabled")}}}),a}),n("src/scenes/MainMenuScene",["require","exports","module","src/Resources","src/Settings","j13e/display/J13DisplayText","j13e/utils/J13Utils","j13e/display/J13DisplayRect","j13e/math/J13Rect","j13e/display/J13DisplayItemContainer","j13e/display/J13DisplayDrawOptions","j13e/display/J13DisplayContainerButton","j13e/display/J13DisplayImgButton","j13e/display/J13DisplaySpriteButton","j13e/anim/J13Anim"],function(t,e,i){"use strict";var n=t("src/Resources"),a=t("src/Settings"),o=t("j13e/display/J13DisplayText"),r=t("j13e/utils/J13Utils"),h=t("j13e/display/J13DisplayRect"),l=t("j13e/math/J13Rect"),d=t("j13e/display/J13DisplayItemContainer"),u=t("j13e/display/J13DisplayDrawOptions"),c=t("j13e/display/J13DisplayContainerButton"),p=t("j13e/display/J13DisplayImgButton"),m=t("j13e/display/J13DisplaySpriteButton"),f=t("j13e/anim/J13Anim");function s(t){var e=t||{},i=this,t=(d.call(this,t),this.initialAnimationPlayed=!1,this.game=e.game||null,this.width=e.width||0,this.height=e.height||0,this.titleLeftText=new o({text:"BOUNCY ",textAlign:"right",textBaseline:"middle",font:"40px Pixel5x5",x:this.width/2,y:200,fillStyle:"#fbbb11",strokeStyle:"#424242",lineWidth:3,drawFlags:u.drawFlags.FILL|u.drawFlags.OUTLINE_BEHIND}),this.addChild(this.titleLeftText),this.titleRightText=new o({text:" FLAPPY",textAlign:"left",textBaseline:"middle",font:"40px Pixel5x5",x:this.width/2,y:200,fillStyle:"#f9f124",strokeStyle:"#424242",lineWidth:3,drawFlags:u.drawFlags.FILL|u.drawFlags.OUTLINE_BEHIND}),this.addChild(this.titleRightText),this.tapText=new o({text:r.isMobile.any()?"TAP":"CLICK",textAlign:"right",textBaseline:"bottom",font:"30px Pixel5x5",x:this.width/2+20,y:this.height/2-5,fillStyle:"#ffffff",strokeStyle:"#424242",lineWidth:3,drawFlags:u.drawFlags.FILL|u.drawFlags.OUTLINE_BEHIND}),this.addChild(this.tapText),this.toBeginText=new o({text:"TO BEGIN",textAlign:"center",textBaseline:"top",font:"30px Pixel5x5",x:this.width/2,y:this.height/2+5,fillStyle:"#ffffff",strokeStyle:"#424242",lineWidth:3,drawFlags:u.drawFlags.FILL|u.drawFlags.OUTLINE_BEHIND}),this.addChild(this.toBeginText),n.volumeSheet.getSprite("main")),t=(this.volumeButton=new m(r.extendObj(t.options,{id:n.buttons.volume,x:this.width-t.destRect.getWidth()-30,y:59,clickFunction:this.volumeButtonCallback.bind(this)})),this.addChild(this.volumeButton),this.volumeButton.addListener(this.volumeButton.events.UP,this.onVolumeButtonUp.bind(this)),this.volumeButton.addListener(this.volumeButton.events.DOWN,this.onVolumeButtonDown.bind(this)),this.startButton=new c({id:n.buttons.start,x:0,y:this.volumeButton.y+this.volumeButton.height,width:this.width,height:this.height-(this.volumeButton.y+this.volumeButton.height),clickFunction:e.startButtonCallback||function(){}}),this.addChild(this.startButton),new o({text:"© 2013-2014 GameMix, Inc. All rights reserved.",font:"14px Arial",textAlign:"center",textBaseline:"bottom",y:this.height-5,x:this.width/2,fillStyle:"#ffffff"})),s=(this.addChild(t),new d({x:0,y:this.height-30,opacity:0})),e=(this.addChild(s),s.addChild(new h({rect:new l({width:this.width,height:30}),fillStyle:"#000000"})),s.addChild(new o({x:5,y:0,font:"25px Arial",fillStyle:"#ffffff",text:window.gameVersion||"o.O",textAlign:"left",textBaseline:"top"})),new c({id:n.buttons.version,x:0,y:0,width:this.volumeButton.x,height:90,clickFunction:this.showVersion.bind(this)})),t=(this.addChild(e),this.crazyGamesBackButton=new p({image:n.loadedImages[n.images.crazyGamesBackButton],x:10,y:40,width:n.loadedImages[n.images.crazyGamesBackButton].width,height:n.loadedImages[n.images.crazyGamesBackButton].height,visible:a.crazyGames,clickFunction:this.game.crazyGamesBackButtonCallback.bind(this.game)}));this.addChild(t),this.versionAnim=new f({startValue:1,endValue:0,duration:1500,stepCallback:function(t){s.opacity=t}}),this.hideAnim=new f({startValue:1,endValue:0,duration:500,stepCallback:function(t){i.opacity=t},endCallback:function(){i.visible=!1,i.titleLeftText.visible=!1,i.titleRightText.visible=!1}})}return s.defaultSettings={planetPosition:{x:240,y:345},enemyCreateDelay:750},s.prototype=r.inherit(new d,{showVersion:function(t){n.animManager.restartAnim(this.versionAnim)},volumeButtonCallback:function(t){n.soundManager.toggleMute(),this.updateVolumeButton()},onVolumeButtonDown:function(t){this.volumeButton.anchorY=-5},onVolumeButtonUp:function(t){this.volumeButton.anchorY=0},updateVolumeButton:function(){n.soundManager.isMuted()?this.volumeButton.setFrameId("off"):this.volumeButton.setFrameId("on")},show:function(){this.visible=!0,this.opacity=1,this.updateVolumeButton()},hide:function(t){n.animManager.restartAnim(this.hideAnim)}}),s}),n("j13e/utils/J13CookieJar",["require","exports","module"],function(t,e,i){"use strict";function s(t){this.cookieMap=this.parseCookies()}return s.prototype={getCookie:function(t,e,i){return this.cookieMap[t]||(i&&this.setCookie(t,e,i),e)},setCookie:function(t,e,i){var s=new Date;s.setSeconds(s.getSeconds()+i),document.cookie=t+"="+e+"; expires="+s.toUTCString(),this.cookieMap[t]=e},parseCookies:function(){return document.cookie.split(";").map(function(t){return t.trim().split("=")}).reduce(function(t,e){return t[e[0]]=e[1],t},{})}},new s}),n("src/utils/PersistentStorage",["require","exports","module","j13e/utils/J13CookieJar"],function(t,e,i){"use strict";var a=t("j13e/utils/J13CookieJar");function s(t){t=t||{};this.defaultExpireSeconds=t.hasOwnProperty("defaultExpireSeconds")?t.defaultExpireSeconds:s.DEFAULT_EXPIRE_SECONDS}return s.DEFAULT_EXPIRE_SECONDS=86400,s.prototype={set:function(t,e,i){var s=!1;if(window.localStorage)try{window.localStorage.setItem(t,e)}catch(t){s=!0}else s=!0;s&&a.setCookie(t,e,i||this.defaultExpireSeconds)},get:function(t,e,i){var s=!1,n=null;if(window.localStorage)try{s=!(null==(n=window.localStorage.getItem(t)))}catch(t){s=!1}else s=!1;return s||(n=a.getCookie(t,e,i||this.defaultExpireSeconds),s=!0),n}},new s}),n("src/utils/HiScoreManager",["require","exports","module","./PersistentStorage"],function(t,e,i){"use strict";var h=t("./PersistentStorage");function l(t){var t=t||{},t=(this.cookieSettings={name:t.cookieSettings&&t.cookieSettings.name?t.cookieSettings.name:l.cookieSettings.NAME,expires:t.cookieSettings&&t.cookieSettings.hasOwnProperty("expires")?t.cookieSettings.expires:l.cookieSettings.EXPIRES},this.minScore=t.hasOwnProperty("minScore")?t.minScore:0,this.maxEntries=t.hasOwnProperty("maxEntries")?t.maxEntries:l.MAX_ENTRIES,this.order=t.order||l.DESC,h.get(this.cookieSettings.name,'{"entries":[]}',this.cookieSettings.expires)),e=null;try{e=JSON.parse(t)}catch(t){e=null}this.entries=e&&e.entries?e.entries:[]}return l.MAX_ENTRIES=10,l.cookieSettings={NAME:"gmendlessgunner_hsl",EXPIRES:63072e3},l.order={ASC:"asc",DESC:"desc"},l.prototype={addScore:function(s,n,t){var a=!1,o=!1,r=this.order;for(this.entries.every(function(t,e,i){return(r===l.order.DESC&&n>=t.score||r===l.order.ASC&&n<=t.score)&&(i.splice(e,0,{time:s,score:n}),0===e&&(o=!0),a=!0),!a}),!a&&this.entries.length<this.maxEntries&&this.entries.push({time:s,score:n});this.entries.length>this.maxEntries;)this.entries.pop();return t||(t=JSON.stringify({entries:this.entries}),h.set(this.cookieSettings.name,t,this.cookieSettings.expires)),o}},l}),n("j13e/display/J13DisplayRoundedRect",["require","exports","module","./J13DisplayRect","../utils/J13Utils","./J13DisplayDrawOptions"],function(t,e,i){"use strict";var s=t("./J13DisplayRect"),n=t("../utils/J13Utils"),a=t("./J13DisplayDrawOptions");function o(t){var e=t||{};s.call(this,t),this.tlRadius=e.tlRadius||e.topLeftRadius||0,this.trRadius=e.trRadius||e.topRightRadius||0,this.blRadius=e.blRadius||e.bottomLeftRadius||0,this.brRadius=e.brRadius||e.bottomRightRadius||0,e.hasOwnProperty("r")?this.setRadius(e.r):e.hasOwnProperty("radius")&&this.setRadius(e.radius)}return o.prototype=n.inherit(new s,{setRadius:function(t){this.tlRadius=this.trRadius=this.blRadius=this.brRadius=t},render:function(t,e,i,s){s=s.canvasContext;this.drawOptions.applyOptions(s),s.beginPath(),s.moveTo(this.rect.left+this.tlRadius,this.rect.top),s.lineTo(this.rect.right-this.trRadius,this.rect.top),s.arc(this.rect.right-this.trRadius,this.rect.top+this.trRadius,this.trRadius,1.5*Math.PI,2*Math.PI),s.lineTo(this.rect.right,this.rect.bottom-this.brRadius),s.arc(this.rect.right-this.brRadius,this.rect.bottom-this.brRadius,this.brRadius,0,.5*Math.PI),s.lineTo(this.rect.left+this.blRadius,this.rect.bottom),s.arc(this.rect.left+this.blRadius,this.rect.bottom-this.blRadius,this.blRadius,.5*Math.PI,Math.PI),s.lineTo(this.rect.left,this.rect.top+this.tlRadius),s.arc(this.rect.left+this.tlRadius,this.rect.top+this.tlRadius,this.tlRadius,Math.PI,1.5*Math.PI),s.closePath(),this.drawOptions.applyPostPathOptions(s),0<(this.drawFlags&a.drawFlags.OUTLINE_BEHIND)&&s.stroke(),0<(this.drawFlags&a.drawFlags.FILL)&&s.fill(),0<(this.drawFlags&a.drawFlags.OUTLINE_FRONT)&&s.stroke()}}),o}),n("src/scenes/HiScoreScene",["require","exports","module","src/Resources","src/Settings","src/utils/HiScoreManager","j13e/utils/J13Utils","j13e/display/J13DisplayText","j13e/display/J13DisplayItemContainer","j13e/display/J13DisplayImg","j13e/display/J13DisplayImgButton","j13e/display/J13DisplaySpriteButton","j13e/math/J13Rect","j13e/display/J13DisplayRoundedRect","j13e/anim/J13Anim","j13e/display/J13DisplayRect"],function(t,e,i){"use strict";var s=t("src/Resources"),n=t("src/Settings"),a=t("src/utils/HiScoreManager"),o=t("j13e/utils/J13Utils"),r=t("j13e/display/J13DisplayText"),h=t("j13e/display/J13DisplayItemContainer"),l=(t("j13e/display/J13DisplayImg"),t("j13e/display/J13DisplayImgButton")),d=t("j13e/display/J13DisplaySpriteButton"),u=(t("j13e/math/J13Rect"),t("j13e/display/J13DisplayRoundedRect"),t("j13e/anim/J13Anim"));t("j13e/display/J13DisplayRect");function c(t){var e=t||{},i=this,t=(h.call(this,t),this.game=e.game||null,this.width=e.width||0,this.height=e.height||0,this.opacity=0,this.hiScoreManager=new a({cookieSettings:{name:"gmbouncyflappy_hsl",expires:63072e3},order:a.order.DESC,maxEntries:1}),this.youScoredText=new r({font:"30px Pixel5x5",x:this.width/2,y:200,text:"YOU SCORED",textAlign:"center",textBaseline:"top",fillStyle:"#ffffff"}),this.addChild(this.youScoredText),this.scoreText=new r({font:"70px Pixel5x5",x:this.width/2,y:250,text:"0",textAlign:"center",textBaseline:"top",fillStyle:"#ffffff"}),this.addChild(this.scoreText),this.avoidThePipesText=new r({font:"30px Pixel5x5",x:this.width/2,y:120,text:"AVOID THE PIPES!",textAlign:"center",textBaseline:"top",fillStyle:"#ffffff",visible:!1}),this.addChild(this.avoidThePipesText),this.retryButton=new l({id:s.buttons.retry,img:s.loadedImages[s.images.retryButton],clickFunction:e.retryButtonCallback||function(){},visible:!0,y:340,width:215,height:66}),this.retryButton.x=this.width/2-this.retryButton.image.width/2,this.addChild(this.retryButton),this.rankButton=new l({id:s.buttons.rank,img:s.loadedImages[s.images.rankButton],clickFunction:this.showGmapiLeaderboard.bind(this),y:430,width:215,height:66}),this.rankButton.x=this.width/2-this.rankButton.image.width/2,this.addChild(this.rankButton),this.kikButton=new l({id:s.buttons.kik,img:s.loadedImages[s.images.kikButton],clickFunction:e.kikButtonCallback||function(){},visible:n.kik,y:520,width:215,height:66}),this.kikButton.x=this.width/2-this.kikButton.image.width/2,this.addChild(this.kikButton),this.crazyGamesBackButton=new l({image:s.loadedImages[s.images.crazyGamesBackButton],x:10,y:40,width:s.loadedImages[s.images.crazyGamesBackButton].width,height:s.loadedImages[s.images.crazyGamesBackButton].height,visible:n.crazyGames,clickFunction:this.game.crazyGamesBackButtonCallback.bind(this.game)})),e=(this.addChild(t),s.volumeSheet.getSprite("main"));this.volumeButton=new d(o.extendObj(e.options,{id:s.buttons.volume,x:this.width-e.destRect.getWidth()-10,y:39,clickFunction:this.volumeButtonCallback.bind(this)})),this.addChild(this.volumeButton),this.volumeButton.addListener(this.volumeButton.events.UP,this.onVolumeButtonUp.bind(this)),this.volumeButton.addListener(this.volumeButton.events.DOWN,this.onVolumeButtonDown.bind(this)),this.showAnim=new u({startValue:0,endValue:1,duration:500,startCallback:function(){i.visible=!0},stepCallback:function(t){i.opacity=t}})}return c.DEFAULT_BUTTON_SPACING=50,c.MIN_SCORE=2,c.prototype=o.inherit(new h,{showGmapiLeaderboard:function(){window.gmapi&&window.gmapi(function(t){t.game.leaderboard.show()})},updateHiScoreList:function(e){var t=(new Date).getTime();e&&c.MIN_SCORE<=e&&(this.hiScoreManager.addScore(t,e),window.gmapi&&window.gmapi(function(t){t.game.leaderboard.sendScore(e)})),this.scoreText.text=e.toString()},volumeButtonCallback:function(t){s.soundManager.toggleMute(),this.updateVolumeButton()},onVolumeButtonDown:function(t){this.volumeButton.anchorY=-5},onVolumeButtonUp:function(t){this.volumeButton.anchorY=0},updateVolumeButton:function(){s.soundManager.isMuted()?this.volumeButton.setFrameId("off"):this.volumeButton.setFrameId("on")},show:function(t,e){if(t&&t.hasOwnProperty("score")){var i=this.avoidThePipesText;if(this.updateHiScoreList(t.score),n.kik&&window.points&&window.points.offer&&window.points.offer.complete&&15<=t.score&&window.points.offer.complete(function(t){t?console.log("kpErr: status="+t.status+"; msg="+t.msg):(i.font="25px Pixel5x5",i.text="CONGRATS! YOU GOT KIK POINTS!")}),t.score<5&&t.hasOwnProperty("hitType"))switch(i.font="30px Pixel5x5",i.visible=!0,t.hitType){case s.hitTypes.ceiling:i.text="AVOID THE CEILING!";break;case s.hitTypes.floor:i.text="AVOID THE FLOOR!";break;case s.hitTypes.pipe:i.text="AVOID THE PIPES!"}else this.avoidThePipesText.visible=!1}this.showAnim.endCallback=e||function(){},this.updateVolumeButton(),s.animManager.restartAnim(this.showAnim)},hide:function(){this.visible=!1,this.opacity=0}}),c}),n("src/screens/PlayScreen",["require","exports","module","src/Resources","src/utils/Updatable","src/viewports/PlayViewport","src/scenes/MainMenuScene","src/scenes/HiScoreScene","j13e/math/J13Rect","j13e/utils/J13Utils","j13e/display/J13DisplayRect","j13e/display/J13DisplayItemContainer"],function(t,e,i){"use strict";var s=t("src/Resources"),n=t("src/utils/Updatable"),a=t("src/viewports/PlayViewport"),o=t("src/scenes/MainMenuScene"),r=t("src/scenes/HiScoreScene"),h=t("j13e/math/J13Rect"),l=t("j13e/utils/J13Utils"),d=t("j13e/display/J13DisplayRect"),u=t("j13e/display/J13DisplayItemContainer");function c(t){var e=t||{};u.call(this,t),this.game=e.game||null,this.width=e.width||0,this.height=e.height||0,this.numPlays=0,this.playViewport=new a({width:this.width,height:this.height}),this.addChild(this.playViewport),this.mainMenuScene=new o({game:this.game,width:this.width,height:this.height,visible:!1,startButtonCallback:this.startButtonCallback.bind(this)}),this.addChild(this.mainMenuScene),this.hiScoreScene=new r({game:this.game,width:this.width,height:this.height,visible:!1,kikButtonCallback:e.kikButtonCallback,retryButtonCallback:this.retryButtonCallback.bind(this)}),this.addChild(this.hiScoreScene),this.transitionOverlay=new d({rect:new h({width:this.width,height:this.height}),visible:!1,opacity:0}),this.addChild(this.transitionOverlay),this.playViewport.addListener(a.events.dying,this.onDying.bind(this)),s.mouseManager.addListener(s.mouseManager.events.DOWN,this.onMouseDown.bind(this))}return c.prototype=l.inherit(new u,n.prototype,{retryButtonCallback:function(t){s.gsm.transitioning||(this.playViewport.hideAllPipes(),s.gsm.toState(s.gameStates.mainMenu),s.soundManager.play(s.soundNames.menu))},onDying:function(t){s.gsm.toState(s.gameStates.gameOver,{score:this.playViewport.bounces,hitType:t&&t.data?t.data.hitType:null})},onMouseDown:function(t){s.gsm.getCurrentStateId()===s.gameStates.level&&this.playViewport.flap()},startButtonCallback:function(t){s.gsm.getCurrentStateId()===s.gameStates.mainMenu&&(s.gsm.toState(s.gameStates.level),this.numPlays+=1,this.playViewport.flap())},update:function(t,e,i,s){this.playViewport.update(t,e,i,s)},show:function(t){t&&t.hasOwnProperty("reset")&&this.reset(),this.visible=!0},reset:function(){this.playViewport.reset()},hide:function(){this.visible=!1}}),c}),n("j13e/utils/J13Loader",["require","exports","module","./J13Utils","./J13EventDispatcher"],function(t,e,i){"use strict";var s=t("./J13Utils"),t=t("./J13EventDispatcher");function n(t){t=t||{};this.loaded=0,this.total=0,this.errors=0,this.includeInPreload=!!t.hasOwnProperty("includeInPreload")&&t.includeInPreload,this.strictLoad=!t.hasOwnProperty("strictLoad")||t.strictLoad}return n.events={load:"load",allLoad:"allload",error:"error"},n.prototype=s.inherit(new t,{events:n.events,startLoading:function(){throw new Error('"startLoading" function not overriden in a J13Loader subclass (or should not be called by subclass)')},onLoad:function(t){this.loaded+=1,this.dispatch(this.events.load,{loaded:this.strictLoad?this.loaded:this.loaded+this.errors,total:this.total,errors:this.errors,originalEvent:t}),(this.strictLoad&&this.loaded>=this.total||!this.strictLoad&&this.loaded+this.errors>=this.total)&&this.onAllLoad(t)},onError:function(t){this.dispatch(this.events.error,{loaded:this.strictLoad?this.loaded:this.loaded+this.errors,total:this.total,errors:this.errors,originalEvent:t})},onAllLoad:function(t){this.dispatch(this.events.allLoad,{loaded:this.strictLoad?this.loaded:this.loaded+this.errors,total:this.total,errors:this.errors,originalEvent:t})}}),n});var l,d={},C=null,A=!0,I=!1;try{"undefined"!=typeof AudioContext?C=new AudioContext:"undefined"!=typeof webkitAudioContext?C=new webkitAudioContext:A=!1}catch(t){A=!1}if(!A)if("undefined"!=typeof Audio)try{new Audio}catch(t){I=!0}else I=!0;function x(t){this._volume=1,this._muted=!1,this.usingWebAudio=A,this.ctx=C,this.noAudio=I,this._howls=[],this._codecs=t,this.iOSAutoEnable=!0}function O(t){var e=this;e._autoplay=t.autoplay||!1,e._buffer=t.buffer||!1,e._duration=t.duration||0,e._format=t.format||null,e._loop=t.loop||!1,e._loaded=!1,e._sprite=t.sprite||{},e._src=t.src||"",e._pos3d=t.pos3d||[0,0,-.5],e._volume=void 0!==t.volume?t.volume:1,e._urls=t.urls||[],e._rate=t.rate||1,e._model=t.model||null,e._onload=[t.onload||function(){}],e._onloaderror=[t.onloaderror||function(){}],e._onend=[t.onend||function(){}],e._onpause=[t.onpause||function(){}],e._onplay=[t.onplay||function(){}],e._onendTimer=[],e._webAudio=A&&!e._buffer,e._audioNode=[],e._webAudio&&e._setupAudioNode(),void 0!==C&&C&&D.iOSAutoEnable&&D._enableiOSAudio(),D._howls.push(e),e.load()}A&&((l=void 0===C.createGain?C.createGainNode():C.createGain()).gain.value=1,l.connect(C.destination)),x.prototype={volume:function(t){var e=this;if(0<=(t=parseFloat(t))&&t<=1){for(var i in e._volume=t,A&&(l.gain.value=t),e._howls)if(e._howls.hasOwnProperty(i)&&!1===e._howls[i]._webAudio)for(var s=0;s<e._howls[i]._audioNode.length;s++)e._howls[i]._audioNode[s].volume=e._howls[i]._volume*e._volume;return e}return A?l.gain.value:e._volume},mute:function(){return this._setMuted(!0),this},unmute:function(){return this._setMuted(!1),this},_setMuted:function(t){var e,i=this;for(e in i._muted=t,A&&(l.gain.value=t?0:i._volume),i._howls)if(i._howls.hasOwnProperty(e)&&!1===i._howls[e]._webAudio)for(var s=0;s<i._howls[e]._audioNode.length;s++)i._howls[e]._audioNode[s].muted=t},codecs:function(t){return this._codecs[t]},_enableiOSAudio:function(){var i,s=this;if(!C||!s._iOSEnabled&&/iPhone|iPad|iPod/i.test(navigator.userAgent))return s._iOSEnabled=!1,i=function(){var t=C.createBuffer(1,1,22050),e=C.createBufferSource();e.buffer=t,e.connect(C.destination),void 0===e.start?e.noteOn(0):e.start(0),setTimeout(function(){e.playbackState!==e.PLAYING_STATE&&e.playbackState!==e.FINISHED_STATE||(s._iOSEnabled=!0,s.iOSAutoEnable=!1,window.removeEventListener("touchstart",i,!1))},0)},window.addEventListener("touchstart",i,!1),s}};var E,M,P,T,e=null,R={},D=(I||(e=new Audio,R={mp3:!!e.canPlayType("audio/mpeg;").replace(/^no$/,""),opus:!!e.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!e.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!e.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),aac:!!e.canPlayType("audio/aac;").replace(/^no$/,""),m4a:!!(e.canPlayType("audio/x-m4a;")||e.canPlayType("audio/m4a;")||e.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(e.canPlayType("audio/x-mp4;")||e.canPlayType("audio/mp4;")||e.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!!e.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")}),new x(R));O.prototype={load:function(){var t=this,e=null;if(!I){for(var i,s,n,a,o=0;o<t._urls.length;o++){if(t._format)i=t._format;else{if(s=t._urls[o],!(i=(i=/^data:audio\/([^;,]+);/i.exec(s))||/\.([^.]+)$/.exec(s.split("?",1)[0])))return void t.on("loaderror");i=i[1].toLowerCase()}if(R[i]){e=t._urls[o];break}}if(e)return t._src=e,t._webAudio?E(t,e):((n=new Audio).addEventListener("error",function(){n.error&&4===n.error.code&&(x.noAudio=!0),t.on("loaderror",{type:n.error?n.error.code:0})},!1),t._audioNode.push(n),n.src=e,n._pos=0,n.preload="auto",n.volume=D._muted?0:t._volume*D.volume(),a=function(){t._duration=Math.ceil(10*n.duration)/10,0===Object.getOwnPropertyNames(t._sprite).length&&(t._sprite={_default:[0,1e3*t._duration]}),t._loaded||(t._loaded=!0,t.on("load")),t._autoplay&&t.play(),n.removeEventListener("canplaythrough",a,!1)},n.addEventListener("canplaythrough",a,!1),n.load()),t}t.on("loaderror")},urls:function(t){var e=this;return t?(e.stop(),e._urls="string"==typeof t?[t]:t,e._loaded=!1,e.load(),e):e._urls},play:function(p,m){var f=this;return"function"==typeof p&&(m=p),p&&"function"!=typeof p||(p="_default"),f._loaded?f._sprite[p]?f._inactiveNode(function(t){t._sprite=p;var e,i,s,n,a,o=0<t._pos?t._pos:f._sprite[p][0]/1e3,r=0,h=(f._webAudio?(r=f._sprite[p][1]/1e3-t._pos,0<t._pos&&(o=f._sprite[p][0]/1e3+o)):r=f._sprite[p][1]/1e3-(o-f._sprite[p][0]/1e3),!(!f._loop&&!f._sprite[p][2])),l="string"==typeof m?m:Math.round(Date.now()*Math.random())+"";if(e={id:l,sprite:p,loop:h},d=setTimeout(function(){!f._webAudio&&h&&f.stop(e.id).play(p,e.id),f._webAudio&&!h&&(f._nodeById(e.id).paused=!0,f._nodeById(e.id)._pos=0,f._clearEndTimer(e.id)),f._webAudio||h||f.stop(e.id),f.on("end",l)},1e3*r),f._onendTimer.push({timer:d,id:e.id}),f._webAudio){var d=f._sprite[p][0]/1e3,u=f._sprite[p][1]/1e3;t.id=l,t.paused=!1,T(f,[h,d,u],l),f._playStart=C.currentTime,t.gain.value=f._volume,void 0===t.bufferSource.start?t.bufferSource.noteGrainOn(0,o,r):t.bufferSource.start(0,o,r)}else{if(4!==t.readyState&&(t.readyState||!navigator.isCocoonJS))return f._clearEndTimer(l),i=f,s=p,n=m,(a=t).addEventListener("canplaythrough",c,!1),f;t.readyState=4,t.id=l,t.currentTime=o,t.muted=D._muted||t.muted,t.volume=f._volume*D.volume(),setTimeout(function(){t.play()},0)}function c(){i.play(s,n),a.removeEventListener("canplaythrough",c,!1)}return f.on("play"),"function"==typeof m&&m(l),f}):"function"==typeof m&&m():f.on("load",function(){f.play(p,m)}),f},pause:function(t){var e=this;if(e._loaded){e._clearEndTimer(t);var i=t?e._nodeById(t):e._activeNode();if(i)if(i._pos=e.pos(null,t),e._webAudio){if(!i.bufferSource||i.paused)return e;i.paused=!0,void 0===i.bufferSource.stop?i.bufferSource.noteOff(0):i.bufferSource.stop(0)}else i.pause();e.on("pause")}else e.on("play",function(){e.pause(t)});return e},stop:function(t){var e=this;if(e._loaded){e._clearEndTimer(t);var i=t?e._nodeById(t):e._activeNode();if(i)if(i._pos=0,e._webAudio){if(!i.bufferSource||i.paused)return e;i.paused=!0,void 0===i.bufferSource.stop?i.bufferSource.noteOff(0):i.bufferSource.stop(0)}else isNaN(i.duration)||(i.pause(),i.currentTime=0)}else e.on("play",function(){e.stop(t)});return e},mute:function(t){var e,i=this;return i._loaded?(e=t?i._nodeById(t):i._activeNode())&&(i._webAudio?e.gain.value=0:e.muted=!0):i.on("play",function(){i.mute(t)}),i},unmute:function(t){var e,i=this;return i._loaded?(e=t?i._nodeById(t):i._activeNode())&&(i._webAudio?e.gain.value=i._volume:e.muted=!1):i.on("play",function(){i.unmute(t)}),i},volume:function(t,e){var i,s=this;return 0<=(t=parseFloat(t))&&t<=1?(s._volume=t,s._loaded?(i=e?s._nodeById(e):s._activeNode())&&(s._webAudio?i.gain.value=t:i.volume=t*D.volume()):s.on("play",function(){s.volume(t,e)}),s):s._volume},loop:function(t){return"boolean"==typeof t?(this._loop=t,this):this._loop},sprite:function(t){return"object"==typeof t?(this._sprite=t,this):this._sprite},pos:function(t,e){var i=this;if(!i._loaded)return i.on("load",function(){i.pos(t)}),"number"==typeof t?i:i._pos||0;t=parseFloat(t);var s=e?i._nodeById(e):i._activeNode();if(s)return 0<=t?(i.pause(e),s._pos=t,i.play(s._sprite,e),i):i._webAudio?s._pos+(C.currentTime-i._playStart):s.currentTime;if(0<=t)return i;for(var n=0;n<i._audioNode.length;n++)if(i._audioNode[n].paused&&4===i._audioNode[n].readyState)return i._webAudio?i._audioNode[n]._pos:i._audioNode[n].currentTime},pos3d:function(t,e,i,s){var n,a=this;if(e=void 0!==e&&e?e:0,i=void 0!==i&&i?i:-.5,a._loaded){if(!(0<=t||t<0))return a._pos3d;a._webAudio&&(n=s?a._nodeById(s):a._activeNode())&&(a._pos3d=[t,e,i],n.panner.setPosition(t,e,i),n.panner.panningModel=a._model||"HRTF")}else a.on("play",function(){a.pos3d(t,e,i,s)});return a},fade:function(t,s,e,n,a){var o=this,i=Math.abs(t-s),r=s<t?"down":"up",h=i/.01,l=e/h;if(!o._loaded)return o.on("load",function(){o.fade(t,s,e,n,a)}),o;o.volume(t,a);for(var d=1;d<=h;d++)!function(){var t=o._volume+("up"==r?.01:-.01)*d,e=Math.round(1e3*t)/1e3,i=s;setTimeout(function(){o.volume(e,a),e===i&&n&&n()},l*d)}()},fadeIn:function(t,e,i){return this.volume(0).play().fade(0,t,e,i)},fadeOut:function(t,e,i,s){var n=this;return n.fade(n._volume,t,e,function(){i&&i(),n.pause(s),n.on("end")},s)},_nodeById:function(t){for(var e=this._audioNode[0],i=0;i<this._audioNode.length;i++)if(this._audioNode[i].id===t){e=this._audioNode[i];break}return e},_activeNode:function(){for(var t=null,e=0;e<this._audioNode.length;e++)if(!this._audioNode[e].paused){t=this._audioNode[e];break}return this._drainPool(),t},_inactiveNode:function(t){for(var e,i,s,n=this,a=null,o=0;o<n._audioNode.length;o++)if(n._audioNode[o].paused&&4===n._audioNode[o].readyState){t(n._audioNode[o]),a=!0;break}n._drainPool(),a||(n._webAudio?(e=n._setupAudioNode(),t(e)):(n.load(),e=n._audioNode[n._audioNode.length-1],i=navigator.isCocoonJS?"canplaythrough":"loadedmetadata",s=function(){e.removeEventListener(i,s,!1),t(e)},e.addEventListener(i,s,!1)))},_drainPool:function(){for(var t=this,e=0,i=0;i<t._audioNode.length;i++)t._audioNode[i].paused&&e++;for(i=t._audioNode.length-1;0<=i&&!(e<=5);i--)t._audioNode[i].paused&&(t._webAudio&&t._audioNode[i].disconnect(0),e--,t._audioNode.splice(i,1))},_clearEndTimer:function(t){for(var e=0,i=0;i<this._onendTimer.length;i++)if(this._onendTimer[i].id===t){e=i;break}var s=this._onendTimer[e];s&&(clearTimeout(s.timer),this._onendTimer.splice(e,1))},_setupAudioNode:function(){var t=this,e=t._audioNode,i=t._audioNode.length;return e[i]=void 0===C.createGain?C.createGainNode():C.createGain(),e[i].gain.value=t._volume,e[i].paused=!0,e[i]._pos=0,e[i].readyState=4,e[i].connect(l),e[i].panner=C.createPanner(),e[i].panner.panningModel=t._model||"equalpower",e[i].panner.setPosition(t._pos3d[0],t._pos3d[1],t._pos3d[2]),e[i].panner.connect(e[i]),e[i]},on:function(t,e){var i=this["_on"+t];if("function"==typeof e)i.push(e);else for(var s=0;s<i.length;s++)e?i[s].call(this,e):i[s].call(this);return this},off:function(t,e){var i=this["_on"+t],s=e?e.toString():null;if(s){for(var n=0;n<i.length;n++)if(s===i[n].toString()){i.splice(n,1);break}}else this["_on"+t]=[];return this},unload:function(){for(var t=this,e=t._audioNode,i=0;i<t._audioNode.length;i++)e[i].paused||(t.stop(e[i].id),t.on("end",e[i].id)),t._webAudio?e[i].disconnect(0):e[i].src="";for(i=0;i<t._onendTimer.length;i++)clearTimeout(t._onendTimer[i].timer);var s=D._howls.indexOf(t);null!==s&&0<=s&&D._howls.splice(s,1),delete d[t._src]}},A&&(E=function(t,e){if(e in d)t._duration=d[e].duration,P(t);else if(/^data:[^;]+;base64,/.test(e)){for(var i=atob(e.split(",")[1]),s=new Uint8Array(i.length),n=0;n<i.length;++n)s[n]=i.charCodeAt(n);M(s.buffer,t,e)}else{var a=new XMLHttpRequest;a.open("GET",e,!0),a.responseType="arraybuffer",a.onload=function(){M(a.response,t,e)},a.onerror=function(){t._webAudio&&(t._buffer=!0,t._webAudio=!1,t._audioNode=[],delete t._gainNode,delete d[e],t.load())};try{a.send()}catch(t){a.onerror()}}},M=function(t,e,i){C.decodeAudioData(t,function(t){t&&P(e,d[i]=t)},function(t){e.on("loaderror")})},P=function(t,e){t._duration=e?e.duration:t._duration,0===Object.getOwnPropertyNames(t._sprite).length&&(t._sprite={_default:[0,1e3*t._duration]}),t._loaded||(t._loaded=!0,t.on("load")),t._autoplay&&t.play()},T=function(t,e,i){i=t._nodeById(i);i.bufferSource=C.createBufferSource(),i.bufferSource.buffer=d[t._src],i.bufferSource.connect(i.panner),i.bufferSource.loop=e[0],e[0]&&(i.bufferSource.loopStart=e[1],i.bufferSource.loopEnd=e[1]+e[2]),i.bufferSource.playbackRate.value=t._rate}),n.amd&&n("howler/howler",[],function(){return{Howler:D,Howl:O}}),"undefined"!=typeof exports&&(exports.Howler=D,exports.Howl=O),"undefined"!=typeof window&&(window.Howler=D,window.Howl=O),n("src/utils/SoundManager",["require","exports","module","j13e/utils/J13Loader","j13e/utils/J13Utils","howler/howler","src/utils/PersistentStorage"],function(t,e,i){"use strict";var s=t("j13e/utils/J13Loader"),n=t("j13e/utils/J13Utils"),a=t("howler/howler"),o=t("src/utils/PersistentStorage");function r(t){var e=t||{};s.call(this,t),this.soundsToLoad=e.sounds||{},this.sounds={},"on"===o.get("sounds","on",31536e3)?this.unmute():this.mute()}return r.prototype=n.inherit(new s,{startLoading:function(){var t,e=this.onLoad.bind(this),i=this.onError.bind(this);for(t in this.soundsToLoad)this.soundsToLoad.hasOwnProperty(t)&&(this.sounds[t]=new a.Howl({urls:this.soundsToLoad[t].urls,volume:this.soundsToLoad[t].hasOwnProperty("volume")?this.soundsToLoad[t].volume:1,onload:e,onloaderror:i}),this.total+=1);0===this.total&&this.onAllLoad()},get:function(t){return this.sounds[t]},play:function(t,e){t=this.sounds[t];return t&&t.play(e),t},replay:function(t,e){t=this.sounds[t];return t&&(t.stop(e),t.play()),t},stop:function(t,e){t=this.sounds[t];return t&&t.stop(e),t},mute:function(t){return t||o.set("sounds","off",31536e3),a.Howler.mute()},unmute:function(t){return t||o.set("sounds","on",31536e3),a.Howler.unmute()},isMuted:function(){return a.Howler._muted},toggleMute:function(t){return this.isMuted()?this.unmute(t):this.mute(t),this.isMuted()}}),r}),n("j13e/utils/J13DebugManager",["require","exports","module","./J13Utils"],function(t,e,i){"use strict";var s=t("./J13Utils");function n(t){t=t||{};this.debugContainer=t.debugContainer||document.body||document.getElementsByTagName("body")[0],this.lastFrameCapture=0,this.lastFrameCaptureTime=0,this.output=null,this.frameCounter=null,this.frameCount=0,this.renderFrameCount=0,this.lastRenderFrameCapture=0,this.logicFrameCount=0,this.lastLogicFrameCapture=0,this.setupDone=!1,this.enabled=!!t.hasOwnProperty("enabled")&&t.enabled}return n.prototype={setup:function(){this.setupDone||(this.output=document.createElement("div"),this.output.hasOwnProperty("id")?this.output.id="debugOutput":this.output.setAttribute("id","debugOutput"),s.addClass(this.output,"debugOutput"),this.output.style.position="absolute",this.output.style.top="0",this.output.style.left="0",this.output.style.backgroundColor="rgba(255, 255, 255, 0.8)",this.output.style.color="#000000",this.output.style.padding="3px",this.output.style.zIndex=Math.pow(2,32)-1,this.debugContainer.appendChild(this.output),this.frameCounter=document.createElement("div"),this.frameCounter.hasOwnProperty("id")?this.frameCounter.id="frameCounter":this.frameCounter.setAttribute("id","frameCounter"),s.addClass(this.frameCounter,"frameCounter"),this.frameCounter.style.position="absolute",this.frameCounter.style.bottom="0",this.frameCounter.style.left="0",this.frameCounter.style.backgroundColor="rgba(255, 255, 255, 0.8)",this.frameCounter.style.color="#000000",this.frameCounter.style.padding="3px",this.frameCounter.style.textAlign="left",this.frameCounter.style.zIndex=Math.pow(2,32)-1,this.debugContainer.appendChild(this.frameCounter),this.setupDone=!0)},update:function(t,e,i,s){var n,a,o,r;this.enabled&&(this.setupDone||this.setup(),1e3<=i-this.lastFrameCaptureTime&&(n=this.frameCount-this.lastFrameCapture,a=this.renderFrameCount-this.lastRenderFrameCapture,o=this.logicFrameCount-this.lastLogicFrameCapture,r=i-this.lastFrameCaptureTime,this.frameCounter.innerHTML="FPS-count: "+Math.round(n/(r/1e3))+"<br />FPS-time: "+Math.round(1e3/t)+"<br />FPS-render: "+Math.round(a/(r/1e3))+"<br />FPS-logic: "+Math.round(o/(r/1e3)),this.lastFrameCapture=this.frameCount,this.lastRenderFrameCapture=this.renderFrameCount,this.lastLogicFrameCapture=this.logicFrameCount,this.lastFrameCaptureTime=i)),this.frameCount+=1},updateRenderFrameCount:function(){this.renderFrameCount+=1},updateLogicFrameCount:function(){this.logicFrameCount+=1}},n}),n("j13e/anim/J13AnimManager",["require","exports","module","./J13Anim","../utils/J13Utils","../utils/J13EventDispatcher"],function(t,e,i){"use strict";var s=t("./J13Anim"),n=t("../utils/J13Utils"),t=t("../utils/J13EventDispatcher");function a(t){var e,i=t||{};if(this.anims={},i.anims)for(e in i.anims)i.anims.hasOwnProperty(e)&&(this.anims[e]=i.anims[e],this.anims[e].manager=this);this.activeAnims=[],this.animIndexesToRemove=[],this.animsToStart=[]}return a.prototype=n.inherit(new t,{addAnim:function(t){(this.anims[t.id]=t).manager=this},removeAnim:function(t){t=this.anims["string"==typeof t?t:t.id];t&&(this.anims[t.id]=void 0,t.manager=null)},update:function(t,e,i,s){var n,a;if(1<this.animIndexesToRemove.length){this.animIndexesToRemove.sort(function(t,e){return t-e});for(var o=-1,r=this.animIndexesToRemove.length-1;0<=r;--r){var h=this.animIndexesToRemove[r];-1!==o&&o===h?this.animIndexesToRemove.splice(r,1):o=h}}for(;0<this.animIndexesToRemove.length;)this.activeAnims.splice(this.animIndexesToRemove.pop(),1);for(;0<this.animsToStart.length;)this.activeAnims.push(this.animsToStart.shift());if(0<this.activeAnims.length)for(r=0;r<this.activeAnims.length;r+=1)(a=this.activeAnims[r]).restartRequested&&a.preStart(),a.prepared||a.start(i),i>=a.startTime&&i<a.endTime?(n=(i-a.startTime)/a.duration,a.step(n,i)):i>=a.endTime&&(a.step(1,i),a.end(),this.animIndexesToRemove.push(r))},createAnim:function(t){new s(n.extendObj(t,{manager:this}))},getAnim:function(t){return this.anims[t]},startAnimById:function(t){this.startAnim(this.anims[t])},startAnim:function(t){t.manager=this,t.preStart(),this.animsToStart.push(t)},stopAnimById:function(t){this.stopAnim(this.anims[t])},stopAnim:function(t){var e=this.activeAnims.indexOf(t);t.stop(),-1!==e&&this.animIndexesToRemove.push(e)},restartAnimById:function(t){this.restartAnim(this.anims[t])},restartAnim:function(t){-1!==this.activeAnims.indexOf(t)?t.requestRestart():this.startAnim(t)}}),a}),n("j13e/utils/J13AppCacheManager",["require","exports","module","./J13Utils","./J13EventDispatcher"],function(t,e,i){"use strict";var s=t("./J13Utils"),t=t("./J13EventDispatcher");function n(t){t=t||{};this.appCache=t.appCache,this.reloadOnNewUpdate=t.reloadOnNewUpdate,this.finished=!1}return n.events={CHECKING:"checking",LOADNORMALLY:"loadnormally",UPDATINGCACHE:"updatingcache",UPDATEPROGRESS:"updateprogress",UPDATEREADY:"updateready"},n.prototype=s.inherit(new t,{events:n.events,init:function(){if(this.appCache)if(this.appCache.status===this.appCache.UNCACHED)this.loadNormally();else switch(this.appCache.status){case this.appCache.IDLE:case this.appCache.DOWNLOADING:case this.appCache.CHECKING:this.appCache.addEventListener("checking",this.checking.bind(this),!1),this.appCache.addEventListener("noupdate",this.loadNormally.bind(this),!1),this.appCache.addEventListener("obsolete",this.loadNormally.bind(this),!1),this.appCache.addEventListener("error",this.loadNormally.bind(this),!1),this.appCache.addEventListener("cached",this.loadNormally.bind(this),!1),this.appCache.addEventListener("downloading",this.updatingCache.bind(this),!1),this.appCache.addEventListener("progress",this.updateProgress.bind(this),!1),this.appCache.addEventListener("updateready",this.updateReady.bind(this),!1);try{this.appCache.update()}catch(t){this.loadNormally()}break;case this.appCache.UPDATEREADY:this.updateReady();break;case this.appCache.OBSOLETE:this.loadNormally()}else this.loadNormally()},checking:function(t){this.finished||this.dispatch(this.events.CHECKING,{appCache:this.appCache,originalEvent:t})},loadNormally:function(t){this.finished||(this.finished=!0,this.dispatch(this.events.LOADNORMALLY,{appCache:this.appCache,originalEvent:t}))},updateProgress:function(t){this.finished||this.dispatch(this.events.UPDATEPROGRESS,{appCache:this.appCache,originalEvent:t,lengthComputable:t.lengthComputable,total:t.total,loaded:t.loaded})},updatingCache:function(t){this.finished||this.dispatch(this.events.UPDATINGCACHE,{appCache:this.appCache,originalEvent:t})},updateReady:function(t){if(!this.finished){this.finished=!0,this.dispatch(this.events.UPDATEREADY,{appCache:this.appCache,originalEvent:t});try{this.appCache.swapCache()}catch(t){}this.reloadOnNewUpdate&&location.reload()}}}),n}),n("j13e/display/J13DisplayStage",["require","exports","module","./J13DisplayItemContainer","../utils/J13Utils"],function(t,e,i){"use strict";var s=t("./J13DisplayItemContainer"),t=t("../utils/J13Utils");function n(t){var e=t||{};s.call(this,t),this.engine=e.engine||null,this.mainStage=e.mainStage||!1,this.addListener(s.events.childAdded,this.onAnyChildAdded.bind(this)),this.addListener(s.events.childRemoved,this.onAnyChildRemoved.bind(this))}return n.events={},n.prototype=t.inherit(new s,{events:n.events,onAnyChildAdded:function(t){t.data.child.dispatchAddedToStage(this)},onAnyChildRemoved:function(t){t.data.child.dispatchRemovedFromStage(this)},isOnStage:function(){return this.parent?this.parent.isOnStage():this.mainStage},isVisibleOnStage:function(){return this.parent?this.visible&&this.parent.isVisibleOnStage():this.mainStage}}),n}),n("j13e/input/J13KeyboardManager",["require","exports","module","../utils/J13EventDispatcher","../utils/J13Utils"],function(t,e,i){"use strict";var s=t("../utils/J13EventDispatcher"),t=t("../utils/J13Utils");function n(t){this.keyMap={},this.keys=n.keys,window.addEventListener("keydown",this.keyDown.bind(this),!1),window.addEventListener("keyup",this.keyUp.bind(this),!1),window.addEventListener("keypress",this.keyPress.bind(this),!1)}return n.events={DOWN:"down",UP:"up",PRESS:"press"},n.keys={ENTER:8,SHIFT:16,CTRL:17,ALT:18,TAB:9,BACKSPACE:8,SPACE:32,CAPSLOCK:20,ESCAPE:27,";":186,SEMICOLON:186,"=":187,EQUALS:187,",":188,COMMA:188,"-":189,DASH:189,".":190,PERIOD:190,"/":191,FORWARDSLASH:191,"`":192,GRAVEACCENT:192,"[":219,OPENBRACKET:219,"\\":220,BACKSLASH:220,"]":221,CLOSEBRACKET:221,"'":222,SINGLEQUOTE:222,NUMPAD0:96,NUMPAD1:97,NUMPAD2:98,NUMPAD3:99,NUMPAD4:100,NUMPAD5:101,NUMPAD6:102,NUMPAD7:103,NUMPAD8:104,NUMPAD9:105,MULTIPLY:106,ADD:107,SUBTRACT:109,DECIMALPOINT:110,DIVIDE:111,0:48,ZERO:48,1:49,ONE:49,2:50,TWO:50,3:51,THREE:51,4:52,FOUR:52,5:53,FIVE:53,6:54,SIX:54,7:55,SEVEN:55,8:56,EIGHT:56,9:57,NINE:57,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,ARROWLEFT:37,ARROWUP:38,ARROWRIGHT:39,ARROWDOWN:40},n.prototype=t.inherit(new s,{events:n.events,keys:n.keys,keyDown:function(t){this.keyMap[t.keyCode]||(this.keyMap[t.keyCode]=!0,this.dispatch(this.events.DOWN,{keyCode:t.keyCode,keyMap:this.keyMap,originalEvent:t}))},keyUp:function(t){this.keyMap[t.keyCode]&&(this.keyMap[t.keyCode]=!1,this.dispatch(this.events.UP,{keyCode:t.keyCode,keyMap:this.keyMap,originalEvent:t}))},keyPress:function(t){this.dispatch(this.events.PRESS,{keyCode:t.keyCode,keyMap:this.keyMap,originalEvent:t})},isKeyDown:function(t){return this.keyMap[t]||!1},isKeyUp:function(t){return!this.keyMap[t]}}),n}),n("j13e/input/J13MouseManager",["require","exports","module","../utils/J13Utils","../utils/J13EventDispatcher"],function(t,e,i){"use strict";var s=t("../utils/J13Utils"),t=t("../utils/J13EventDispatcher");function n(t){t=t||{};this.element=t.element,this.element.addEventListener("mousedown",this.mouseDown.bind(this),!1),this.element.addEventListener("mousemove",this.mouseMove.bind(this),!1),this.element.addEventListener("mouseup",this.mouseUp.bind(this),!1),this.element.addEventListener("click",this.mouseClick.bind(this),!1),this.element.addEventListener("touchstart",this.touchStart.bind(this),!1),this.element.addEventListener("touchmove",this.touchMove.bind(this),!1),this.element.addEventListener("touchend",this.touchEnd.bind(this),!1),this.enableMouseInputs=!0,this.enableTouchInputs=!0,this.numTouch=0,this.skipMouseDown=0,this.skipMouseUp=0,this.skipMouseClicks=0,this.mouseX=0,this.mouseY=0,this.scaledMouseX=0,this.scaledMouseY=0,this.scaleX=1,this.scaleY=1,this.zealousTouchDetect=!!t.hasOwnProperty("zealousTouchDetect")&&t.zealousTouchDetect,this.touchDetected=!1}return n.events={DOWN:"down",MOVE:"move",UP:"up",CLICK:"click",MOUSEDOWN:"mousedown",MOUSEMOVE:"mousemove",MOUSEUP:"mouseup",MOUSECLICK:"mouseclick",TOUCHSTART:"touchstart",TOUCHMOVE:"touchmove",TOUCHEND:"touchend"},n.prototype=s.inherit(new t,{events:n.events,resize:function(t){},resetSkips:function(){this.skipMouseDown=0,this.skipMouseUp=0},updateMousePos:function(t){var e=t.target.getBoundingClientRect(),i=e.left,e=e.top,s=0,n=0;switch(t.type){case"touchstart":case"touchmove":case"touchend":s=t.changedTouches[0].pageX,n=t.changedTouches[0].pageY;break;case"mousedown":case"mousemove":case"mouseup":case"click":s=t.pageX,n=t.pageY}n-=e,this.mouseX=s-=i,this.mouseY=n,this.scaledMouseX=Math.round(s*this.scaleX),this.scaledMouseY=Math.round(n*this.scaleY)},mouseDown:function(t){t.preventDefault(),t.stopPropagation(),this.enableMouseInputs&&(this.updateMousePos(t),this.dispatch(this.events.MOUSEDOWN,{originalEvent:t,x:this.mouseX,y:this.mouseY,scaledX:this.scaledMouseX,scaledY:this.scaledMouseY}),0<this.skipMouseDown?--this.skipMouseDown:this.dispatch(this.events.DOWN,{originalEvent:t,x:this.mouseX,y:this.mouseY,scaledX:this.scaledMouseX,scaledY:this.scaledMouseY}))},mouseMove:function(t){t.preventDefault(),t.stopPropagation(),this.enableMouseInputs&&(this.updateMousePos(t),this.dispatch(this.events.MOUSEMOVE,{originalEvent:t,x:this.mouseX,y:this.mouseY,scaledX:this.scaledMouseX,scaledY:this.scaledMouseY}),0===this.numTouch&&this.dispatch(this.events.MOVE,{originalEvent:t,x:this.mouseX,y:this.mouseY,scaledX:this.scaledMouseX,scaledY:this.scaledMouseY}))},mouseUp:function(t){t.preventDefault(),t.stopPropagation(),this.enableMouseInputs&&(this.updateMousePos(t),this.dispatch(this.events.MOUSEUP,{originalEvent:t,x:this.mouseX,y:this.mouseY,scaledX:this.scaledMouseX,scaledY:this.scaledMouseY}),0<this.skipMouseUp?--this.skipMouseUp:this.dispatch(this.events.UP,{originalEvent:t,x:this.mouseX,y:this.mouseY,scaledX:this.scaledMouseX,scaledY:this.scaledMouseY}))},mouseClick:function(t){t.preventDefault(),t.stopPropagation(),this.enableMouseInputs&&(this.updateMousePos(t),this.dispatch(this.events.MOUSECLICK,{originalEvent:t,x:this.mouseX,y:this.mouseY,scaledX:this.scaledMouseX,scaledY:this.scaledMouseY}),0<this.skipMouseClicks?--this.skipMouseClicks:0===this.numTouch&&this.dispatch(this.events.CLICK,{originalEvent:t,x:this.mouseX,y:this.mouseY,scaledX:this.scaledMouseX,scaledY:this.scaledMouseY}))},touchStart:function(t){t.preventDefault(),t.stopPropagation(),this.enableTouchInputs&&(this.updateMousePos(t),this.numTouch+=1,this.skipMouseDown+=1,this.touchDetected=!0,this.skipMouseClicks+=1,this.zealousTouchDetect&&(this.enableMouseInputs=!1),this.dispatch(this.events.TOUCHSTART,{originalEvent:t,x:this.mouseX,y:this.mouseY,scaledX:this.scaledMouseX,scaledY:this.scaledMouseY}),this.dispatch(this.events.DOWN,{originalEvent:t,x:this.mouseX,y:this.mouseY,scaledX:this.scaledMouseX,scaledY:this.scaledMouseY}))},touchMove:function(t){t.preventDefault(),t.stopPropagation(),this.enableTouchInputs&&(this.updateMousePos(t),this.dispatch(this.events.TOUCHMOVE,{originalEvent:t,x:this.mouseX,y:this.mouseY,scaledX:this.scaledMouseX,scaledY:this.scaledMouseY}),this.dispatch(this.events.MOVE,{originalEvent:t,x:this.mouseX,y:this.mouseY,scaledX:this.scaledMouseX,scaledY:this.scaledMouseY}))},touchEnd:function(t){t.preventDefault(),t.stopPropagation(),this.enableTouchInputs&&(this.updateMousePos(t),--this.numTouch,this.skipMouseUp+=1,this.dispatch(this.events.TOUCHEND,{originalEvent:t,x:this.mouseX,y:this.mouseY,scaledX:this.scaledMouseX,scaledY:this.scaledMouseY}),this.dispatch(this.events.UP,{originalEvent:t,x:this.mouseX,y:this.mouseY,scaledX:this.scaledMouseX,scaledY:this.scaledMouseY}))}}),n}),n("j13e/J13E",["require","exports","module","./utils/J13Polyfills","./utils/J13DebugManager","./anim/J13AnimManager","./utils/J13AppCacheManager","./utils/J13CookieJar","./display/J13DisplayStage","./display/J13ButtonManager","./input/J13KeyboardManager","./input/J13MouseManager","./utils/J13EventDispatcher","./display/J13DisplayItemContainer","./display/J13DisplayButton","./utils/J13Utils"],function(t,e,i){"use strict";t("./utils/J13Polyfills");var s=t("./utils/J13DebugManager"),n=t("./anim/J13AnimManager"),a=t("./utils/J13AppCacheManager"),o=t("./utils/J13CookieJar"),r=t("./display/J13DisplayStage"),h=t("./display/J13ButtonManager"),l=t("./input/J13KeyboardManager"),d=t("./input/J13MouseManager"),u=t("./utils/J13EventDispatcher"),c=t("./display/J13DisplayItemContainer"),p=t("./display/J13DisplayButton"),t=t("./utils/J13Utils");function m(t){t=t||{};if(this.initted=!1,this.started=!1,this.canvas=null,this.canvasContext=null,this.canvasContainer=null,this.looping=!1,this.logicLoopEnabled=!1,this.renderLoopEnabled=!1,this.animationFrameId=-1,this.lastMainLoopTime=0,this.fixedAccumulator=0,this.frameCount=0,this.globalFont=t.globalFont||"30px Arial",this.backgroundFillStyle=t.backgroundFillStyle||"#ffffff",this.minFrameDelay=t.minFrameDelay||m.DEFAULTS.MINFRAMEDELAY,this.maxFrameDelay=t.maxFrameDelay||m.DEFAULTS.MAXFRAMEDELAY,this.fixedDTM=t.fixedDTM||m.DEFAULTS.FIXEDDTM,this.fixedDTS=this.fixedDTM/1e3,this.maxCycles=t.maxCycles||m.DEFAULTS.MAXCYCLES,this.autoStartPreload=!!t.hasOwnProperty("autoStartPreload")&&t.autoStartPreload,this.loaders=[],t.canvas?this.canvas=t.canvas:t.canvasId&&(this.canvas=document.getElementById(t.canvasId)),t.canvasContainer?this.canvasContainer=t.canvasContainer:t.canvasContainerId&&(this.canvasContainer=document.getElementById(t.canvasContainerId)),this.debugManager=new s({debugContainer:t.debugContainer||t.canvasContainer||null,enabled:t.debug||!1}),this.animManager=new n({}),this.useAppCache=!!t.hasOwnProperty("useAppCache")&&t.useAppCache,this.appCacheManager=null,this.useAppCache&&(this.appCacheManager=new a({appCache:window.applicationCache,reloadOnNewUpdate:!!t.hasOwnProperty("reloadOnNewUpdate")&&t.reloadOnNewUpdate})),!this.canvas)throw new Error("canvas or canvasId needs to be defined.");this.canvasContext=this.canvas.getContext("2d"),this.cookieJar=o,this.bindedMainLoop=this.mainLoop.bind(this),this.requestMainLoop=function(){window.requestAnimationFrame(this.bindedMainLoop)}.bind(this),this.stage=new r({engine:this,mainStage:!0}),this.buttonManager=new h,this.keyboardManager=new l,this.mouseManager=new d({element:t.mouseManagerTarget||this.canvas}),this.engineContext={dtm:0,dts:0,time:0,fixedDTM:this.fixedDTM,fixedDTS:this.fixedDTS,fixedAccumulator:0,canvas:this.canvas,canvasContext:this.canvasContext,initted:!1,started:!1,stage:this.stage,engine:this},this.init()}return m.DEFAULTS={MINFRAMEDELAY:1e3/60,MAXFRAMEDELAY:200,FIXEDDTM:1e3/60,MAXCYCLES:5},m.events={initted:"initted",preloadStarted:"preloadstarted",preloadProgress:"preloadprogress",preloadComplete:"preloadcomplete",started:"started",enterLogicLoop:"enterlogicloop",exitLogicLoop:"exitlogicloop",enterRenderLoop:"enterrenderloop",exitRenderLoop:"exitrenderloop",enterMainLoop:"entermainloop",exitMainLoop:"exitmainloop"},m.preloadType={assets:"assets",appCache:"appcache"},m.prototype=t.inherit(new u,{events:m.events,init:function(){this.initted||(this.initted=!0,this.engineContext.initted=this.initted,this.stage.addListener(c.events.anyChildAdded,function(t){if(p.isButton(t.data.child))this.buttonManager.addButton(t.data.child);else if(t.data.child.getAllChildren)for(var e=t.data.child.getAllChildren(),i=0;i<e.length;i+=1)p.isButton(e[i])&&this.buttonManager.addButton(e[i])}.bind(this)),this.stage.addListener(c.events.anyChildRemoved,function(t){if(p.isButton(t.data.child))this.buttonManager.removeButton(t.data.child);else if(t.data.child.getAllChildren)for(var e=t.data.child.getAllChildren(),i=0;i<e.length;i+=1)p.isButton(e[i])&&this.buttonManager.removeButton(e[i])}.bind(this)),this.mouseManager.addListener(d.events.DOWN,this.buttonManager.onDown.bind(this.buttonManager)),this.mouseManager.addListener(d.events.UP,this.buttonManager.onUp.bind(this.buttonManager)),this.mouseManager.addListener(d.events.MOVE,this.buttonManager.onMove.bind(this.buttonManager)),this.canvasContext.font=this.globalFont,this.dispatch(this.events.initted),this.preStart())},addLoader:function(t){this.loaders.push(t)},startPreload:function(){this.appCacheManager?this.startAppCachePreload():this.startAssetsPreload()},startAppCachePreload:function(){this.appCacheManager.addListener(this.appCacheManager.events.CHECKING,this.checkingAppCachePreload.bind(this)),this.appCacheManager.addListener(this.appCacheManager.events.LOADNORMALLY,this.startAssetsPreload.bind(this)),this.appCacheManager.addListener(this.appCacheManager.events.UPDATEPROGRESS,this.progressAppCachePreload.bind(this)),this.appCacheManager.addListener(this.appCacheManager.events.UPDATEREADY,this.completeAppCachePreload.bind(this)),this.dispatch(m.events.preloadStarted,{preloadType:m.preloadType.appCache}),this.appCacheManager.init()},checkingAppCachePreload:function(t){},progressAppCachePreload:function(t){this.dispatch(m.events.preloadProgress,{preloadType:m.preloadType.appCache,lengthComputable:t.data.lengthComputable,total:t.data.total,loaded:t.data.loaded})},completeAppCachePreload:function(t){this.dispatch(m.events.preloadComplete,{preloadType:m.preloadType.appCache})},startAssetsPreload:function(){for(var t=0,e=0;e<this.loaders.length;e+=1)this.loaders[e].includeInPreload&&(this.loaders[e].addListener(this.loaders[e].events.load,this.progressAssetsPreload.bind(this)),this.loaders[e].addListener(this.loaders[e].events.allLoad,this.checkLoaderAssetsPreload.bind(this)),t+=1);for(this.dispatch(this.events.preloadStarted,{preloadType:m.preloadType.assets}),e=0;e<this.loaders.length;e+=1)this.loaders[e].startLoading();0===t&&this.completeAssetsPreload()},progressAssetsPreload:function(t){for(var e=0,i=0,s=0,n=0;n<this.loaders.length;n+=1)this.loaders[n].includeInPreload&&(i+=this.loaders[n].total,e+=this.loaders[n].loaded,s+=this.loaders[n].errors);this.dispatch(this.events.preloadProgress,{total:i,loaded:e,errors:s,preloadType:m.preloadType.assets})},checkLoaderAssetsPreload:function(t){var e=0,i=0;this.loaders.forEach(function(t){t.includeInPreload&&(i+=1,t.total===t.loaded&&(e+=1))}),i<=e&&this.completeAssetsPreload()},completeAssetsPreload:function(){this.dispatch(this.events.preloadComplete,{preloadType:m.preloadType.assets}),this.start()},preStart:function(){this.logicLoopEnabled=!0,this.renderLoopEnabled=!0,this.startMainLoop(),this.autoStartPreload&&this.startPreload()},start:function(){this.started||(this.started=!0,this.engineContext.started=this.started,this.dispatch(this.events.started))},startMainLoop:function(){this.looping=!0,this.animationFrameId=window.requestAnimationFrame(this.bindedMainLoop)},stopMainLoop:function(){this.looping=!1,window.cancelAnimationFrame(this.animationFrameId)},restartMainLoop:function(){this.stopMainLoop(),this.startMainLoop()},mainLoop:function(t){var e,i,s=t;if(this.dispatch(this.events.enterMainLoop),this.looping?this.animationFrameId=window.requestAnimationFrame(this.bindedMainLoop):window.cancelAnimationFrame(this.animationFrameId),e=(t=(t=(t=s-this.lastMainLoopTime)<this.minFrameDelay?this.minFrameDelay:t)>this.maxFrameDelay?this.maxFrameDelay:t)/1e3,this.engineContext.dtm=t,this.engineContext.dts=e,this.engineContext.time=s,this.logicLoopEnabled)for(this.fixedAccumulator+=t,i=0;this.fixedAccumulator>=this.fixedDTM&&i<this.maxCycles;i+=1)this.engineContext.fixedAccumulator=this.fixedAccumulator,this.logicLoop(this.fixedDTM,this.fixedDTS,s,this.engineContext),this.fixedAccumulator-=this.fixedDTM;this.animManager.update(t,e,s,this.engineContext),this.renderLoopEnabled&&this.renderLoop(t,e,s,this.engineContext),this.debugManager.update(t,e,s,this.engineContext),this.frameCount+=1,this.lastMainLoopTime=s,this.dispatch(this.events.exitMainLoop)},logicLoop:function(t,e,i,s){this.dispatch(this.events.enterLogicLoop,s),this.dispatch(this.events.exitLogicLoop,s),this.debugManager.updateLogicFrameCount()},renderLoop:function(t,e,i,s){var n=s.canvas,a=s.canvasContext;this.dispatch(this.events.enterRenderLoop,s),a.save(),a.fillStyle=this.backgroundFillStyle,a.fillRect(0,0,n.width,n.height),a.restore(),this.stage.stageRender(t,e,i,s),this.dispatch(this.events.exitRenderLoop,s),this.debugManager.updateRenderFrameCount()}}),m}),n("j13e/display/J13SpriteSheet",["require","exports","module","../utils/J13Utils","../math/J13Rect","./J13DisplaySprite"],function(t,e,i){"use strict";var r=t("../utils/J13Utils"),h=t("../math/J13Rect"),l=t("./J13DisplaySprite");function d(t){t=t||{};if(this.image=t.image||null,!this.image)throw new Error("J13SpriteSheet: invalid image.");this.spriteMap=t.spriteMap||{},this.sprites={}}return d.createIdFromRect=function(t){t={left:t.left,top:t.top,right:t.right,bottom:t.bottom};return r.objectToParamString(t)},d.createIdFromFrameMap=function(t){var e,i=[];for(e in t)t.hasOwnProperty(e)&&i.push(e);return i.join(",")},d.isFrameMap=function(t){if(!t)return!1;for(var e in t)if(t.hasOwnProperty(e)&&!h.isJ13Rect(t[e]))return!1;return!0},d.prototype={getSprite:function(t,e){var i,s=null,n="string"==typeof t,a=h.isJ13Rect(t,!0),o=d.isFrameMap(t);return n?i=t:a?i=d.createIdFromRect(t):o&&(i=d.createIdFromFrameMap(t)),(s=this.sprites[i])||(n?(s=new l(r.inherit(this.spriteMap[i],{image:this.image})),this.sprites[i]=s):a?(s=new l({image:this.image,rect:t}),this.sprites[i]=s):o&&(s=new l({image:this.image,frameMap:t}),this.sprites[i]=s)),s=s&&!e?s.copy():s}},d}),n("j13e/utils/J13Img",["require","exports","module"],function(t,e,i){"use strict";function s(t){var e=new Image;return e.preSrc=t,e.onload=s.imgOnLoad,e.onerror=s.imgOnError,e.alreadyLoaded=!1,e.load=function(t,e){this.onLoadFunction=t,this.onErrorFunction=e,this.src=this.preSrc,this.complete&&!this.alreadyLoaded&&(this.alreadyLoaded=!0,this.onLoadFunction(this))},e}return s.imgOnLoad=function(t){!this.alreadyLoaded&&this.onLoadFunction&&(this.alreadyLoaded=!0,this.onLoadFunction(this))},s.imgOnError=function(t){this.onErrorFunction&&this.onErrorFunction(this)},s}),n("j13e/utils/J13ImageManager",["require","exports","module","./J13Loader","./J13Utils","./J13Img"],function(t,e,i){"use strict";var s=t("./J13Loader"),n=t("./J13Utils"),a=t("./J13Img");function o(t){var e=t||{};s.call(this,t),this.imgs={},this.imgListObj=e.images||e.imgs}return o.prototype=n.inherit(new s,{startLoading:function(){var t,e=this.onLoad.bind(this),i=this.onError.bind(this),s=[];for(t in this.imgListObj)this.imgListObj.hasOwnProperty(t)&&(this.imgs[t]=this.imgs[this.imgListObj[t]]=new a(this.imgListObj[t]),this.total+=1,this.imgs[t].imgName=t,s.push(this.imgs[t].load.bind(this.imgs[t])));0===this.total?this.onAllLoad():s.forEach(function(t){t(e,i)})},get:function(t){return this.imgs[t]}}),o}),n("src/Game",["require","exports","module","./Resources","./utils/Common","./Settings","j13e/utils/J13DOM","cocoonjs/CocoonInclude","./efs/InterstitialEfs","./efs/EfManager","./utils/Scouter","./utils/GameState","./utils/GameStateManager","./screens/PreloadScreen","./screens/PlayScreen","./utils/SoundManager","j13e/J13E","j13e/anim/J13Anim","j13e/utils/J13AppCacheManager","j13e/display/J13SpriteSheet","j13e/display/J13DisplayItemContainer","j13e/display/J13DisplayText","j13e/utils/J13ImageManager","j13e/utils/J13Utils","j13e/utils/J13EventDispatcher"],function(t,e,i){"use strict";var d=t("./Resources"),s=t("./utils/Common"),u=t("./Settings"),c=t("j13e/utils/J13DOM"),n=t("cocoonjs/CocoonInclude"),a=t("./efs/InterstitialEfs"),o=t("./efs/EfManager"),r=t("./utils/Scouter"),h=t("./utils/GameState"),l=t("./utils/GameStateManager"),p=t("./screens/PreloadScreen"),m=t("./screens/PlayScreen"),f=t("./utils/SoundManager"),g=t("j13e/J13E"),y=t("j13e/anim/J13Anim"),w=(t("j13e/utils/J13AppCacheManager"),t("j13e/display/J13SpriteSheet")),v=t("j13e/display/J13DisplayItemContainer"),b=t("j13e/display/J13DisplayText"),S=t("j13e/utils/J13ImageManager"),C=t("j13e/utils/J13Utils"),A=t("j13e/utils/J13EventDispatcher");function I(t){A.call(this,t),this.initialUrlQuery=s.paramStringToObject(window.location.search),this.canvas=c.get("gameCanvas"),this.canvasCon=c.get("gameCanvasCon")||document.body||document.getElementsByTagName("body")[0],C.makeUnselectable(this.canvasCon,!0),this.canvas||(u.cocoon?(this.canvas=n.App.createScreenCanvas(),this.canvas.style.cssText="idtkscale:ScaleToFill;"):this.canvas=c.create("canvas","gameCanvas"),this.canvas.width=u.width,this.canvas.height=u.height,this.canvasCon&&this.canvasCon.appendChild(this.canvas)),this.engine=new g({canvas:this.canvas,canvasContainer:this.canvasCon,backgroundFillStyle:"#008793",debug:!1,debugContainer:u.cocoon?null:c.get("centerDiv"),useAppCache:!0,reloadOnNewUpdate:!0}),(this.engine.engineContext.game=this).stage=this.engine.stage,this.lastLogicTime=0,d.soundManager=new f({sounds:d.sounds}),d.animManager=this.engine.animManager,d.imgManager=new S({images:d.images,includeInPreload:!0}),d.mouseManager=this.engine.mouseManager,d.mouseManager.zealousTouchDetect=!0,d.mouseManager.addListener(d.mouseManager.events.DOWN,function(t){1e3<=(new Date).getTime()-this.lastLogicTime&&this.engine.restartMainLoop()}.bind(this));window.addEventListener("resize",this.onResize.bind(this),!1),this.introPlayed=!1,u.cocoon&&(n.App.setAppShouldFinishCallback(function(){return!0}),n.App.setPreferredOrientation(n.App.Orientations.PORTRAIT)),u.kik&&((t=window.kik)&&t.browser&&t.browser.setOrientationLock&&t.browser.setOrientationLock("portrait"),t&&t.browser&&t.browser.on&&(t.browser.on("background",function(){this.engine.stopMainLoop()}.bind(this)),t.browser.on("foreground",function(){this.engine.restartMainLoop()}.bind(this))),t&&t.browser&&t.browser.statusBar&&t.browser.statusBar(!1));t=null,t=u.inAppGames?{interstitialAds:a.getInAppAds(this)}:u.cocoon?{interstitialAds:a.getNativeAds(this)}:{interstitialScreen:c.get("adInterstitialScreen"),interstitialClose:c.get("adInterstitialClose"),interstitialAds:a.getWebAds(this)};this.adManager=d.adManager=new o(t),this.init()}return I.prototype=C.inherit(new A,{init:function(){this.initScreen=new v({width:u.width,height:u.height,visible:!0}),this.stage.addChild(this.initScreen),this.initScreenText=new b({font:"30px Arial",fillStyle:"#ffffff",text:"Loading.",textBaseline:"middle",textAlign:"center",x:u.width/2,y:u.height/2}),this.initScreen.addChild(this.initScreenText),this.preloadScreen=new p({width:u.width,height:u.height,visible:!1}),this.stage.addChild(this.preloadScreen);var e=this;this.gsm=new l({game:this,animManager:d.animManager,states:[new h({id:d.gameStates.init,start:function(t,e){t.initScreen.visible=!0},end:function(t,e){t.initScreen.visible=!1}}),new h({id:d.gameStates.appCache,start:function(t,e){t.preloadScreen.visible=!0},end:function(t,e){t.preloadScreen.visible=!1}}),new h({id:d.gameStates.preload,start:function(t,e){t.preloadScreen.visible=!0},end:function(t,e){t.preloadScreen.visible=!1},endAnim:new y({startValue:0,endValue:1,duration:500,startCallback:function(){e.preloadScreen.overlay.visible=!0,e.preloadScreen.overlay.opacity=0},stepCallback:function(t){e.preloadScreen.overlay.opacity=t}})}),new h({id:d.gameStates.mainMenu,startAnim:new y({startValue:1,endValue:0,duration:500,startCallback:function(){window.fta&&window.fta(function(t){t.hide()}),e.playScreen.transitionOverlay.visible=!0,e.playScreen.transitionOverlay.opacity=1},stepCallback:function(t){e.playScreen.transitionOverlay.opacity=t},endCallback:function(){e.playScreen.transitionOverlay.visible=!1,e.playScreen.transitionOverlay.opacity=0}}),start:function(t,e){t.playScreen.show({reset:!0}),t.playScreen.mainMenuScene.show(),t.playScreen.playViewport.hideScore()},end:function(t,e){t.playScreen.mainMenuScene.hide()}}),new h({id:d.gameStates.level,start:function(t,e){t.playScreen.playViewport.showScore(),window.crossPromo&&window.crossPromo.hide&&window.crossPromo.hide()},end:function(t,e){window.crossPromo&&window.crossPromo.show&&window.crossPromo.show()}}),new h({id:d.gameStates.gameOver,start:function(t,e){t.adManager.shouldShowInterstitial()&&t.adManager.refreshInterstitial(),setTimeout(function(){d.gsm.toState(d.gameStates.hiScore,e)},500)},end:function(t,e){}}),new h({id:d.gameStates.hiScore,start:function(t,e){d.soundManager.play(d.soundNames.menu),t.playScreen.hiScoreScene.show(e,function(){t.playScreen.playViewport.hideScore()}),t.adManager.shouldShowInterstitial()?(window.crossPromo&&window.crossPromo.hide&&window.crossPromo.hide(),t.adManager.showInterstitial(function(){window.crossPromo&&window.crossPromo.show&&window.crossPromo.show(),window.fta&&window.fta(function(t){t.show()})})):window.fta&&window.fta(function(t){t.show()})},end:function(t,e){t.playScreen.hiScoreScene.hide()},endAnim:new y({startValue:0,endValue:1,duration:500,startCallback:function(){e.playScreen.transitionOverlay.visible=!0,e.playScreen.transitionOverlay.opacity=0},stepCallback:function(t){e.playScreen.transitionOverlay.opacity=t}})})],startState:d.gameStates.init}),d.gsm=this.gsm,this.onResize(),this.engine.addLoader(d.imgManager),this.engine.addLoader(d.soundManager),this.engine.addListener(g.events.enterLogicLoop,this.logicLoop.bind(this)),this.engine.addListener(g.events.enterRenderLoop,this.enterRenderLoop.bind(this)),this.engine.addListener(g.events.exitRenderLoop,this.exitRenderLoop.bind(this)),this.engine.addListener(g.events.preloadStarted,this.preloadStarted.bind(this)),this.engine.addListener(g.events.preloadProgress,this.preloadProgress.bind(this)),this.engine.addListener(g.events.preloadComplete,this.preloadComplete.bind(this)),this.engine.addListener(g.events.started,this.start.bind(this)),d.scouter=new r({game:this,sendToGA:!0,debugTrace:!1}),this.onResize(),this.dispatch(d.events.gameInitted),this.engine.startPreload()},preloadStarted:function(t){t.data.preloadType===g.preloadType.appCache?(this.gsm.toState(d.gameStates.appCache),this.preloadScreen.setText("Checking...",!1)):(this.gsm.toState(d.gameStates.preload),this.preloadScreen.setText("Loading...",!1))},preloadProgress:function(t){var e=100*(t.data.loaded/t.data.total);this.preloadScreen.setPrefix((t.data.preloadType===g.preloadType.appCache?"Updating...":"Loading...")+"("),this.preloadScreen.setSuffix(")"),this.preloadScreen.setPercent(e,!0)},preloadComplete:function(t){t.data.preloadType===g.preloadType.appCache?this.preloadScreen.setText("Reloading...",!0):this.preloadScreen.setText("Launching...",!0)},onResize:function(t){this.autoResizeCanvas(),setTimeout(this.autoResizeCanvas.bind(this),500)},autoResizeCanvas:function(){var t,e,i,s,n,a,o,r,h,l;!u.cocoon&&this.canvasCon&&(a=window.getComputedStyle(c.get("mainCon")),n=parseInt(a.width,10),a=parseInt(a.height,10),o=u.width/u.height,r=n/a,h=u.width,l=u.height,C.isMobile.any()?(t=i=n,e=s=a):(i=n,e=t=0,s=a),o<r?(s<u.height||e>u.height)&&(l=a,h=Math.floor(o*l)):(i<u.width||t>u.width)&&(h=n,l=Math.floor(h/o)),this.canvasCon.style.width=h+"px",this.canvasCon.style.height=l+"px",d.mouseManager.scaleX=d.mouseManager.scaleY=u.width/h)},start:function(t){d.loadedImages=d.imgManager.imgs,d.birdSheet=new w({image:d.loadedImages[d.images.flappyYellowSprite],spriteMap:d.spriteMap.birds}),d.volumeSheet=new w({image:d.loadedImages[d.images.volumeSprite],spriteMap:d.spriteMap.volume}),this.playScreen=new m({game:this,width:u.width,height:u.height,visible:!1,kikButtonCallback:this.kikShare.bind(this)}),this.stage.addChild(this.playScreen),this.gsm.toState(d.gameStates.mainMenu)},openMenu:function(t){this.gsm.getCurrentStateId()!==d.gameStates.mainMenu&&this.gsm.toState(d.gameStates.mainMenu)},logicLoop:function(t){var t=t.data,e=t.fixedDTM,i=t.fixedDTS,s=t.time;(new Date).getTime();t.started&&this.playScreen.update(e,i,s,t);(new Date).getTime();this.lastLogicTime=(new Date).getTime()},enterRenderLoop:function(t){this.debugRenderStartTime=(new Date).getTime()},exitRenderLoop:function(t){this.debugRenderEndTime=(new Date).getTime();this.debugRenderEndTime,this.debugRenderEndTime},getNumPlays:function(){return this.playScreen.numPlays},kikShare:function(t){window.cards&&window.cards.kik&&window.kik.send({title:"I got "+this.playScreen.playViewport.bounces+" bounces on Bouncy Flappy!",text:"Do you think you can bounce more?",pic:"/imgs/favicon-96.png",data:{score:this.playScreen.playViewport.bounces,date:Date.now()}})},crazyGamesBackButtonCallback:function(){window.location.href=this.initialUrlQuery.back_url||"http://crazygames.com"},trace:function(t){this.engine.debugManager&&this.engine.debugManager.output&&(this.engine.debugManager.output.innerHTML=t||"")}}),I}),n("src/analytics",["require","src/Settings","cocoonjs/CocoonInclude"],function(t){var i,s,n,e,a,o,r,h,l=t("src/Settings"),d=t("cocoonjs/CocoonInclude");return l.cocoon?window.cordova||(i=!1,s=[],n=function(){for(var t;t=s.shift();)t=t,console.log("Sending "+t+" to the Webview"),d.App.forwardAsync(t)},window.gaInterfaceIsReady=function(){d.App.forwardAsync("CocoonJS.App.show(0, 0, "+window.innerWidth*window.devicePixelRatio+","+window.innerHeight*window.devicePixelRatio+");",function(){i=!0,n()})},console.log("Creating GAI interface"),d.App.loadInTheWebView("https://more.gamemix.com/cocoonoverlay.html?currentGame=undeadescape"),window.ga=function(){for(var t="",e=0;e<arguments.length;e++)0<e&&(t+=","),t+=JSON.stringify(arguments[e]);s.push("window.ga("+t+")"),i&&n()}):(e=window,r=document,o="ga",e.GoogleAnalyticsObject=o,e.ga=e.ga||function(){(e.ga.q=e.ga.q||[]).push(arguments)},e.ga.l=+new Date,o=r.createElement("script"),r=r.getElementsByTagName("script")[0],o.async=1,o.src="//www.google-analytics.com/analytics.js",r.parentNode.insertBefore(o,r)),ga("require","displayfeatures"),ga("create",l.gaId),a=window,o=document,r="http://gmga.gamemix.com",h="gmga",a.GameMixGA=h,a[h]=a[h]||function(t){a[h].q=a[h].q||[],a[h].q.push(t)},a[h]({gmgaDomain:r}),t=o.createElement("script"),o=o.getElementsByTagName("script")[0],t.type="text/javascript",t.async=!0,t.src=r+"/client/gmga.js",o.parentNode.insertBefore(t,o),gmga(l.gmapiId),!0}),function(){"use strict";t.config({baseUrl:"js/lib",packages:["j13e"],paths:{src:"../src",cocoonjs:"nococoonjs"},urlArgs:"t="+Date.now()}),t(["require","j13e","src/gmapi","src/fta","src/Game","cocoonjs/CocoonInclude","src/analytics"],function(t){new(t("src/Game"))})}(),n("../main",function(){})}();