(function(){"use strict"})();var tm=tm||{};tm.global=window||global||this,"undefined"!=typeof module&&module.exports&&(module.exports=tm),function(){tm.VERSION="0.2.0",tm.LIB_ROOT=function(){if(window.document)for(var t=document.getElementsByTagName("script"),e=0,i=t.length;i>e;++e);}(),tm.BROWSER=function(){return window.navigator?/chrome/i.test(navigator.userAgent)?"Chrome":/safari/i.test(navigator.userAgent)?"Safari":/firefox/i.test(navigator.userAgent)?"Firefox":/opera/i.test(navigator.userAgent)?"Opera":/getcko/i.test(navigator.userAgent)?"Getcko":/msie/i.test(navigator.userAgent)?"IE":null:void 0}(),tm.VENDER_PREFIX=function(){if(window){var t={Chrome:"webkit",Safari:"webkit",Firefox:"moz",Opera:"o",IE:"ms"};return t[tm.BROWSER]||""}}(),tm.isMobile=function(){if(window.navigator){var t=navigator.userAgent;return t.indexOf("iPhone")>0||t.indexOf("iPad")>0||t.indexOf("Android")>0}}(),tm.createClass=function(t){t.init=t.init||function(){},t.superClass=t.superClass||null;var e=function(){var t=new e.prototype.creator;return e.prototype.init.apply(t,arguments),t};t.superClass&&(t.init.owner=e,e.prototype=Object.create(t.superClass.prototype),e.prototype.superInit=function(){var t=this.superInit.caller,e=t.owner,i=e.prototype.superClass,n=i.prototype.init;n.apply(this,arguments)},e.prototype.constructor=e),e.prototype.selfClass=e;for(var i in t)e.prototype[i]=t[i];return e.prototype.creator=function(){return this},e.prototype.creator.prototype=e.prototype,e._class=!0,e},tm.classes={};var _calssDefinedCallback={};tm.define=function(t,e){var i=t.lastIndexOf("."),n=t.substring(0,i),s=n?tm.using(n):tm.global,r=n?t.substring(i+1):t;Function.prototype.bind,Array.prototype.unshift,e._path=t,e._className=r;var o=null,a=e.superClass;if(a&&"string"==typeof a){var h=a;if(a=tm.using(a),!a._class)return _calssDefinedCallback[h]||(_calssDefinedCallback[h]=[]),_calssDefinedCallback[h].push(function(){tm.define(t,e)}),void 0;e.superClass=a,o=tm.createClass(e)}else o=tm.createClass(e);if(s[r]=tm.classes[t]=o,_calssDefinedCallback[t]){for(var u=_calssDefinedCallback[t],c=0,l=u.length;l>c;++c)u[c]();delete _calssDefinedCallback[t]}return o},tm.namespace=function(t,e){var t=tm.using(t);e.call(t,t)},tm.using=function(t){if(tm.classes[t])return tm.classes[t];for(var e=t.split(/[,.\/ ]|::/),i=tm.global,n=0,s=e.length;s>n;++n){var r=e[n];i=i[r]||(i[r]={})}return tm.classes[t]=i,i},tm.globalize=function(t){return tm.global.$strict(t),this},tm.import=function(t){var e=tm[t];return tm.global.$strict(e),this},tm.setLoop=function(t,e){var i=function(){var i=(new Date).getTime();t();var n=(new Date).getTime()-i,s=e-n;s=s>0?s:0,setTimeout(arguments.callee,s)};setTimeout(i,e)},tm.inform=function(parent){parent=parent||document.body;var eInfo=document.createElement("div");with(eInfo.setAttribute("class","tm-info"),eInfo.addEventListener("mouseover",function(){this.style.opacity=.9},!1),eInfo.addEventListener("mouseout",function(){this.style.opacity=.25},!1),eInfo.style)position="absolute",width="100%",bottom="0px",left="0px",right="0px",margin="0px",padding="10px 0px",zIndex="0",textAlign="center",fontFamily='"Meiryo", "メイリオ", "ヒラギノ角ゴ Pro W3", sans-serif',fontSize="13px",opacity="0.25",backgroundColor="rgb(230,230,255)",background="-webkit-linear-gradient(top, hsla(0, 100%, 100%, 0.8) 0%, hsla(0, 100%, 100%, 0.3) 50%, hsla(0, 100%, 100%, 0.1) 51%, hsla(0, 100%, 100%, 0.2) 100%), rgb(190,190,210)",background="-moz-linear-gradient(top, hsla(0, 100%, 100%, 0.8) 0%, hsla(0, 100%, 100%, 0.3) 50%, hsla(0, 100%, 100%, 0.1) 51%, hsla(0, 100%, 100%, 0.2) 100%), rgb(190,190,210)",WebkitTransition="1s",MozTransition="1s";eInfo.innerHTML="このプログラムで利用している JavaScript ライブラリ 『tmlib.js』 についてはこちら.".format({projectLink:"https://github.com/phi1618/tmlib.js"}),parent.appendChild(eInfo)}}(),function(){window&&(window.requestAnimationFrame||(window.requestAnimationFrame=window[tm.VENDER_PREFIX+"RequestAnimationFrame"]||function(t){window.setTimeout(t,1e3/60)}),window.cancelRequestAnimationFrame||(window.cancelRequestAnimationFrame=window[tm.VENDER_PREFIX+"CancelRequestAnimationFrame"]||window.clearTimeout))}(),function(){if(window.document){_loadCheckList=[],tm.addLoadCheckList=function(t){console.assert(void 0!==t.isLoaded,"isLoaded が定義されていません!!"),_loadCheckList.push(t)},_preloadListners=[],_mainListners=[],tm.preload=function(t){_preloadListners.push(t)},tm.main=function(t){_mainListners.push(t)};var t=function(){for(var t=0,e=_preloadListners.length;e>t;++t)_preloadListners[t]();_preloadListners=[]},e=function(){for(var t=0,e=_loadCheckList.length;e>t;++t){var i=_loadCheckList[t];if(0==i.isLoaded())return setTimeout(arguments.callee,0),void 0}for(var t=0,e=_mainListners.length;e>t;++t)_mainListners[t]();_mainListners=[]};window.addEventListener("load",function(){t(),e()},!1)}}(),function(){Object.defineProperty(Object.prototype,"defineVariable",{value:function(t,e){Object.defineProperty(this,t,{value:e,enumerable:!0,writable:!0})}}),Object.defineProperty(Object.prototype,"defineFunction",{value:function(t,e){Object.defineProperty(this,t,{value:e,enumerable:!1,writable:!0})}}),Object.prototype.defineFunction("defineInstanceVariable",function(t,e){Object.defineProperty(this.prototype,t,{value:e,enumerable:!0,writable:!0})}),Object.prototype.defineFunction("defineInstanceMethod",function(t,e){Object.defineProperty(this.prototype,t,{value:e,enumerable:!1,writable:!0})}),Object.defineInstanceMethod("setter",function(t,e){Object.defineProperty(this,t,{set:e,enumerable:!1,configurable:!0})}),Object.defineInstanceMethod("getter",function(t,e){Object.defineProperty(this,t,{get:e,enumerable:!1,configurable:!0})}),Object.defineInstanceMethod("accessor",function(t,e){Object.defineProperty(this,t,{set:e.set,get:e.get,enumerable:!1,configurable:!0})}),Object.defineInstanceMethod("$has",function(t){return this.hasOwnProperty(t)}),Object.defineInstanceMethod("$extend",function(){return Array.prototype.forEach.call(arguments,function(t){for(var e in t)this[e]=t[e]},this),this}),Object.defineInstanceMethod("$safe",function(){return Array.prototype.forEach.call(arguments,function(t){for(var e in t)this[e]||(this[e]=t[e])},this),this}),Object.defineInstanceMethod("$strict",function(){return Array.prototype.forEach.call(arguments,function(t){for(var e in t)console.assert(!this[e],"tm error: {0} is Already".format(e)),this[e]=t[e]},this),this}),Object.defineInstanceMethod("$pick",function(){var t={};return Array.prototype.forEach.call(arguments,function(e){e in this&&(t[e]=this[e])},this),t}),Object.defineInstanceMethod("$omit",function(){var t={};for(var e in this)-1==Array.prototype.indexOf.call(arguments,e)&&(t[e]=this[e]);return t}),Object.defineInstanceMethod("$using",function(){return this}),Object.defineInstanceMethod("$globalize",function(t){return t?tm.global[t]=this[t]:tm.global.$strict(this),this})}(),function(){Array.prototype.accessor("first",{get:function(){return this[0]},set:function(t){this[0]=t}}),Array.prototype.accessor("last",{get:function(){return this[this.length-1]},set:function(t){this[this.length-1]=t}}),Array.defineInstanceMethod("equals",function(t){if(this.length!==t.length)return!1;for(var e=0,i=this.length;i>e;++e)if(this[e]!==t[e])return!1;return!0}),Array.defineInstanceMethod("deepEquals",function(t){if(this.length!==t.length)return!1;for(var e=0,i=this.length;i>e;++e){var n=this[e].deepEquals?this[e].deepEquals(t[e]):this[e]===t[e];if(n===!1)return!1}return!0}),Array.defineInstanceMethod("at",function(t){return t%=this.length,t+=this.length,t%=this.length,this[t]}),Array.defineInstanceMethod("swap",function(t,e){var i=this[t];return this[t]=this[e],this[e]=i,this}),Array.defineInstanceMethod("erase",function(t){var e=this.indexOf(t);return e>=0&&this.splice(e,1),this}),Array.defineInstanceMethod("eraseAll",function(t){for(var e=0,i=this.length;i>e;++e)this[e]==t&&this.splice(e--,1);return this}),Array.defineInstanceMethod("eraseIf",function(t){for(var e=0,i=this.length;i>e;++e)if(t(this[e],e,this)){this.splice(e,1);break}return this}),Array.defineInstanceMethod("eraseIfAll",function(t){for(var e=0,i=this.length;i>e;++e)t(this[e],e,this)&&this.splice(e,1);return this}),Array.defineInstanceMethod("random",function(t,e){return t=t||0,e=e||this.length-1,this[Math.rand(t,e)]}),Array.defineInstanceMethod("pickup",function(t,e){return t=t||0,e=e||this.length-1,this[Math.rand(t,e)]}),Array.defineInstanceMethod("uniq",function(){for(var t=[],e=0,i=this.length;i>e;++e){var n=this[e];0==n in t&&t.push(n)}return t}),Array.defineInstanceMethod("flatten",function(){var t=Array.flatten(this);this.clear().concat(t);for(var e=0,i=t.length;i>e;++e)this[e]=t[e];return this}),Array.defineInstanceMethod("clone",function(t){if(1==t){for(var e=Array(this.length),i=0,n=this.length;n>i;++i)e[i]=this[i].clone?this[i].clone(t):this[i];return e}return Array.prototype.slice.apply(this)}),Array.defineInstanceMethod("clear",function(){return this.length=0,this}),Array.defineInstanceMethod("fill",function(t,e,i){e=e||0,i=i||this.length;for(var n=e;i>n;++n)this[n]=t;return this}),Array.defineInstanceMethod("range",function(t,e,i){if(1==arguments.length){this.clear();for(var n=0;t>n;++n)this[n]=n}else if(e>t){i=i||1,this.clear();for(var n=t,s=0;e>n;n+=i,++s)this[s]=n}else{i=i||-1,this.clear();for(var n=t,s=0;n>e;n+=i,++s)this[s]=n}return this}),Array.defineInstanceMethod("shuffle",function(){for(var t=0,e=this.length;e>t;++t){var i=Math.rand(0,e-1);t!=i&&this.swap(t,i)}return this}),Array.defineInstanceMethod("sum",function(){for(var t=0,e=0,i=this.length;i>e;++e)t+=this[e];return t}),Array.defineInstanceMethod("average",function(){for(var t=0,e=this.length,i=0;e>i;++i)t+=this[i];return t/e}),Array.defineInstanceMethod("each",function(){return this.forEach.apply(this,arguments),this}),Array.defineInstanceMethod("toULElement",function(){}),Array.defineInstanceMethod("toOLElement",function(){}),Array.defineFunction("uniq",function(t){for(var e=[],i=0,n=t.length;n>i;++i){var s=t[i];-1==e.indexOf(s)&&e.push(s)}return e}),Array.flatten=function(t){for(var e=[],i=0,n=t.length;n>i;++i){var s=t[i];s instanceof Array?e=e.concat(Array.flatten(s)):e.push(s)}return e},Array.defineFunction("range",function(){return Array.prototype.range.apply([],arguments)})}(),function(){var t=["January","February","March","April","May","June","July","August","September","October","November","December"],e=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];Date.prototype.format=function(i){for(var n=this.getFullYear(),s=this.getMonth(),r=this.getDate(),o=this.getDay(),a=this.getHours(),h=this.getMinutes(),u=this.getSeconds(),c="",l=0,m=i.length;m>l;++l){var d=i.charAt(l),f="";switch(d){case"d":f=r.padding(2,"0");break;case"D":f=e[o].substr(0,3);break;case"j":f=r;break;case"l":f=e[o];break;case"F":f=t[s];break;case"m":f=(s+1).padding(2,"0");break;case"M":f=t[s].substr(0,3);break;case"n":f=s+1;break;case"Y":f=n;break;case"y":f=(""+n).substr(2,2);break;case"G":f=a;break;case"H":f=a.padding(2,"0");break;case"i":f=h.padding(2,"0");break;case"s":f=u.padding(2,"0");break;default:f=d}c+=f}return c}}(),function(){Function.prototype.bind||Function.defineInstanceMethod("bind",function(t){var e=this;return function(){e.apply(t,arguments)}}),Function.defineInstanceMethod("toArrayFunction",function(){var t=this;return function(){for(var e=[],i=0,n=this.length;n>i;++i)e.push(t.apply(this[i],arguments));return e}})}(),function(){Math.clamp=function(t,e,i){return e>t?e:t>i?i:t},Math.DEG_TO_RAD=Math.PI/180,Math.RAD_TO_DEG=180/Math.PI,Math.degToRad=function(t){return t*Math.DEG_TO_RAD},Math.radToDeg=function(t){return t*Math.RAD_TO_DEG},Math.rand=function(t,e){return window.Math.floor(Math.random()*(e-t+1))+t},Math.randf=function(t,e){return window.Math.random()*(e-t)+t},Math.magnitude=function(){return Math.sqrt(Math.magnitudeSq.apply(null,arguments))},Math.magnitudeSq=function(){for(var t=0,e=0,i=arguments.length;i>e;++e)t+=arguments[e]*arguments[e];return t},Math.inside=function(t,e,i){return t>=e&&i>=t}}(),function(){Number.defineInstanceMethod("round",function(t){t=t||0;var e=Math.pow(10,t),i=this*e;return i=Math.round(i),i/e}),Number.defineInstanceMethod("ceil",function(t){t=t||0;var e=Math.pow(10,t),i=this*e;return i=Math.ceil(i),i/e}),Number.defineInstanceMethod("floor",function(t){t=t||0;var e=Math.pow(10,t),i=this*e;return i=Math.floor(i),i/e}),Number.defineInstanceMethod("toInt",function(){return 0|this}),Number.defineInstanceMethod("toHex",function(){return this.toString(16)}),Number.defineInstanceMethod("toBin",function(){return this.toString(2)}),Number.defineInstanceMethod("toUnsigned",function(){return this>>>0}),Number.defineInstanceMethod("padding",function(t,e){var i=this+"";for(t-=i.length,e=e||"0";t-->0;)i=e+i;return i})}(),function(){String.defineInstanceMethod("format",function(t){var e=void 0;if("object"==typeof t)e=function(e,i){return t[i]};else{var i=arguments;e=function(t,e){return i[parseInt(e)]}}return this.replace(/\{(\w+)\}/g,e)}),String.defineInstanceMethod("trim",function(){return this.replace(/^\s+|\s+$/g,"")}),String.defineInstanceMethod("capitalize",function(){return this.replace(/\w+/g,function(t){return t.capitalizeFirstLetter()})}),String.defineInstanceMethod("capitalizeFirstLetter",function(){return this.charAt(0).toUpperCase()+this.substr(1).toLowerCase()}),String.defineInstanceMethod("toDash",function(){return this.replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()})}),String.defineInstanceMethod("toHash",function(){return this.toCRC32()}),String.defineInstanceMethod("padding",function(t,e){var i=""+this;for(t-=i.length,e=e||" ";t-->0;)i=e+i;return i}),String.defineInstanceMethod("paddingLeft",function(t,e){var i=""+this;for(t-=i.length,e=e||" ";t-->0;)i=e+i;return i}),String.defineInstanceMethod("paddingRight",function(t,e){var i=""+this;for(t-=i.length,e=e||" ";t-->0;)i+=e;return i}),String.defineInstanceMethod("quotemeta",function(){return this.replace(/([^0-9A-Za-z_])/g,"\\$1")}),String.defineInstanceMethod("repeat",function(t){for(var e=Array(t),i=0;t>i;++i)e[i]=this;return e.join("")});var t="00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D".split(" ");String.defineInstanceMethod("toCRC32",function(){var e=0,i=0,n=0;e=-1^e;for(var s=0,r=this.length;r>s;++s)n=255&(e^this.charCodeAt(s)),i="0x"+t[n],e=e>>>8^i;return(-1^e)>>>0})}(),function(){tm.Item=tm.createClass({prev:null,next:null,data:null,init:function(){}}),tm.List=tm.createClass({init:function(){this._length=0,this._head=tm.Item(),this._tail=tm.Item(),this._head.next=this._tail,this._tail.prev=this._head},add:function(t){var e=tm.Item();return e.data=t,e.prev=this._tail.prev,e.next=this._tail,this._tail.prev.next=e,this._tail.prev=e,++this._length,this},remove:function(t){var e=this.getItem(t);return e.prev.next=e.next,e.next.prev=e.prev,--this._length,e},get:function(t){return this.getItem(t).data},getItem:function(t){for(var e=this._head.next,i=0;t>i++;)e=e.next;return e},forEach:function(){},clear:function(){},clone:function(){},getFirst:function(){},getLast:function(){},indexOf:function(){},lastIndexOf:function(){},toArray:function(){if(0>=this._length)return[];for(var t=this._head.next,e=[];null!=t.data;)e.push(t.data),t=t.next;return e},toString:function(){for(var t=this.toArray(),e=0,i=t.length;i>e;++e)t[e]=""+t[e];return t.join(",")}})}(),tm.event=tm.event||{},function(){tm.event.Event=tm.createClass({type:null,init:function(t){this.type=t}})}(),function(){tm.event.TweenEvent=tm.createClass({superClass:tm.event.Event,init:function(t,e,i){this.superInit(t),this.time=e,this.now=i}}),tm.event.TweenEvent.CHANGE="change",tm.event.TweenEvent.FINISH="finish",tm.event.TweenEvent.LOOP="loop",tm.event.TweenEvent.RESUME="resume",tm.event.TweenEvent.START="start",tm.event.TweenEvent.STOP="stop"}(),function(){tm.event.MouseEvent=tm.createClass({superClass:tm.event.Event,init:function(t,e,i){this.superInit(t),this.app=e,this.pointing=i}})}(),function(){tm.event.TouchEvent=tm.createClass({superClass:tm.event.Event,init:function(t,e,i){this.superInit(t),this.app=e,this.pointing=i}})}(),function(){tm.event.PointingEvent=tm.createClass({superClass:tm.event.Event,init:function(t,e,i){this.superInit(t),this.app=e,this.pointing=i}})}(),tm.event=tm.event||{},function(){tm.define("tm.event.EventDispatcher",{init:function(){this._listeners={}},on:function(t,e){return void 0===this._listeners[t]&&(this._listeners[t]=[]),this._listeners[t].push(e),this},off:function(t,e){var i=this._listeners[t],n=i.indexOf(e);return-1!=n&&i.splice(n,1),this},fire:function(t){t.target=this;var e="on"+t.type;this[e]&&this[e](t);var i=this._listeners[t.type];if(i)for(var n=0,s=i.length;s>n;++n)i[n].call(this,t);return this},one:function(t,e){var i=this,n=function(){var s=e.apply(i,arguments);return i.off(t,n),s};return this.on(t,n),this},hasEventListener:function(t){return void 0!==this._listeners[t]||this["on"+t]?!0:!1},clearEventListener:function(t){var e="on"+t;return this[e]&&delete this[e],this._listeners[t]=[],this}});var t=tm.event.EventDispatcher.prototype;t.addEventListener=t.on,t.removeEventListener=t.off,t.dispatchEvent=t.fire}(),tm.util=tm.util||{},function(){tm.util.Random={randint:function(t,e){return window.Math.floor(Math.random()*(e-t+1))+t},randfloat:function(t,e){return window.Math.random()*(e-t)+t},randbool:function(){return 1===this.randint(0,1)}}}(),tm.util=tm.util||{},function(){var AJAX_DEFAULT_SETTINGS={type:"GET",async:!0,data:null,contentType:"application/x-www-form-urlencoded",dataType:"text",username:null,password:null,success:function(t){alert("success!!\n"+t)},error:function(){alert("error!!")},beforeSend:null};tm.util.Ajax={load:function(t){for(var e in AJAX_DEFAULT_SETTINGS)t[e]=t[e]||AJAX_DEFAULT_SETTINGS[e];var i=new XMLHttpRequest,n=tm.util.Ajax.DATA_CONVERTE_TABLE[t.dataType];if(t.url,t.data){var s="";s="string"==typeof t.data?t.data:tm.util.QueryString.stringify(t.data),"GET"==t.type?(t.url+="?"+s,t.data=null):"POST"==t.type&&(t.data=s)}i.onreadystatechange=function(){if(4==i.readyState)if(200===i.status){var e=n(i.responseText);t.success(e)}else if(0===i.status){var e=n(i.responseText);t.success(e)}else t.error(i.responseText)},i.open(t.type,t.url,t.async,t.username,t.password),"POST"===t.type&&i.setRequestHeader("Content-Type",t.contentType),t.beforeSend&&t.beforeSend(i),i.send(t.data)},loadJSONP:function(t,e){var i=tm.global;i.tmlib_js_dummy_func_count=tm.global.tmlib_js_dummy_func||0;var n="tmlib_js_dummy_func"+i.tmlib_js_dummy_func_count++;i[n]=e;var s=document.createElement("script");s.type="text/javascript",s.charset="UTF-8",s.src=t+"&callback="+n,s.setAttribute("defer",!0),document.getElementsByTagName("head")[0].appendChild(s)}},tm.util.Ajax.DATA_CONVERTE_TABLE={undefined:function(t){return t},text:function(t){return t},xml:function(t){var e=document.createElement("div");return e.innerHTML=t,e},dom:function(t){var e=document.createElement("div");return e.innerHTML=t,tm.dom.Element(e)},json:function(t){try{return JSON.parse(t)}catch(e){console.dir(e),console.dir(t)}},script:function(data){return eval(data),data},bin:function(t){for(var e=[],i=0,n=t.length;n>i;++i)e[i]=255&t.charCodeAt(i);return e}}}(),tm.util=tm.util||{},function(){tm.define("tm.util.File",{superClass:"tm.event.EventDispatcher",data:null,loaded:!1,init:function(t){this.superInit(),this.loaded=!1,1==arguments.length&&this.load(t)},load:function(t){if("string"==typeof t){var e=t;t={url:e}}var i=this;t.success=function(t){i.setData(t);var e=tm.event.Event("load");i.dispatchEvent(e)},tm.util.Ajax.load(t)},setData:function(t){this.data=t,this.loaded=!0},loadLocalStorage:function(){}})}(),function(){tm.util.FileManager={files:{}},tm.util.FileManager.load=function(t,e){var i=tm.util.File(e);return this.files[t]=i,i},tm.util.FileManager.get=function(t){return this.files[t]},tm.util.FileManager.isLoaded=function(){for(var t in this.files){var e=this.files[t];if(0==e.loaded)return!1}return!0},tm.addLoadCheckList(tm.util.FileManager)}(),tm.util=tm.util||{},function(){tm.util.Timeline=tm.createClass({target:null,tasks:null,fps:30,init:function(){this.tasks=[],this.time=0},at:function(t,e){return this.tasks.push({time:t,action:e}),this},after:function(t,e){return this.at(this.time+t,e),this},clear:function(){return this.tasks=[],this},removeTime:function(){},removeAction:function(){},start:function(){this.isPlaying=!0,this._startTime(),this._updateTime()},resume:function(){this.isPlaying=!0,this._resumeTime(),this._updateTime()},stop:function(){this.isPlaying=!1},rewind:function(){this.time=0},update:function(){if(this.tasks.length>0)for(var t=0,e=this.tasks.length;e>t;++t){var i=this.tasks[t];this.prev<=i.time&&i.time=this.scriptList.length)return!0;for(var t in this.scriptList)if(0==this.scriptList[t].loaded)return!1;return!0},tm.addLoadCheckList(tm.util.ScriptManager)}(),tm.util=tm.util||{},function(){tm.util.QueryString={parse:function(t,e,i){e=e||"&",i=i||"=";for(var n={},s=t.split(e),r=0,o=s.length;o>r;++r){var a=s[r],h=a.indexOf(i);if(h>0){var u=a.substring(0,h),c=a.substring(h+1);n[u]=c}}return n},stringify:function(t,e,i){e=e||"&",i=i||"=";var n=[];for(var s in t){var r=encodeURIComponent(t[s]);n.push(s+i+r)}return n.join(e)}}}(),tm.namespace("tm.util.Type",function(){var t=this,e=Object.prototype.toString;this.defineFunction("isObject",function(t){return t===Object(t)}),this.defineFunction("isArray",function(t){return"[object Array]"==e.call(t)}),this.defineFunction("isArguments",function(t){return"[object Arguments]"==e.call(t)}),this.defineFunction("isFunction",function(t){return"[object Function]"==e.call(t)}),this.defineFunction("isString",function(t){return"[object String]"==e.call(t)}),this.defineFunction("isNumber",function(t){return"[object Number]"==e.call(t)}),this.defineFunction("isDate",function(t){return"[object Date]"==e.call(t)}),this.defineFunction("isRegExp",function(t){return"[object RegExp]"==e.call(t)}),this.defineFunction("isEmpty",function(e){if(!e)return!0;if(t.isArray(e)||t.isString(e)||t.isArguments(e))return 0===e.length;for(var i in e)if(i)return!1;return!0})}),tm.define("tm.util.Flow",{superClass:"tm.event.EventDispatcher",waits:0,counter:0,args:null,init:function(t,e){this.superInit(),t=t||0,e=e||null,this.setup(t,e)},setup:function(t,e){this.waits=t,this.callback=e,this.counter=0,this.args={}},pass:function(t,e){++this.counter,arguments.length>=2&&(this.args[t]=e),this._check()},isFinish:function(){return this.counter===this.waits},_check:function(){if(this.isFinish()){var t=this.args;this.callback&&(this.callback(t),this.args=null,this.callback=null);var e=tm.event.Event("flowfinish");e.args=t,this.fire(e)}}}),tm.geom=tm.geom||{},function(){tm.geom.Vector2=tm.createClass({x:0,y:0,init:function(t,e){this.set(t,e)},clone:function(){return tm.geom.Vector2(this.x,this.y)},equals:function(t){return this.x===t.x&&this.y===t.y?!0:!1},equalsNumber:function(t,e){return this.x===t&&this.y===e?!0:!1},equalsArray:function(t){return this.x===t[0]&&this.y===t[1]?!0:!1},set:function(t,e){this.x=t,this.y=e},setNumber:function(t,e){return this.x=t,this.y=e,this},setArray:function(t){return this.x=t[0],this.y=t[1],this},setObject:function(t){return this.x=t.x,this.y=t.y,this},setString:function(t){var e=t.match(/(-?\d+(\.{1}\d+)?),\s*(-?\d+(\.{1}\d+)?)/);return this.x=parseFloat(e[1]),this.y=parseFloat(e[3]),this},setSmart:function(t,e){var i=arguments[0];if(2===arguments.length)this.x=t,this.y=e;else if(i instanceof Array)this.x=i[0],this.y=i[1];else if(i instanceof Object)this.x=i.x,this.y=i.y;else if("string"==typeof i){var n=i.match(/(-?\d+(\.{1}\d+)?),\s*(-?\d+(\.{1}\d+)?)/);this.x=parseFloat(n[1]),this.y=parseFloat(n[3])}return this},setAngle:function(t,e){var i=t*Math.DEG_TO_RAD;return e=e||1,this.x=Math.cos(i)*e,this.y=Math.sin(i)*e,this},setRadian:function(t,e){return e=e||1,this.x=Math.cos(t)*e,this.y=Math.sin(t)*e,this},setDegree:function(t,e){var i=t*Math.DEG_TO_RAD;return e=e||1,this.x=Math.cos(i)*e,this.y=Math.sin(i)*e,this},setRandom:function(t,e,i){return t=t||0,e=e||360,i=i||1,this.setDegree(Math.randf(t,e),i),this},add:function(t){return this.x+=t.x,this.y+=t.y,this},sub:function(t){return this.x-=t.x,this.y-=t.y,this},mul:function(t){return this.x*=t,this.y*=t,this},div:function(t){return t=t||.01,this.x/=t,this.y/=t,this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.y},cross:function(t){return this.x*t.y-this.y*t.x},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthSquared:function(){return this.x*this.x+this.y*this.y},distance:function(t){return Math.sqrt(Math.pow(this.x-t.x,2)+Math.pow(this.y-t.y,2))},distanceSquared:function(t){return Math.pow(this.x-t.x,2)+Math.pow(this.y-t.y,2)},normalize:function(){var t=this.length();return this.div(t),this},toAngle:function(){return Math.atan2(this.y,this.x)},toStyleString:function(){return"{x:{x}, y:{y}}".format(this)},toString:function(){return"{x:{x}, y:{y}}".format(this)},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this}}),tm.geom.Vector2.min=function(t,e){return tm.geom.Vector2(t.xe.x?t.x:e.x,t.y>e.y?t.y:e.y)},tm.geom.Vector2.add=function(t,e){return tm.geom.Vector2(t.x+e.x,t.y+e.y)},tm.geom.Vector2.sub=function(t,e){return tm.geom.Vector2(t.x-e.x,t.y-e.y)},tm.geom.Vector2.mul=function(t,e){return tm.geom.Vector2(t.x*e,t.y*e)},tm.geom.Vector2.div=function(t,e){return tm.geom.Vector2(t.x/e,t.y/e)},tm.geom.Vector2.negate=function(t){return tm.geom.Vector2(-t.x,-t.y)},tm.geom.Vector2.dot=function(t,e){return t.x*e.x+t.y*e.y},tm.geom.Vector2.cross=function(t,e){return t.x*e.y-t.y*e.x},tm.geom.Vector2.distance=function(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))},tm.geom.Vector2.distanceSquared=function(t,e){return Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)},tm.geom.Vector2.manhattanDistance=function(t,e){return Math.abs(t.x-e.x)+Math.abs(t.y-e.y)},tm.geom.Vector2.reflect=function(t,e){var i=Vector2.dot(t,e),n=Vector2.mul(e,2*i);return tm.geom.Vector2.sub(t,n)},tm.geom.Vector2.lerp=function(t,e,i){return tm.geom.Vector2(t.x+(e.x-t.x)*i,t.y+(e.y-t.y)*i)},tm.geom.Vector2.slerp=function(){},tm.geom.Vector2.random=function(t,e,i){return t=t||0,e=e||360,i=i||1,tm.geom.Vector2().setDegree(Math.randf(t,e),i)},tm.geom.Vector2.ZERO=tm.geom.Vector2(0,0),tm.geom.Vector2.LEFT=tm.geom.Vector2(-1,0),tm.geom.Vector2.RIGHT=tm.geom.Vector2(1,0),tm.geom.Vector2.UP=tm.geom.Vector2(0,1),tm.geom.Vector2.DOWN=tm.geom.Vector2(0,-1)}(),tm.geom=tm.geom||{},function(){tm.geom.Vector3=tm.createClass({x:0,y:0,z:0,init:function(t,e,i){this.set(t,e,i)},set:function(t,e,i){return this.x=t,this.y=e,this.z=i,this},setNumber:function(t,e,i){return this.x=t,this.y=e,this.z=i,this},setArray:function(t){return this.x=t[0],this.y=t[1],this.z=t[2],this},setObject:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},setString:function(t){var e=t.match(/(-?\d+(\.{1}\d+)?),\s*(-?\d+(\.{1}\d+)?),\s*(-?\d+(\.{1}\d+)?)/);return this.x=parseFloat(e[1]),this.y=parseFloat(e[3]),this.z=parseFloat(e[5]),this},setAngle:function(t,e,i){return i=i||1,this.x=i*Math.cos(t)*Math.sin(e),this.y=i*Math.sin(t),this.z=i*Math.cos(t)*Math.cos(e),this},setRadian:function(t,e,i){return this.setAngle(t,e,i)},setDegree:function(t,e,i){return this.setAngle(t*Math.DEG_TO_RAD,e*Math.DEG_TO_RAD,i)},setSmart:function(t,e,i){var n=arguments[0];if(3===arguments.length)this.x=t,this.y=e,this.z=i;else if(n instanceof Array)this.x=n[0],this.y=n[1],this.z=n[2]; else if(n instanceof Object)this.x=n.x,this.y=n.y,this.z=n.z;else if("string"==typeof n){var s=n.match(/(-?\d+(\.{1}\d+)?),\s*(-?\d+(\.{1}\d+)?),\s*(-?\d+(\.{1}\d+)?)/);this.x=parseFloat(s[1]),this.y=parseFloat(s[3]),this.z=parseFloat(s[5])}return this},add:function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},sub:function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this},mul:function(t){return this.x*=t,this.y*=t,this.z*=t,this},div:function(t){return console.assert(0!=t,"0 division!!"),this.x/=t,this.y/=t,this.z/=t,this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},cross:function(t){var e=this.y*t.z-this.z*t.y,i=this.z*t.x-this.x*t.z,n=this.x*t.y-this.y*t.x;return this.set(e,i,n),this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSquared:function(){return this.x*this.x+this.y*this.y+this.z*this.z},normalize:function(){var t=this.length();return this.div(t),this},toVector2:function(){},toAngleXY:function(){return Math.atan2(this.y,this.x)},to3D:function(){},equals:function(t,e,i){return this.x===t&&this.y===e&&this.z===i},equalsArray:function(t){return this.equals(t[0],t[1],t[2])},equalsObject:function(t){return this.equals(t.x,t.y,t.z)},equalsSmart:function(){},toStyleString:function(){return"{x:{x}, y:{y}, z:{z}}".format(this)},toString:function(){return"{x:{x}, y:{y}, z:{z}}".format(this)},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this}}),tm.geom.Vector3.min=function(t,e){return Vector3(t.xe.x?t.x:e.x,t.y>e.y?t.y:e.y,t.z>e.z?t.z:e.z)},tm.geom.Vector3.add=function(t,e){return tm.geom.Vector3(t.x+e.x,t.y+e.y,t.z+e.z)},tm.geom.Vector3.sub=function(t,e){return tm.geom.Vector3(t.x-e.x,t.y-e.y,t.z-e.z)},tm.geom.Vector3.mul=function(t,e){return tm.geom.Vector3(t.x*e,t.y*e,t.z*e)},tm.geom.Vector3.div=function(t,e){return tm.geom.Vector3(t.x/e,t.y/e,t.z/e)},tm.geom.Vector3.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z},tm.geom.Vector3.cross=function(t,e){return tm.geom.Vector3(t.y*e.z-t.z*e.y,t.z*e.x-t.x*e.z,t.x*e.y-t.y*e.x)},tm.geom.Vector3.negate=function(t){return tm.geom.Vector3(-t.x,-t.y,-t.z)},tm.geom.Vector3.distance=function(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)+Math.pow(t.z-e.z,2))},tm.geom.Vector3.distanceSquared=function(t,e){return Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)+Math.pow(t.z-e.z,2)},tm.geom.Vector3.manhattanDistance=function(t,e){return Math.abs(t.x-e.x)+Math.abs(t.y-e.y)+Math.abs(t.z-e.z)},tm.geom.Vector3.reflect=function(t,e){var i=Vector3.dot(t,e),n=Vector3.mul(e,2*i);return Vector3.sub(t,n)},tm.geom.Vector3.lerp=function(t,e,i){return tm.geom.Vector3(t.x+(e.x-t.x)*i,t.y+(e.y-t.y)*i,t.z+(e.z-t.z)*i)},tm.geom.Vector3.slerp=function(){},tm.geom.Vector3.random=function(t,e,i,n,s){return t=t||0,e=e||360,i=i||0,n=n||360,s=s||1,TM.Geom.Vector3().setFromDegree(TM.randomf(t,e),TM.randomf(i,n),s)},tm.geom.Vector3.ZERO=tm.geom.Vector3(0,0,0),tm.geom.Vector3.LEFT=tm.geom.Vector3(-1,0,0),tm.geom.Vector3.RIGHT=tm.geom.Vector3(1,0,0),tm.geom.Vector3.UP=tm.geom.Vector3(0,1,0),tm.geom.Vector3.DOWN=tm.geom.Vector3(0,-1,0),tm.geom.Vector3.FORWARD=tm.geom.Vector3(0,0,-1),tm.geom.Vector3.BACKWARD=tm.geom.Vector3(0,0,1)}(),tm.geom=tm.geom||{},function(){tm.define("tm.geom.Matrix33",{m:null,init:function(){this.m=[],arguments.length>=9?this.set.apply(this,arguments):this.identity()},clone:function(){var t=this.m;return tm.geom.Matrix33(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8])},set:function(t,e,i,n,s,r,o,a,h){return console.assert(arguments.length>=9,""),this.m00=t,this.m01=e,this.m02=i,this.m10=n,this.m11=s,this.m12=r,this.m20=o,this.m21=a,this.m22=h,this},setArray:function(t){return this.set(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8]),this},setObject:function(t){return this.set(t.m00,t.m01,t.m02,t.m10,t.m11,t.m12,t.m20,t.m21,t.m22),this},identity:function(){var t=this.m;return t[0]=1,t[3]=0,t[6]=0,t[1]=0,t[4]=1,t[7]=0,t[2]=0,t[5]=0,t[8]=1,this},transpose:function(){return this.m.swap(1,3),this.m.swap(2,6),this.m.swap(5,7),this},invert:function(){var t=this.m,e=t[0],i=t[3],n=t[6],s=t[1],r=t[4],o=t[7],a=t[2],h=t[5],u=t[8],c=this.determinant();return this.m00=(r*u-o*h)/c,this.m01=-1*((s*u-o*a)/c),this.m02=(s*h-r*a)/c,this.m10=-1*((i*u-n*h)/c),this.m11=(e*u-n*a)/c,this.m12=-1*((e*h-i*a)/c),this.m20=(i*o-n*r)/c,this.m21=-1*((e*o-n*s)/c),this.m22=(e*r-i*s)/c,this.transpose(),this},determinant:function(){var t=this.m,e=t[0],i=t[3],n=t[6],s=t[1],r=t[4],o=t[7],a=t[2],h=t[5],u=t[8];return e*r*u+s*h*n+i*o*a-n*r*a-i*s*u-o*h*e},zero:function(){return this.set(0,0,0,0,0,0,0,0,0),this},translate:function(t,e){var i=this.m;return i[6]=i[0]*t+i[3]*e+i[6],i[7]=i[1]*t+i[4]*e+i[7],i[8]=i[2]*t+i[5]*e+i[8],this},rotateX:function(t){return this.multiply(tm.geom.Matrix33.rotateX(t))},rotateY:function(t){return this.multiply(tm.geom.Matrix33.rotateY(t))},rotateZ:function(t){Math.sin(t),Math.cos(t);var e=this.m;return e[0],e[1],e[2],e[3],e[4],e[5],this.multiply(tm.geom.Matrix33.rotateZ(t))},scale:function(t,e){var i=this.m;return i[0]*=t,i[3]*=e,i[1]*=t,i[4]*=e,i[2]*=t,i[5]*=e,this},multiply:function(t){var e=this.m,i=t.m,n=e[0],s=e[3],r=e[6],o=e[1],a=e[4],h=e[7],u=e[2],c=e[5],l=e[8],m=i[0],d=i[3],f=i[6],p=i[1],g=i[4],y=i[7],v=i[2],x=i[5],b=i[8];return e[0]=n*m+s*p+r*v,e[3]=n*d+s*g+r*x,e[6]=n*f+s*y+r*b,e[1]=o*m+a*p+h*v,e[4]=o*d+a*g+h*x,e[7]=o*f+a*y+h*b,e[2]=u*m+c*p+l*v,e[5]=u*d+c*g+l*x,e[8]=u*f+c*y+l*b,this},multiplyVector2:function(t){var e=this.m00*t.x+this.m01*t.y+this.m02,i=this.m10*t.x+this.m11*t.y+this.m12;return tm.geom.Vector2(e,i)},multiplyVector3:function(t){var e=this.m00*t.x+this.m01*t.y+this.m02*t.z,i=this.m10*t.x+this.m11*t.y+this.m12*t.z,n=this.m20*t.x+this.m21*t.y+this.m22*t.z;return tm.geom.Vector3(e,i,n)},toArray:function(){return this.m.slice()},toString:function(){return"|{m00}, {m01}, {m02}|\n|{m10}, {m11}, {m12}|\n|{m20}, {m21}, {m22}|".format(this)}}),tm.geom.Matrix33.prototype.accessor("m00",{get:function(){return this.m[0]},set:function(t){this.m[0]=t}}),tm.geom.Matrix33.prototype.accessor("m10",{get:function(){return this.m[1]},set:function(t){this.m[1]=t}}),tm.geom.Matrix33.prototype.accessor("m20",{get:function(){return this.m[2]},set:function(t){this.m[2]=t}}),tm.geom.Matrix33.prototype.accessor("m01",{get:function(){return this.m[3]},set:function(t){this.m[3]=t}}),tm.geom.Matrix33.prototype.accessor("m11",{get:function(){return this.m[4]},set:function(t){this.m[4]=t}}),tm.geom.Matrix33.prototype.accessor("m21",{get:function(){return this.m[5]},set:function(t){this.m[5]=t}}),tm.geom.Matrix33.prototype.accessor("m02",{get:function(){return this.m[6]},set:function(t){this.m[6]=t}}),tm.geom.Matrix33.prototype.accessor("m12",{get:function(){return this.m[7]},set:function(t){this.m[7]=t}}),tm.geom.Matrix33.prototype.accessor("m22",{get:function(){return this.m[8]},set:function(t){this.m[8]=t}}),tm.geom.Matrix33.prototype.accessor("a",{get:function(){return this.m[0]},set:function(t){this.m[0]=t}}),tm.geom.Matrix33.prototype.accessor("b",{get:function(){return this.m[3]},set:function(t){this.m[3]=t}}),tm.geom.Matrix33.prototype.accessor("c",{get:function(){return this.m[1]},set:function(t){this.m[1]=t}}),tm.geom.Matrix33.prototype.accessor("d",{get:function(){return this.m[4]},set:function(t){this.m[4]=t}}),tm.geom.Matrix33.prototype.accessor("tx",{get:function(){return this.m[6]},set:function(t){this.m[6]=t}}),tm.geom.Matrix33.prototype.accessor("ty",{get:function(){return this.m[7]},set:function(t){this.m[7]=t}}),tm.geom.Matrix33.translate=function(t,e){return tm.geom.Matrix33(1,0,t,0,1,e,0,0,1)},tm.geom.Matrix33.rotateX=function(t){var e=Math.cos(t),i=Math.sin(t);return tm.geom.Matrix33(1,0,0,0,e,-i,0,i,e)},tm.geom.Matrix33.rotateY=function(t){var e=Math.cos(t),i=Math.sin(t);return tm.geom.Matrix33(e,0,i,0,1,0,-i,0,e)},tm.geom.Matrix33.rotateZ=function(t){var e=Math.cos(t),i=Math.sin(t);return tm.geom.Matrix33(e,-i,0,i,e,0,0,0,1)},tm.geom.Matrix33.scale=function(t,e){var i=tm.geom.Matrix33();return void 0==e&&(e=t),i.set(t,0,0,0,e,0,0,0,1),i}}(),tm.geom=tm.geom||{},function(){tm.geom.Matrix44=tm.createClass({m:null,init:function(){this.m=[],arguments.length>=16?this.set.apply(this,arguments):this.identity()},set:function(t,e,i,n,s,r,o,a,h,u,c,l,m,d,f,p){return console.assert(arguments.length>=16,""),this.m00=t,this.m01=e,this.m02=i,this.m03=n,this.m10=s,this.m11=r,this.m12=o,this.m13=a,this.m20=h,this.m21=u,this.m22=c,this.m23=l,this.m30=m,this.m31=d,this.m32=f,this.m33=p,this},setArray:function(t){return this.set(t[0],t[4],t[8],t[12],t[1],t[5],t[9],t[13],t[2],t[6],t[10],t[14],t[3],t[7],t[11],t[15]),this},setObject:function(t){return this.set(t.m00,t.m01,t.m02,t.m03,t.m10,t.m11,t.m12,t.m13,t.m20,t.m21,t.m22,t.m23,t.m30,t.m31,t.m32,t.m33),this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},transpose:function(){return this.m.swap(1,4),this.m.swap(2,8),this.m.swap(3,12),this.m.swap(6,9),this.m.swap(7,13),this.m.swap(11,14),this},translate:function(t,e,i){return this.multiply(tm.geom.Matrix44.translate(t,e,i))},rotate:function(){console.error("Unimplemented")},rotateX:function(t){return this.multiply(tm.geom.Matrix44.rotateX(t))},rotateY:function(t){return this.multiply(tm.geom.Matrix44.rotateY(t))},rotateZ:function(t){return this.multiply(tm.geom.Matrix44.rotateZ(t))},scale:function(t,e,i){return this.multiply(tm.geom.Matrix44.scale(t,e,i))},zero:function(){return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),this},multiply:function(t){var e=this.m00*t.m00+this.m01*t.m10+this.m02*t.m20+this.m03*t.m30,i=this.m00*t.m01+this.m01*t.m11+this.m02*t.m21+this.m03*t.m31,n=this.m00*t.m02+this.m01*t.m12+this.m02*t.m22+this.m03*t.m32,s=this.m00*t.m03+this.m01*t.m13+this.m02*t.m23+this.m03*t.m33,r=this.m10*t.m00+this.m11*t.m10+this.m12*t.m20+this.m13*t.m30,o=this.m10*t.m01+this.m11*t.m11+this.m12*t.m21+this.m13*t.m31,a=this.m10*t.m02+this.m11*t.m12+this.m12*t.m22+this.m13*t.m32,h=this.m10*t.m03+this.m11*t.m13+this.m12*t.m23+this.m13*t.m33,u=this.m20*t.m00+this.m21*t.m10+this.m22*t.m20+this.m23*t.m30,c=this.m20*t.m01+this.m21*t.m11+this.m22*t.m21+this.m23*t.m31,l=this.m20*t.m02+this.m21*t.m12+this.m22*t.m22+this.m23*t.m32,m=this.m20*t.m03+this.m21*t.m13+this.m22*t.m23+this.m23*t.m33,d=this.m30*t.m00+this.m31*t.m10+this.m32*t.m20+this.m33*t.m30,f=this.m30*t.m01+this.m31*t.m11+this.m32*t.m21+this.m33*t.m31,p=this.m30*t.m02+this.m31*t.m12+this.m32*t.m22+this.m33*t.m32,g=this.m30*t.m03+this.m31*t.m13+this.m32*t.m23+this.m33*t.m33;return this.set(e,i,n,s,r,o,a,h,u,c,l,m,d,f,p,g)},getAxisX:function(){return TM.Geom.Vector3(this.m00,this.m01,this.m02)},getAxisY:function(){return TM.Geom.Vector3(this.m10,this.m11,this.m12)},getAxisZ:function(){return TM.Geom.Vector3(this.m20,this.m21,this.m22)},setAxisX:function(t){this.m00=t.x,this.m01=t.y,this.m02=t.z},setAxisY:function(t){this.m10=t.x,this.m11=t.y,this.m12=t.z},setAxisZ:function(t){this.m20=t.x,this.m21=t.y,this.m22=t.z},toMatrix33:function(){},toArray:function(){return this.m.slice()},toString:function(){return"|{m00}, {m01}, {m02}, {m03}|\n|{m10}, {m11}, {m12}, {m13}|\n|{m20}, {m21}, {m22}, {m23}|\n|{m30}, {m31}, {m32}, {m33}|".format(this)}}),tm.geom.Matrix44.prototype.accessor("m00",{get:function(){return this.m[0]},set:function(t){this.m[0]=t}}),tm.geom.Matrix44.prototype.accessor("m10",{get:function(){return this.m[1]},set:function(t){this.m[1]=t}}),tm.geom.Matrix44.prototype.accessor("m20",{get:function(){return this.m[2]},set:function(t){this.m[2]=t}}),tm.geom.Matrix44.prototype.accessor("m30",{get:function(){return this.m[3]},set:function(t){this.m[3]=t}}),tm.geom.Matrix44.prototype.accessor("m01",{get:function(){return this.m[4]},set:function(t){this.m[4]=t}}),tm.geom.Matrix44.prototype.accessor("m11",{get:function(){return this.m[5]},set:function(t){this.m[5]=t}}),tm.geom.Matrix44.prototype.accessor("m21",{get:function(){return this.m[6]},set:function(t){this.m[6]=t}}),tm.geom.Matrix44.prototype.accessor("m31",{get:function(){return this.m[7]},set:function(t){this.m[7]=t}}),tm.geom.Matrix44.prototype.accessor("m02",{get:function(){return this.m[8]},set:function(t){this.m[8]=t}}),tm.geom.Matrix44.prototype.accessor("m12",{get:function(){return this.m[9]},set:function(t){this.m[9]=t}}),tm.geom.Matrix44.prototype.accessor("m22",{get:function(){return this.m[10]},set:function(t){this.m[10]=t}}),tm.geom.Matrix44.prototype.accessor("m32",{get:function(){return this.m[11]},set:function(t){this.m[11]=t}}),tm.geom.Matrix44.prototype.accessor("m03",{get:function(){return this.m[12]},set:function(t){this.m[12]=t}}),tm.geom.Matrix44.prototype.accessor("m13",{get:function(){return this.m[13]},set:function(t){this.m[13]=t}}),tm.geom.Matrix44.prototype.accessor("m23",{get:function(){return this.m[14]},set:function(t){this.m[14]=t}}),tm.geom.Matrix44.prototype.accessor("m33",{get:function(){return this.m[15]},set:function(t){this.m[15]=t}}),tm.geom.Matrix44.translate=function(t,e,i){return tm.geom.Matrix44(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1)},tm.geom.Matrix44.rotateX=function(t){var e=Math.cos(t),i=Math.sin(t);return tm.geom.Matrix44(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1)},tm.geom.Matrix44.rotateY=function(t){var e=Math.cos(t),i=Math.sin(t);return tm.geom.Matrix44(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1)},tm.geom.Matrix44.rotateZ=function(t){var e=Math.cos(t),i=Math.sin(t);return tm.geom.Matrix44(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1)},tm.geom.Matrix44.scale=function(t,e,i){var n=tm.geom.Matrix44();return void 0==e&&(e=t),void 0==i&&(i=t),n.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),n},tm.geom.Matrix44.perspective=function(t,e,i,n){var s=1/Math.tan(.5*t*Math.PI/180),r=s/e;return tm.geom.Matrix44(r,0,0,0,0,s,0,0,0,0,n/(n-i),i*n/(i-n),0,0,1,0)},tm.geom.Matrix44.ortho=function(t,e,i,n,s,r){var o=e-t,a=n-i,h=r-s;return tm.geom.Matrix44(2/o,0,0,0,0,2/a,0,0,0,0,-2/h,0,-(t+e)/o,-(n+i)/a,-(r+s)/h,1).transpose()},tm.geom.Matrix44.lookAt=function(t,e,i){var n=tm.geom.Vector3.sub(t,e).normalize(),s=tm.geom.Vector3.cross(i,n).normalize(),r=tm.geom.Vector3.cross(n,s).normalize(),o=tm.geom.Matrix44(s.x,r.x,n.x,0,s.y,r.y,n.y,0,s.z,r.z,n.z,0,0,0,0,1),a=tm.geom.Matrix44(1,0,0,0,0,1,0,0,0,0,1,0,-t.x,-t.y,-t.z,1);return a.multiply(o)}}(),tm.geom=tm.geom||{},function(){tm.geom.Rect=tm.createClass({x:0,y:0,width:0,height:0,init:function(t,e,i,n){this.set(t,e,i,n)},set:function(t,e,i,n){return this.x=t,this.y=e,this.width=i,this.height=n,this},move:function(t,e){return this.x=t,this.y=e,this},moveBy:function(t,e){return this.x+=t,this.y+=e,this},resize:function(t,e){return this.width=t,this.height=e,this},resizeBy:function(t,e){return this.width+=t,this.height+=e,this},padding:function(t,e,i,n){switch(arguments.length){case 1:t=e=i=n=arguments[0];break;case 2:t=i=arguments[0],e=n=arguments[1];break;case 3:t=arguments[0],e=n=arguments[1],i=arguments[2]}return this.x+=n,this.y+=t,this.width-=n+e,this.height-=t+i,this},clone:function(){return tm.geom.Rect(this.x,this.y,this.width,this.height)},toCircle:function(){return tm.geom.Circle(this.centerX,this.centerY,(this.width=i},tm.collision.testRectRect=function(t,e){return t.lefte.left&&t.tope.top}}(),tm.dom=tm.dom||{},function(){tm.dom.Element=tm.createClass({element:null,init:function(){this.set.apply(this,arguments)},set:function(t){this.element="string"==typeof t?document.querySelector(t):void 0!=t?t:document},append:function(t){return this.element.appendChild(t.element),this},prepend:function(t){return this.element.insertBefore(t.element,this.element.firstChild),this},after:function(t){return this.element.parentNode.insertBefore(t.element,this.element.nextSibling),this},before:function(t){return this.element.parentNode.insertBefore(t.element,this.element),this},appendTo:function(t){return t.append(this),this},prependTo:function(t){return t.prepend(this),this},clone:function(){return tm.dom.Element(this.element.cloneNode(!0))},remove:function(){return this.element.parentNode.removeChild(this.element),this},create:function(t,e){var i=tm.dom.Element(document.createElement(t));return e||(e="append"),this[e](i),i},query:function(t,e){var i=e?this.element.querySelectorAll(t)[e]:this.element.querySelector(t);return tm.dom.Element(i)},queryAll:function(t){var e=this.element.querySelectorAll(t);return tm.dom.ElementList(e)},fixed:function(t,e,i,n){return this.style.set("position","fixed"),t&&(this.x=t),e&&(this.y=e),i&&(this.width=i),n&&(this.height=n),this},absolute:function(t,e,i,n){return this.style.set("position","absolute"),t&&(this.x=t),e&&(this.y=e),i&&(this.width=i),n&&(this.height=n),this},fullScreen:function(){this.element.webkitRequestFullScreen()},show:function(){this.visible=!0},hide:function(){this.visible=!1},toString:function(){return"tm.dom.element"},getElement:function(){return this.element}}),tm.dom.Element.prototype.accessor("html",{get:function(){return this.element.innerHTML},set:function(t){this.element.innerHTML=t}}),tm.dom.Element.prototype.accessor("value",{get:function(){return this.element.value},set:function(t){this.element.value=t}}),tm.dom.Element.prototype.accessor("x",{get:function(){return Number(this.element.style.left.replace("px",""))},set:function(t){this.element.style.left=t+"px"}}),tm.dom.Element.prototype.accessor("y",{get:function(){return Number(this.element.style.top.replace("px",""))},set:function(t){this.element.style.top=t+"px"}}),tm.dom.Element.prototype.accessor("width",{get:function(){return Number(this.element.style.width.replace("px",""))},set:function(t){this.element.style.width=t+"px"}}),tm.dom.Element.prototype.accessor("height",{get:function(){return Number(this.element.style.height.replace("px",""))},set:function(t){this.element.style.height=t+"px"}}),tm.dom.Element.prototype.accessor("color",{get:function(){return this.element.style.color},set:function(t){this.element.style.color=t}}),tm.dom.Element.prototype.accessor("backgroundColor",{get:function(){return this.element.style.backgroundColor},set:function(t){this.element.style.backgroundColor=t}}),tm.dom.Element.prototype.accessor("visible",{get:function(){return"hidden"!=this.element.style.visibility},set:function(t){this.element.style.visibility=1==t?"visible":"hidden"}}),tm.dom.Element.prototype.accessor("text",{get:function(){return this.element.innerText||this.element.textContent},set:function(t){this.element.innerText?this.element.innerText=t:this.element.textContent=t}}),tm.dom.Element.prototype.getter("classList",function(){return this.element.classList}),tm.dom.Element.prototype.getter("parent",function(){return void 0!=this.element.parentNode?tm.dom.Element(this.element.parentNode):null}),tm.dom.Element.prototype.getter("prev",function(){return void 0!=this.element.previousSibling?tm.dom.Element(this.element.previousSibling):null}),tm.dom.Element.prototype.getter("next",function(){return void 0!=this.element.nextSibling?tm.dom.Element(this.element.nextSibling):null}),tm.dom.Element.prototype.getter("children",function(){return tm.dom.ElementList(this.element.children)})}(),function(){tm.dom.ElementList=tm.createClass({superClass:Array,init:function(t){if("string"==typeof arguments[0]){var e=arguments[0];t=document.querySelectorAll(e)}else if(void 0==t)return;for(var i=0,n=t.length;n>i;++i)this.push(tm.dom.Element(t[i]))},toString:function(){return""}})}(),tm.dom=tm.dom||{},function(){Event.prototype.stopPropagation||(Event.prototype.stopPropagation=function(){this.cancelBubble=!0}),Event.prototype.preventDefault||(Event.prototype.preventDefault=function(){this.returnValue=!1}),Event.prototype.stop=function(){this.preventDefault(),this.stopPropagation()}}(),function(){KeyboardEvent.prototype.getter("character",function(){return String.fromCharCode(this.keyCode)})}(),function(){MouseEvent.prototype.getter("pointX",function(){return this.clientX-this.target.getBoundingClientRect().left}),MouseEvent.prototype.getter("pointY",function(){return this.clientY-this.target.getBoundingClientRect().top})}(),function(){void 0!==window.TouchEvent&&(TouchEvent.prototype.getter("pointX",function(){return this.touches[0].clientX-this.target.getBoundingClientRect().left}),TouchEvent.prototype.getter("pointY",function(){return this.touches[0].clientY-this.target.getBoundingClientRect().top}))}(),function(){tm.dom.Event=tm.createClass({element:null,funcList:null,funcIndex:0,init:function(t){this.element=t,this.domElement=t.element,this.funcList={}},add:function(t,e,i){var n=this.element,s=function(t){var i=e.apply(n,arguments);return i===!1&&(t.preventDefault(),t.returnValue=!1,t.stopPropagation()),i};return this._funcIndex=this._funcIndex||0,i=i||this._funcIndex++,this.funcList[t]=this.funcList[t]||{},this.funcList[t][i]=s,e._id=i,this.domElement.addEventListener(t,s,!1),this},remove:function(t,e){var i="function"==typeof e?e._id:e,n=this.getFunc(t,i);this.domElement.removeEventListener(t,n,!1),delete this.funcList[t][i]},click:function(t,e){return this.add("click",t,e),this},mdlclick:function(t,e){var i=function(e){1==e.button&&t(e)};this.add("click",i,e)},pointstart:function(t,e){this.add(tm.dom.Event.POINT_START,t,e)},pointmove:function(t,e){this.add(tm.dom.Event.POINT_MOVE,t,e)},pointend:function(t,e){this.add(tm.dom.Event.POINT_END,t,e)},hover:function(t,e){return this.add("mouseover",t,e),this},one:function(t,e,i){var n=this,s=this.element,r=function(){var i=e.apply(s,arguments);return n.remove(t,r),i};return this.add(t,r,i),this},toggle:function(t,e){for(var i=this,n=this.element,s=[],r=0;e.length>r;++r){var o=function(r){return function(){var o=e[r].apply(n,arguments);if(o!==!1){var a=(r+1)%e.length;i.one(t,s[a])}}}(r);s.push(o)}return this.one(t,s[0]),this},getFunc:function(t,e){return this.funcList[t][e]}}),tm.dom.Event.POINT_START=tm.isMobile?"touchstart":"mousedown",tm.dom.Event.POINT_MOVE=tm.isMobile?"touchmove":"mousemove",tm.dom.Event.POINT_END=tm.isMobile?"touchend":"mouseup",tm.dom.Element.prototype.getter("event",function(){return this._event||(this._event=tm.dom.Event(this))})}(),tm.dom=tm.dom||{},function(){tm.dom.Attr=tm.createClass({element:null,init:function(t){this.element=t},set:function(t,e){return this.element.setAttribute(t,e),this},add:function(t,e){var i=this.get(t);return e=i?i+" "+e:e,this.element.setAttribute(t,e),this},remove:function(t,e){if(e){var i=this.get(t),n=i?i.replace(e,"").replace(" "," "):"";this.element.setAttribute(t,n.trim())}else this.element.removeAttribute(t);return this},get:function(t){return this.element.getAttribute(t)},contains:function(t,e){var i=this.get(t);return 1==arguments.length?null!=i:2==arguments.length?(" "+i+" ").indexOf(" "+e+" ")>-1:!1},toggle:function(t,e){return this.contains(t,e)?this.remove(t,e):this.add(t,e),this}}),tm.dom.Element.prototype.getter("attr",function(){return this._attr||(this._attr=tm.dom.Attr(this.element))})}(),tm.dom=tm.dom||{},function(){tm.dom.Style=tm.createClass({element:null,init:function(t){this.element=t},set:function(t,e){return this.element.style[t]=e,this},remove:function(t){return this.element.style.removeProperty(t),this},clear:function(){return this},get:function(t){return this.element.style[t]},getPropValue:function(t){return document.defaultView.getComputedStyle(this.element,"").getPropertyValue(t)}}),tm.dom.Element.prototype.getter("style",function(){return this._style||(this._style=tm.dom.Style(this.element))})}(),tm.dom=tm.dom||{},function(){var t=tm.VENDER_PREFIX,e=t+"Animation",i=t+"AnimationEnd",n=t+"AnimationPlayState",s=t+"AnimationName",r=t+"AnimationDuration",o=t+"AnimationTimingFunction",a=t+"AnimationDelay",h=t+"AnimationIterationCount";tm.dom.Anim=tm.createClass({init:function(t){this.element=t;var e=this;this.element.addEventListener(i,function(){e.stop()},!1)},start:function(){return this.element.style[n]="running",this},stop:function(){return this.element.style[n]="paused",this},setProperty:function(t){if("string"==typeof t)this.element.style[e]=t;else for(var i in t){var n=u[i],s=t[i];n.call(this,s)}return this},setName:function(t){return this.element.style[s]=t,this},setDuration:function(t){return this.element.style[r]=t,this},setTimingFunction:function(t){return this.element.style[o]=t,this},setIterationCount:function(t){return this.element.style[h]=t,this},setDelay:function(t){return this.element.style[a]=t,this},setDirection:function(t){return this.element.style[r]=t,this}});var u={name:tm.dom.Anim.prototype.setName,duration:tm.dom.Anim.prototype.setDuration,timingFunction:tm.dom.Anim.prototype.setTimingFunction,iterationCount:tm.dom.Anim.prototype.setIterationCount,delay:tm.dom.Anim.prototype.setDelay,Name:tm.dom.Anim.prototype.setName,Duration:tm.dom.Anim.prototype.setDuration,TimingFunction:tm.dom.Anim.prototype.setTimingFunction,IterationCount:tm.dom.Anim.prototype.setIterationCount,Delay:tm.dom.Anim.prototype.setDelay};tm.dom.Element.prototype.getter("anim",function(){return this._anim||(this._anim=tm.dom.Anim(this.element))})}(),function(){tm.dom.Trans=tm.createClass({element:null,init:function(t){this.element=t},to:function(t,e){return this.set(t).duration(e||1e3),this},set:function(t){var i=this.element.style,n=[];for(var s in t){var r=e(s);n.push(r.toDash()),i[r]=t[s]+""}return i[tm.dom.Trans.PROPERTY]=n.join(", "),this},duration:function(t){var e=this.element.style;return"number"==typeof t&&(t+="ms"),e[tm.dom.Trans.DURATION]=t,this},easing:function(){var t=this.element.style;return t[tm.dom.Trans.TIMING_FUNCTION]=func,this},end:function(t){var e=tm.dom.Element(this.element);return e.event.add(tm.dom.Trans.END_EVENT,t),this},reset:function(){var t=this.element.style;return t[tm.dom.Trans.PROPERTY]="none",this},translate:function(t,e,i){return this.to({transform:"translate({0}px,{1}px)".format(t,e)},i),this},translate3d:function(t,e,i,n){return this.to({transform:"translate3d({0}px,{1}px,{2}px)".format(t,e,i)},n),this},rotate:function(t,e){return this.to({transform:"rotate({0}deg)".format(t)},e),this},rotate3d:function(t,e,i,n,s){return this.to({transform:"rotate3d({0},{1},{2},{3}deg)".format(t,e,i,n)},s),this},scale:function(t,e,i){return this.to({transform:"scale({0},{1})".format(t,e)},i),this},transform:function(){},setProp:function(t){var i=this.element.style,n=[];for(var s in t){var r=e(s);n.push(r.toDash()),i[r]=t[s]}return i[tm.dom.Trans.PROPERTY]=n.join(", "),this},setDuration:function(t){var e=this.element.style;return e[tm.dom.Trans.DURATION]=t,this},setTimingFunction:function(t){var e=this.element.style;return e[tm.dom.Trans.TIMING_FUNCTION]=t,this},resetProp:function(){var t=this.element.style;return t[tm.dom.Trans.PROPERTY]="none",this},setEndFunction:function(t){var e=tm.dom.Element(this.element);return e.event.add(tm.dom.Trans.END_EVENT,t),this}}),tm.dom.Trans.PROPERTY=tm.VENDER_PREFIX+"TransitionProperty",tm.dom.Trans.DURATION=tm.VENDER_PREFIX+"TransitionDuration",tm.dom.Trans.TIMING_FUNCTION=tm.VENDER_PREFIX+"TransitionTimingFunction",tm.dom.Trans.DELAY=tm.VENDER_PREFIX+"TransitionDelay",tm.dom.Trans.END_EVENT=function(){return{webkit:"webkitTransitionEnd",moz:"transitionend",o:"oTransitionEnd"}[tm.VENDER_PREFIX]}(),tm.dom.Element.prototype.getter("trans",function(){return this._trans||(this._trans=tm.dom.Trans(this.element))});var t={transform:!0},e=function(e){return t[e]===!0?"-"+tm.VENDER_PREFIX+e.capitalizeFirstLetter():e}}(),function(){tm.define("tm.dom.Data",{element:null,init:function(t){this.element=t},set:function(t,e){var i="data-"+t.toDash();return this.element.setAttribute(i,e),this},get:function(t){var e="data-"+t.toDash();return this.element.attributes[e].value}}),tm.dom.Element.prototype.getter("data",function(){return this._data||(this._data=tm.dom.Data(this.element))})}(),function(){tm.asset=tm.asset||{},tm.asset.Manager={assets:{},get:function(t){return this.assets[t]},set:function(t,e){return this.assets[t]=e,this},contains:function(t){return this.assets[t]?!0:!1}}}(),function(){tm.define("tm.asset.Loader",{superClass:"tm.event.EventDispatcher",init:function(){this.superInit(),this.assets={}},contains:function(t){return this.assets[t]?!0:!1},load:function(t){return tm.util.Type.isObject(t)?this._loadByObject(t):this._loadString(arguments[0],arguments[1],arguments[2]),this},get:function(t){return this.assets[t]},set:function(t,e){return this.assets[t]=e,tm.asset.Manager.set(t,e),this},_load:function(t,e,i){e=e||t,i=i||e.split(".").last;var n=tm.asset.Loader._funcs[i](e);return this.set(t,n),n},_loadString:function(t,e,i){var n={};n[t]={url:e,type:i},this._loadByObject(n)},_loadByObject:function(t){var e=tm.util.Flow(Object.keys(t).length,function(){var t=tm.event.Event("load");this.dispatchEvent(t)}.bind(this)),i=function(t){e.pass();var i=tm.event.Event("progress");i.asset=t,i.progress=e.counter/e.waits,this.dispatchEvent(i)}.bind(this);Object.keys(t).each(function(e){var n=t[e],s=null;s="string"==typeof n?this._load(e,n):this._load(e,n.url||n.src||n.path,n.type),s.loaded?i(s):s.on("load",function(){i(s)})}.bind(this))}}),tm.asset.Loader._funcs=[],tm.asset.Loader.defineFunction("register",function(t,e){this._funcs[t]=e});var t=function(t){var e=tm.asset.Texture(t);return e},e=function(t){var e=tm.sound.WebAudio(t);return e},i=function(t){var e=tm.asset.MapSheet(t);return e},n=function(t){var e=tm.asset.SpriteSheet(t);return e},s=function(t){var e=tm.util.File();return"string"==typeof t?e.load({url:t,dataType:"json"}):(e.setData(t),e.loaded=!0),e};tm.asset.Loader.register("png",t),tm.asset.Loader.register("gif",t),tm.asset.Loader.register("jpg",t),tm.asset.Loader.register("jpeg",t),tm.asset.Loader.register("wav",e),tm.asset.Loader.register("mp3",e),tm.asset.Loader.register("ogg",e),tm.asset.Loader.register("m4a",e),tm.asset.Loader.register("json",s),tm.asset.Loader.register("tmx",i),tm.asset.Loader.register("tmss",n)}(),function(){tm.define("tm.asset.Texture",{superClass:"tm.event.EventDispatcher",element:null,loaded:!1,init:function(t){this.superInit(),this.element=new Image,this.element.src=t;var e=this;this.element.onload=function(){e.loaded=!0; var t=tm.event.Event("load");e.dispatchEvent(t)}},getElement:function(){return this.element}}),tm.asset.Texture.prototype.getter("width",function(){return this.element.width}),tm.asset.Texture.prototype.getter("height",function(){return this.element.height})}(),function(){tm.define("tm.asset.SpriteSheet",{superClass:"tm.event.EventDispatcher",loaded:!1,init:function(t){this.superInit(),this.loaded=!1,"string"==typeof t?this.load(t):(this.parse(t),this.loaded=!0,this.dispatchEvent(tm.event.Event("load")))},load:function(t){tm.util.Ajax.load({url:t,dataType:"json",success:function(t){this.parse(t),this.loaded=!0}.bind(this)})},parse:function(t){if(this.frame=t.frame,"string"==typeof t.image){if(!tm.asset.Manager.contains(t.image)){var e=tm.asset.Loader();e.load(t.image)}this.image=tm.asset.Manager.get(t.image)}else this.image=t.image;if(this.image.loaded===!1)this.image.addEventListener("load",function(){this._calcFrames(t.frame);var e=tm.event.Event("load");this.dispatchEvent(e)}.bind(this),!1);else{this._calcFrames(t.frame);var i=tm.event.Event("load");this.dispatchEvent(i)}this._calcAnim(t.animations)},getFrame:function(t){return this.frames[t]},getAnimation:function(t){return this.animations[t]},_calcFrames:function(t){var e=this.frames=[],i=t.width,n=t.height,s=~~(this.image.width/i),r=~~(this.image.height/n);t.count||(t.count=s*r);for(var o=0,a=t.count;a>o;++o){var h=o%s,u=0|o/s,c={x:h*i,y:u*n,width:i,height:n};e.push(c)}},_calcAnim:function(t){this.animations={};for(var e in t){var i=t[e];this.animations[e]=i instanceof Array?{frames:[].range(i[0],i[1]),next:i[2],frequency:i[3]||1}:"number"==typeof i?{frames:[i],next:null,frequency:1}:{frames:i.frames,next:i.next,frequency:i.frequency||1}}this.animations["default"]={frames:[].range(0,this.frame.count),next:"default",frequency:1}}})}(),function(){tm.define("tm.asset.MapSheet",{superClass:"tm.event.EventDispatcher",init:function(t){this.superInit(),this.loaded=!1,"string"==typeof t?tm.util.Ajax.load({url:t,success:function(t){var e=this._parse(t);this.$extend(e),this._checkImage()}.bind(this)}):(this.$extend(arguments[0]),this._checkImage())},_parse:function(t){Array.prototype.forEach;var e={},i=new DOMParser,n=i.parseFromString(t,"text/xml"),s=this._attrToJSON(n.getElementsByTagName("map")[0]);return this.$extend(s),e.tilesets=this._parseTilesets(n),e.layers=this._parseLayers(n),e},_parseTilesets:function(t){var e=Array.prototype.forEach,i=this,n=[],s=t.getElementsByTagName("tileset");return e.call(s,function(t){var e={},s=i._propertiesToJson(t);e.image=s.src?s.src:t.getElementsByTagName("image")[0].getAttribute("source"),n.push(e)}),n},_parseLayers:function(t){var e=Array.prototype.forEach,i=[],n=t.getElementsByTagName("map")[0],s=[];return e.call(n.childNodes,function(t){("layer"==t.tagName||"objectgroup"==t.tagName)&&s.push(t)}),s.each(function(t){if("layer"==t.tagName){var n=t.getElementsByTagName("data")[0],s=n.getAttribute("encoding"),r={type:"layer",name:t.getAttribute("name")};"csv"==s?r.data=this._parseCSV(n.textContent):"base64"==s&&(r.data=this._parseBase64(n.textContent));var o=this._attrToJSON(t);r.$extend(o),i.push(r)}else if("objectgroup"==t.tagName){var r={type:"objectgroup",objects:[],name:t.getAttribute("name")};e.call(t.childNodes,function(t){if(3!=t.nodeType){var e=this._attrToJSON(t);e.properties=this._propertiesToJson(t),r.objects.push(e)}}.bind(this)),i.push(r)}}.bind(this)),i},_parseCSV:function(t){var e=t.split(","),i=[];return e.each(function(t){var e=parseInt(t,10)-1;i.push(e)}),i},_parseBase64:function(t){var e=atob(t.trim()),i=[];e=e.split("").map(function(t){return t.charCodeAt(0)});for(var n=0,s=e.length/4;s>n;++n){var r=e[4*n];i[n]=parseInt(r,10)-1}return i},_propertiesToJson:function(t){for(var e=t.getElementsByTagName("properties")[0],i={},n=0;e.childNodes.length>n;n++){var s=e.childNodes[n];"property"===s.tagName&&(i[s.getAttribute("name")]=s.getAttribute("value"))}return i},_attrToJSON:function(t){for(var e={},i=0;t.attributes.length>i;i++){var n=t.attributes[i].value;n=isNaN(parseFloat(n))?n:parseFloat(n),e[t.attributes[i].name]=n}return e},_checkImage:function(){var t=this;if(this.tilesets.length){var e=0,i=this.tilesets.length,n=function(){if(e++,e==i){this.loaded=!0;var t=tm.event.Event("load");this.dispatchEvent(t)}}.bind(this);this.tilesets.each(function(s){var r=tm.asset.Manager.get(s.image);if(r)if(r.loaded){if(++e,e==i){this.loaded=!0;var o=tm.event.Event("load");t.dispatchEvent(o)}}else r.addEventListener("load",n);else{var a=tm.asset.Loader();a.load(s.image);var h=tm.asset.Manager.get(s.image);h.addEventListener("load",n)}})}else{this.loaded=!0;var s=tm.event.Event("load");this.dispatchEvent(s)}}})}(),tm.input=tm.input||{},function(){tm.input.Keyboard=tm.createClass({element:null,key:null,press:null,down:null,up:null,last:null,init:function(t){this.element=t||document,this.key={},this.press={},this.down={},this.up={},this.last={};var e=this;this.element.addEventListener("keydown",function(t){e.key[t.keyCode]=!0}),this.element.addEventListener("keyup",function(t){e.key[t.keyCode]=!1}),this.element.addEventListener("keypress",function(){})},run:function(t){var e=this;t=t||30,tm.setLoop(function(){e._update(),e.update&&e.update()},1e3/t)},_update:function(){for(var t in this.key)this.last[t]=this.press[t],this.press[t]=this.key[t],this.down[t]=(this.press[t]^this.last[t])&this.press[t],this.up[t]=(this.press[t]^this.last[t])&this.last[t];return this},getKey:function(t){return"string"==typeof t&&(t=e[t]),1==this.press[t]},getKeyDown:function(t){return"string"==typeof t&&(t=e[t]),1==this.down[t]},getKeyUp:function(t){return"string"==typeof t&&(t=e[t]),1==this.up[t]},getKeyAngle:function(){var e=null,i=this.getKey("left")<<3|this.getKey("up")<<2|this.getKey("right")<<1|this.getKey("down");return 0!=i&&t.hasOwnProperty(i)&&(e=t[i]),e},getKeyDirection:function(){var t=tm.geom.Vector2(0,0);return this.getKey("left")?t.x=-1:this.getKey("right")&&(t.x=1),this.getKey("up")?t.y=-1:this.getKey("down")&&(t.y=1),t.x&&t.y&&t.div(Math.SQRT2),t},setKey:function(t,i){return"string"==typeof t&&(t=e[t]),this.press[t]=i},clearKey:function(){this.press={}}});var t={1:270,2:0,4:90,8:180,6:45,3:315,12:135,9:225,14:90,13:180,11:270,7:0},e={backspace:8,tab:9,enter:13,"return":13,shift:16,ctrl:17,alt:18,pause:19,capslock:20,escape:27,pageup:33,pagedown:34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,"delete":46,0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,a:65,A:65,b:66,B:66,c:67,C:67,d:68,D:68,e:69,E:69,f:70,F:70,g:71,G:71,h:72,H:72,i:73,I:73,j:74,J:74,k:75,K:75,l:76,L:76,m:77,M:77,n:78,N:78,o:79,O:79,p:80,P:80,q:81,Q:81,r:82,R:82,s:83,S:83,t:84,T:84,u:85,U:85,v:86,V:86,w:87,W:87,x:88,X:88,y:89,Y:89,z:90,Z:90,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,f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123,numlock:144,scrolllock:145,semicolon:186,equalsign:187,comma:188,dash:189,period:190,"forward slash":191,"/":191,"grave accent":192,"open bracket":219,"back slash":220,"close bracket":221,"single quote":222,space:32}}(),tm.input=tm.input||{},function(){tm.input.Mouse=tm.createClass({element:null,init:function(t){this.element=t||window.document,this.position=tm.geom.Vector2(0,0),this.deltaPosition=tm.geom.Vector2(0,0),this.prevPosition=tm.geom.Vector2(0,0),this._x=0,this._y=0;var e=this;this.element.addEventListener("mousedown",function(t){e._mousemove(t),e.prevPosition.set(e._x,e._y),e.button|=1<=3?this.set(arguments.r,arguments.g,arguments.b,arguments.a):t instanceof Array?this.setFromArray(t):t instanceof Object?this.setFromObject(t):"string"==typeof t&&this.setFromString(t),this},toStyleAsHex:function(){return"#{0}{1}{2}".format(this.r.toString(16).padding(2,"0"),this.g.toString(16).padding(2,"0"),this.b.toString(16).padding(2,"0"))},toStyleAsRGB:function(){return"rgb({r},{g},{b})".format({r:~~this.r,g:~~this.g,b:~~this.b})},toStyleAsRGBA:function(){return"rgba({r},{g},{b},{a})".format({r:~~this.r,g:~~this.g,b:~~this.b,a:this.a})},toStyle:function(){return"rgba({r},{g},{b},{a})".format({r:~~this.r,g:~~this.g,b:~~this.b,a:this.a})}});var t={hex111:{reg:/^#(\w{1})(\w{1})(\w{1})$/,exec:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]}},hex222:{reg:/^#(\w{2})(\w{2})(\w{2})$/,exec:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},rgb:{reg:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,exec:function(t){return[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]}},rgba:{reg:/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*(\d{1}(\.{1}\d+)?)\)$/,exec:function(t){return[parseInt(t[1]),parseInt(t[2]),parseInt(t[3]),parseFloat(t[4])]}},hsl:{reg:/^hsl\((\d{1,3}),\s*(\d{1,3})%,\s*(\d{1,3})%\)$/,exec:function(t){return tm.graphics.Color.HSLtoRGB(t[1],t[2],t[3])}},hsla:{reg:/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*(\d{1}(\.{1}\d+)?)\)$/,exec:function(t){return Color.HSLAtoRGBA(t[1],t[2],t[3],t[4])}}};tm.graphics.Color.COLOR_LIST={black:[0,0,0],silver:[192,192,192],gray:[128,128,128],white:[255,255,255],maroon:[128,0,0],red:[255,0,0],purple:[128,0,128],fuchsia:[255,0,255],green:[0,128,0],lime:[0,255,0],olive:[128,128,0],yellow:[255,255,0],navy:[0,0,128],blue:[0,0,255],teal:[0,128,128],aqua:[0,255,255]},tm.graphics.Color.strToNum=tm.graphics.Color.stringToNumber=function(e){var i=null;if("#"===e[0]?i=4==e.length?"hex111":"hex222":"r"===e[0]&&"g"===e[1]&&"b"===e[2]?i="a"==e[3]?"rgba":"rgb":"h"===e[0]&&"s"===e[1]&&"l"===e[2]&&(i="a"==e[3]?"hsla":"hsl"),i){var n=t[i],s=e.match(n.reg);value=n.exec(s)}else Color.COLOR_LIST[e]&&(value=Color.COLOR_LIST[e]);return value},tm.graphics.Color.HSLtoRGB=function(t,e,i){var n,s,r;if(t%=360,t+=360,t%=360,e*=.01,i*=.01,0==e){var i=Math.round(255*i);return[i,i,i]}var o=.5>i?i*(1+e):i+e-i*e,a=2*i-o,h=(t+120)%360;return n=60>h?a+(o-a)*h/60:180>h?o:a,h=t,s=60>h?a+(o-a)*h/60:180>h?o:240>h?a+(o-a)*(240-h)/60:a,h=(t-120+360)%360,r=60>h?a+(o-a)*h/60:180>h?o:240>h?a+(o-a)*(240-h)/60:a,[parseInt(255*n),parseInt(255*s),parseInt(255*r)]},tm.graphics.Color.HSLAtoRGBA=function(t,e,i,n){var s=Color.HSLtoRGB(t,e,i);return s[3]=n,rgb},tm.graphics.Color.createStyleRGB=function(t,e,i){return"rgba("+t+","+e+","+i+")"},tm.graphics.Color.createStyleRGBA=function(t,e,i,n){return"rgba("+t+","+e+","+i+","+n+")"},tm.graphics.Color.createStyleHSL=function(t,e,i){return"hsl("+t+","+e+"%,"+i+"%)"},tm.graphics.Color.createStyleHSLA=function(t,e,i,n){return"hsla("+t+","+e+"%,"+i+"%,"+n+")"}}(),tm.graphics=tm.graphics||{},function(){tm.graphics.Canvas=tm.createClass({element:null,canvas:null,context:null,init:function(t){this.canvas=null,this.canvas="string"==typeof t?document.querySelector(t):t||document.createElement("canvas"),this.element=this.canvas,this.context=this.canvas.getContext("2d"),this.context.lineCap="round",this.context.lineJoin="round"},resize:function(t,e){return this.canvas.width=t,this.canvas.height=e,this},resizeWindow:function(){return this.canvas.style.position="fixed",this.canvas.style.margin="0px",this.canvas.style.padding="0px",this.canvas.style.left="0px",this.canvas.style.top="0px",this.resize(window.innerWidth,window.innerHeight)},resizeToFitScreen:function(){return this.canvas.style.position="fixed",this.canvas.style.margin="0px",this.canvas.style.padding="0px",this.canvas.style.left="0px",this.canvas.style.top="0px",this.resize(window.innerWidth,window.innerHeight)},fitWindow:function(t){var e=function(){t=void 0===t?!0:t;var e=this.element,i=e.style;i.position="absolute",i.margin="auto",i.left="0px",i.top="0px",i.bottom="0px",i.right="0px";var n=e.width/window.innerWidth,s=e.height/window.innerHeight,r=e.height/e.width;n>s?(i.width=innerWidth+"px",i.height=innerWidth*r+"px"):(i.width=innerHeight/r+"px",i.height=innerHeight+"px")}.bind(this);e(),t&&window.addEventListener("resize",e,!1)},clear:function(t,e,i,n){return t=t||0,e=e||0,i=i||this.width,n=n||this.height,this.context.clearRect(t,e,i,n),this},clearColor:function(t,e,i,n,s){return e=e||0,i=i||0,n=n||this.width,s=s||this.height,this.save(),this.resetTransform(),this.fillStyle=t,this.context.fillRect(e,i,n,s),this.restore(),this},beginPath:function(){return this.context.beginPath(),this},closePath:function(){return this.context.closePath(),this},moveTo:function(t,e){return this.context.moveTo(t,e),this},lineTo:function(t,e){return this.context.lineTo(t,e),this},fill:function(){return this.context.fill(),this},stroke:function(){return this.context.stroke(),this},clip:function(){return this.context.clip(),this},drawPoint:function(t,e){return this.strokeRect(t,e,1,1)},line:function(t,e,i,n){return this.moveTo(t,e).lineTo(i,n)},drawLine:function(t,e,i,n){return this.beginPath().line(t,e,i,n).stroke()},drawDashLine:function(t,e,i,n,s){var r=null;"string"==typeof s?r=s:(s=s||61680,r=s.toString(2)),r=r.padding(16,"1");var o=i-t,a=n-e,h=Math.sqrt(o*o+a*a);o/=h,a/=h;for(var u=t,c=e,l=0;h>l;++l)"1"==r[l%16]&&this.drawPoint(u,c),u+=o,c+=a;return this},drawArrow:function(t,e,i,n,s){var r=i-t,o=n-e,a=180*Math.atan2(o,r)/Math.PI;return this.drawLine(t,e,i,n),this.fillPolygon(i,n,s||5,3,a),this},lines:function(){this.moveTo(arguments[0],arguments[1]);for(var t=1,e=arguments.length/2;e>t;++t)this.lineTo(arguments[2*t],arguments[2*t+1]);return this},strokeLines:function(){return this.beginPath(),this.lines.apply(this,arguments),this.stroke(),this},fillLines:function(){return this.beginPath(),this.lines.apply(this,arguments),this.fill(),this},rect:function(){return this.context.rect.apply(this.context,arguments),this},fillRect:function(){return this.context.fillRect.apply(this.context,arguments),this},strokeRect:function(){return this.context.strokeRect.apply(this.context,arguments),this},roundRect:function(t,e,i,n,s){var r=t+s,o=t+i-s,a=e+s,h=e+n-s;return this.context.arc(r,a,s,-Math.PI,.5*-Math.PI,!1),this.context.arc(o,a,s,.5*-Math.PI,0,!1),this.context.arc(o,h,s,0,.5*Math.PI,!1),this.context.arc(r,h,s,.5*Math.PI,Math.PI,!1),this.closePath(),this},fillRoundRect:function(t,e,i,n,s){return this.beginPath().roundRect(t,e,i,n,s).fill()},strokeRoundRect:function(t,e,i,n,s){return this.beginPath().roundRect(t,e,i,n,s).stroke()},polygon:function(t,e,i,n,s){var r=2*Math.PI/n,o=void 0!=s?s*Math.PI/180:-Math.PI/2;this.moveTo(t+Math.cos(o)*i,e+Math.sin(o)*i);for(var a=1;n>a;++a){var h=r*a+o;this.lineTo(t+Math.cos(h)*i,e+Math.sin(h)*i)}return this.closePath(),this},fillPolygon:function(t,e,i,n,s){return this.beginPath().polygon(t,e,i,n,s).fill()},strokePolygon:function(t,e,i,n,s){return this.beginPath().polygon(t,e,i,n,s).stroke()},star:function(t,e,i,n,s,r){var o=i*(s||.38),a=r?r*Math.PI/180:-Math.PI/2,h=2*Math.PI/n/2;this.moveTo(t+Math.cos(a)*i,e+Math.sin(a)*i);for(var u=1;2*n>u;++u){var c=h*u+a,l=u%2?o:i;this.lineTo(t+Math.cos(c)*l,e+Math.sin(c)*l)}return this.closePath(),this},fillStar:function(t,e,i,n,s,r){return this.beginPath().star(t,e,i,n,s,r).fill()},strokeStar:function(t,e,i,n,s,r){return this.beginPath().star(t,e,i,n,s,r).stroke()},heart:function(t,e,i,n){var s=.5*i,r=void 0===n?Math.PI/4:Math.degToRad(n),o=Math.cos(r)*s,a=Math.sin(r)*s,h=-s,u=(s*s-o*h)/a,c=u+s,l=s-c/2;return this.moveTo(0+t,u+e+l),this.arc(-s+t,0+e+l,s,Math.PI-r,2*Math.PI),this.arc(s+t,0+e+l,s,Math.PI,r),this.closePath(),this},fillHeart:function(t,e,i,n){return this.beginPath().heart(t,e,i,n).fill()},strokeHeart:function(t,e,i,n){return this.beginPath().heart(t,e,i,n).stroke()},circle:function(t,e,i){return this.context.arc(t,e,i,0,2*Math.PI,!1),this},fillCircle:function(t,e,i){var n=this.context;return n.beginPath(),n.arc(t,e,i,0,2*Math.PI,!1),n.closePath(),n.fill(),this},strokeCircle:function(t,e,i){return this.beginPath().circle(t,e,i).stroke()},arc:function(t,e,i,n,s,r){return this.context.arc(t,e,i,n,s,r),this},fillArc:function(t,e,i,n,s,r){return this.beginPath().arc(t,e,i,n,s,r).fill()},strokeArc:function(t,e,i,n,s,r){return this.beginPath().arc(t,e,i,n,s,r).stroke()},triangle:function(t,e,i,n,s,r){return this.moveTo(t,e).lineTo(i,n).lineTo(s,r),this.closePath(),this},fillTriangle:function(t,e,i,n,s,r){return this.beginPath().triangle(t,e,i,n,s,r).fill()},strokeTriangle:function(t,e,i,n,s,r){return this.beginPath().triangle(t,e,i,n,s,r).stroke()},fillText:function(){return this.context.fillText.apply(this.context,arguments)},strokeText:function(){return this.context.strokeText.apply(this.context,arguments)},fillVerticalText:function(t,e,i){this._drawVerticalText("fillText",t,e,i)},strokeVerticalText:function(t,e,i){this._drawVerticalText("strokeText",t,e,i)},_drawVerticalText:function(t,e,i,n){var s=this.context;e.split("\n");var r=this.context.measureText("あ").width;s.save(),s.textAlign="right",s.textBaseline="top",Array.prototype.forEach.call(e,function(e,o){s[t](e,i,n+r*o)}),s.restore()},_drawLabelArea:function(t,e){var i=this.context,n=e.text,s=this.context.measureText("あ").width,r=n.split("\n"),o=(e.lineSpace||1)*s;if(i.save(),e.mode&&"horizon"!=e.mode){var a=Math.max(0|e.height/s,1),h=e.x+e.width,u=[];r.each(function(t){for(var e=0,i=t.length;i>e;e+=a){var n=t.substr(e,a);u.push(n)}});var c=t+"VerticalText";u.each(function(t,i){this[c](t,h-i*o,e.y)}.bind(this))}else{var a=Math.max(0|e.width/s,1),u=[];i.textAlign="left",i.textBaseline="top",r.each(function(t){for(var e=0,i=t.length;i>e;e+=a){var n=t.substr(e,a);u.push(n)}});var c=t+"Text";u.each(function(t,n){i[c](t,e.x,e.y+n*o+4)})}i.restore()},fillLabelArea:function(t){this._drawLabelArea("fill",t)},strokeLabelArea:function(t){this._drawLabelArea("stroke",t)},drawImage:function(t,e,i){this.context.drawImage.apply(this.context,arguments)},drawTexture:function(t){return arguments[0]=t.element,this.context.drawImage.apply(this.context,arguments),this},drawBitmap:function(t){return arguments[0]=t.imageData,this.context.putImageData.apply(this.context,arguments),this},drawScale9Image:function(t,e,i){var n=i.x,s=i.width,r=t.width-(n+s),o=e.width-(n+r),a=i.y;return this.drawImage(t,0,0,n,a,e.x,e.y,n,a),this.drawImage(t,n,0,s,a,e.x+n,e.y,o,a),this.drawImage(t,n+s,0,r,a,e.x+n+o,e.y,r,a),this},setTransform:function(t,e,i,n,s,r){return this.context.setTransform(t,e,i,n,s,r),this},resetTransform:function(){return this.setTransform(1,0,0,1,0,0),this},setTransformCenter:function(){return this.context.setTransform(1,0,0,1,this.width/2,this.height/2),this},transform:function(t,e,i,n,s,r){return this.context.transform(t,e,i,n,s,r),this},save:function(){return this.context.save(),this},restore:function(){return this.context.restore(),this},translate:function(t,e){return this.context.translate(t,e),this},rotate:function(t){return this.context.rotate(t),this},scale:function(t,e){return this.context.scale(t,e),this},saveAsImage:function(t){t=t||tm.graphics.Canvas.MIME_TYPE_PNG;var e=this.canvas.toDataURL(t);window.open(e,"save")},setCompositing:function(){},setFillStyle:function(t){return this.context.fillStyle=t,this},setStrokeStyle:function(t){return this.context.strokeStyle=t,this},setColorStyle:function(t,e){return e=e||t,this.context.strokeStyle=t,this.context.fillStyle=e,this},setText:function(t,e,i){var n=this.context;n.font=t,n.textAlign=e,n.textBaseline=i},setLineStyle:function(width,cap,join,miter){with(this.context)lineWidth=width||1,lineCap=cap||"round",lineJoin=join||"round",miterLimit=miter||10;return this},setShadow:function(t,e,i,n){var s=this.context;return s.shadowColor=t||"black",s.shadowOffsetX=e||0,s.shadowOffsetY=i||0,s.shadowBlur=n||0,this},getElement:function(){return this.element}}),tm.graphics.Canvas.MIME_TYPE_PNG="image/png",tm.graphics.Canvas.MIME_TYPE_JPG="image/jpeg",tm.graphics.Canvas.MIME_TYPE_SVG="image/svg+xml",tm.graphics.Canvas.prototype.accessor("width",{get:function(){return this.canvas.width},set:function(t){this.canvas.width=t}}),tm.graphics.Canvas.prototype.accessor("height",{get:function(){return this.canvas.height},set:function(t){this.canvas.height=t}}),tm.graphics.Canvas.prototype.accessor("fillStyle",{get:function(){return this.context.fillStyle},set:function(t){this.context.fillStyle=t}}),tm.graphics.Canvas.prototype.accessor("strokeStyle",{get:function(){return this.context.strokeStyle},set:function(t){this.context.strokeStyle=t}}),tm.graphics.Canvas.prototype.accessor("globalAlpha",{get:function(){return this.context.globalAlpha},set:function(t){this.context.globalAlpha=t}}),tm.graphics.Canvas.prototype.accessor("globalCompositeOperation",{get:function(){return this.context.globalCompositeOperation},set:function(t){this.context.globalCompositeOperation=t}}),tm.graphics.Canvas.prototype.accessor("shadowBlur",{get:function(){return this.context.shadowBlur},set:function(t){this.context.shadowBlur=t}}),tm.graphics.Canvas.prototype.accessor("shadowColor",{get:function(){return this.context.shadowColor},set:function(t){this.context.shadowColor=t}}),tm.graphics.Canvas.prototype.accessor("shadowOffsetX",{get:function(){return this.context.shadowOffsetX},set:function(t){this.context.shadowOffsetX=t}}),tm.graphics.Canvas.prototype.accessor("shadowOffsetY",{get:function(){return this.context.shadowOffsetY},set:function(t){this.context.shadowOffsetY=t}}),tm.graphics.Canvas.prototype.accessor("lineCap",{get:function(){return this.context.lineCap},set:function(t){this.context.lineCap=t}}),tm.graphics.Canvas.prototype.accessor("lineJoin",{get:function(){return this.context.lineJoin},set:function(t){this.context.lineJoin=t}}),tm.graphics.Canvas.prototype.accessor("miterLimit",{get:function(){return this.context.miterLimit},set:function(t){this.context.miterLimit=t}}),tm.graphics.Canvas.prototype.accessor("lineWidth",{get:function(){return this.context.lineWidth},set:function(t){this.context.lineWidth=t}}),tm.graphics.Canvas.prototype.accessor("font",{get:function(){return this.context.font},set:function(t){this.context.font=t}}),tm.graphics.Canvas.prototype.accessor("textAlign",{get:function(){return this.context.textAlign},set:function(t){this.context.textAlign=t}}),tm.graphics.Canvas.prototype.accessor("textBaseline",{get:function(){return this.context.textBaseline},set:function(t){this.context.textBaseline=t}}),tm.graphics.Canvas.prototype.getter("centerX",function(){return this.canvas.width/2}),tm.graphics.Canvas.prototype.getter("centerY",function(){return this.canvas.height/2}),tm.graphics.Canvas.prototype.accessor("imageSmoothingEnabled",{get:function(){return this.context.imageSmoothingEnabled},set:function(t){this.context.imageSmoothingEnabled=t,this.context.webkitImageSmoothingEnabled=t,this.context.mozImageSmoothingEnabled=t}})}(),tm.graphics=tm.graphics||{},function(){tm.graphics.Bitmap=tm.createClass({imageData:null,init:function(){t||(t=document.createElement("canvas"),e=t.getContext("2d")),this._init.apply(this,arguments),this.init=this._init},_init:function(t){if(1==arguments.length)this.imageData=t,this.data=t.data;else if(2==arguments.length){var i=arguments[0],n=arguments[1];this.imageData=e.createImageData(i,n),this.data=this.imageData.data}},getPixelIndex:function(t){var e=4*t;return[this.data[e+0],this.data[e+1],this.data[e+2],this.data[e+3]]},getPixelXY:function(t,e){return this.getPixelIndex(this.posToIndex(t,e))},getPixel:function(t,e){return this.getPixelIndex(this.posToIndex(t,e))},getPixelAsNumber:function(t){var e=4*t;return this.data[e+3]<<24|this.data[e+0]<<16|this.data[e+1]<<8|this.data[e+2]},getPixelAsObject:function(t){var e=4*t;return{r:this.data[e+0],g:this.data[e+1],b:this.data[e+2],a:this.data[e+3]}},getPixelAsArray:function(t){var e=4*t;return[this.data[e+0],this.data[e+1],this.data[e+2],this.data[e+3]]},getPixelAverage:function(t,e,i,n){var s=[0,0,0,0],r=t,o=t+i,a=e,h=e+n;0>r&&(r=0),o>this.width&&(o=this.width),0>a&&(a=0),h>this.height&&(h=this.height);for(var u=[],c=this.width,l=a;h>l;++l)for(var m=r;o>m;++m){var d=c*l+m;u.push(this.getPixelIndex(d))}for(var f=f=u.length,l=0;f>l;++l)s[0]+=u[l][0],s[1]+=u[l][1],s[2]+=u[l][2],s[3]+=u[l][3];return s[0]/=f,s[1]/=f,s[2]/=f,s[3]/=f,s},setPixelIndex:function(t,e,i,n){var s=4*t;return this.data[s+0]=e,this.data[s+1]=i,this.data[s+2]=n,this},setPixelXY:function(t,e,i,n,s){return this.setPixelIndex(e*this.imageData.width+t,i,n,s)},setPixel:function(t,e,i,n){return this.setPixelIndex(y*this.imageData.width+x,e,i,n)},setPixel32Index:function(t,e,i,n,s){var r=4*t;return this.data[r+0]=e,this.data[r+1]=i,this.data[r+2]=n,this.data[r+3]=s,this},setPixel32:function(t,e,i,n,s,r){return this.setPixel32Index(e*this.width+t,i,n,s,r)},setPixel32XY:function(t,e,i,n,s,r){return this.setPixel32Index(e*this.width+t,i,n,s,r)},setPixelFromArray:function(t,e){return this.setPixel(t,e[0],e[1],e[2])},setPixel32FromArray:function(t,e){return this.setPixel32(t,e[0],e[1],e[2],e[3])},setPixelFromNumber:function(t,e){return this.setPixel(t,(16711680&e)>>>16,(65280&e)>>>8,(255&e)>>>0)},setPixel32FromNumber:function(t,e){return this.setPixel32(t,(16711680&e)>>>16,(65280&e)>>>8,(255&e)>>>0,(4278190080&e)>>>24)},setPixelFromObject:function(t,e){return this.setPixel(e.r,e.g,e.b)},setPixel32FromObject:function(t,e){return this.setPixel32(e.r,e.g,e.b,e.a)},setPixelFromString:function(){},posToIndex:function(t,e){return e*this.imageData.width+t},filter:function(t){for(var e=0;this.height>e;++e)for(var i=0;this.width>i;++i){var n=this.posToIndex(i,e),s=this.getPixel(i,e);t.calc(s,n,i,e,this)}return this},noise:function(t,e){t=t||0,e=e||255,range=e-t;for(var i=0,n=this.length;n>i;++i){var s=this.getPixelIndex(i);s[0]=Math.random()*range+t,s[1]=Math.random()*range+t,s[2]=Math.random()*range+t,s[3]=255,this.setPixel32Index(i,s[0],s[1],s[2],s[3])}},applyFilter:function(){}}),tm.graphics.Bitmap.prototype.accessor("width",{get:function(){return this.imageData.width},set:function(t){this.imageData.width=t}}),tm.graphics.Bitmap.prototype.accessor("height",{get:function(){return this.imageData.height},set:function(t){this.imageData.height=t}}),tm.graphics.Bitmap.prototype.getter("length",function(){return this.imageData.width*this.imageData.height}),tm.graphics.Canvas.prototype.getBitmap=function(t,e,i,n){return tm.graphics.Bitmap(this.context.getImageData(t||0,e||0,i||this.width,n||this.height)) },tm.graphics.Canvas.prototype.createBitmap=function(t,e){return tm.graphics.Bitmap(this.context.createImageData(t||this.width,e||this.height))},tm.asset.Texture.prototype.getBitmap=function(t,e){var i=tm.graphics.Canvas();return i.resize(this.width,this.height),i.drawTexture(this,0,0,this.width,this.height),i.getBitmap(t,e)};var t=null,e=null}(),tm.graphics=tm.graphics||{},function(){tm.graphics.MonochromeFilter=tm.createClass({init:function(){},apply:function(t,e){for(var i=t.length,n=0;i>n;++n){var s=t.getPixelIndex(n),r=.3*s[0]+.59*s[1]+.11*s[2];e.setPixel32Index(n,r,r,r,s[3])}return e}})}(),function(){tm.graphics.ReverseFilter=tm.createClass({init:function(){},apply:function(t,e){for(var i=0,n=t.width*t.height;n>i;++i){var s=t.getPixelIndex(i);s[0]=255-s[0],s[1]=255-s[1],s[2]=255-s[2],e.setPixel32Index(i,s[0],s[1],s[2],255)}return e}})}(),function(){tm.graphics.BlurFilter=tm.createClass({init:function(t,e,i){this.blurX=t||4,this.blurY=e||4,this.quality=i||1},apply:function(t,e){for(var i=Math.floor(this.blurX/2),n=Math.floor(this.blurY/2),s=this.blurX,r=this.blurY,o=t.width,a=t.height,h=t.length,u=function(t,e){for(var a=0;h>a;++a){var u=a%o,c=Math.floor(a/o),l=t.getPixelAverage(u-i,c-n,s,r);e.setPixel32Index(a,l[0],l[1],l[2],255)}},c=t,l=0;this.quality>l;++l)t=c,c=tm.graphics.Bitmap(o,a),u(t,c);return e.imageData=c.imageData,e}})}(),function(){for(var t=[],e=0;255>e;++e){var i=0;i=100>e?60:150>e?150:180>e?180:220,t[e]=i}tm.graphics.ToonFilter=tm.createClass({toonTable:null,init:function(e){this.toonTable=e||t},apply:function(t,e){for(var i=0,n=t.width*t.height;n>i;++i){var s=t.getPixelIndex(i),r=this.toonTable[s[0]],o=this.toonTable[s[1]],a=this.toonTable[s[2]];e.setPixel32Index(i,r,o,a,255)}return e}})}(),function(){tm.graphics.ColorMatrixFilter=tm.createClass({init:function(t){this.colorMatrix=t},apply:function(t,e){for(var i=this.colorMatrix,n=0,s=t.length;s>n;++n){var r=t.getPixelIndex(n),o=r[0]*i[0]+r[1]*i[1]+r[2]*i[2]+r[3]*i[3]+i[4],a=r[0]*i[5]+r[1]*i[6]+r[2]*i[7]+r[3]*i[8]+i[9],h=r[0]*i[10]+r[1]*i[11]+r[2]*i[12]+r[3]*i[13]+i[14],u=r[0]*i[15]+r[1]*i[16]+r[2]*i[17]+r[3]*i[18]+i[19];e.setPixel32Index(n,o,a,h,u)}return e}})}(),tm.graphics=tm.graphics||{},function(){tm.graphics.Canvas.prototype.setGradient=function(t){this.context.fillStyle=t.gradient}}(),function(){tm.graphics.LinearGradient=tm.createClass({init:function(i,n,s,r){t||(t=document.createElement("canvas"),e=t.getContext("2d")),this._init(i,n,s,r),this.init=this._init},_init:function(t,i,n,s){this.gradient=e.createLinearGradient(t,i,n,s)},addColorStop:function(t,e){return this.gradient.addColorStop(t,e),this},addColorStopList:function(t){for(var e=0,i=t.length;i>e;++e){var n=t[e].offset,s=t[e].color;this.addColorStop(n,s)}return this},toStyle:function(){return this.gradient}}),tm.graphics.RadialGradient=tm.createClass({init:function(i,n,s,r,o,a){t||(t=document.createElement("canvas"),e=t.getContext("2d")),this._init(i,n,s,r,o,a),this.init=this._init},_init:function(t,i,n,s,r,o){this.gradient=e.createRadialGradient(t,i,n,s,r,o)},addColorStop:function(t,e){return this.gradient.addColorStop(t,e),this},addColorStopList:function(t){for(var e=0,i=t.length;i>e;++e){var n=t[e].offset,s=t[e].color;this.addColorStop(n,s)}return this},toStyle:function(){return this.gradient}});var t=null,e=null}(),tm.anim=tm.anim||{},function(){tm.anim.Tween=tm.createClass({superClass:tm.event.EventDispatcher,target:null,time:null,prop:null,nowProps:null,now:null,begin:null,finish:null,duration:null,isLooping:null,isPlaying:null,func:Math.linear,fps:30,init:function(){this.superInit(),this.time=0,this.nowProps={},this.isPlaying=!1,arguments.length>0&&this.to.apply(this,arguments)},to:function(t,e,i,n){var s={};for(var r in e)s[r]=t[r];return this.fromTo(t,s,e,i,n),this},by:function(t,e,i,n){var s={},r={};for(var o in e)s[o]=t[o],r[o]=t[o]+e[o];return this.fromTo(t,s,r,i,n),this},fromTo:function(t,e,i,n,s){this.target=t,this.beginProps=e,this.finishProps=i,this.duration=n,this.changeProps={};for(var r in e)this.changeProps[r]=i[r]-e[r];return this.setTransition(s),this},from:function(t,e,i,n){var s={};for(var r in e)s[r]=t[r];return this.fromTo(t,e,s,i,n),this},setTransition:function(t){return this.func="function"==typeof t?t:"string"==typeof t?tm.anim.easing[t]:tm.anim.easing["default"],this},resume:function(){this.isPlaying=!0,this._resumeTime(),this._updateTime(),this.dispatchEvent(tm.event.TweenEvent("resume",this.time,this.nowProps))},start:function(){this.isPlaying=!0,this._startTime(),this._updateTime(),this.dispatchEvent(tm.event.TweenEvent("start",this.time,this.nowProps))},stop:function(){this.isPlaying=!1,this.dispatchEvent(tm.event.TweenEvent("stop",this.time,this.nowProps))},rewind:function(){this.time=0,this.update()},fforward:function(){this.time=this.duration,this.update()},yoyo:function(){var t=this.finishProps;this.finishProps=this.beginProps,this.beginProps=t;for(var e in this.beginProps)this.changeProps[e]=this.finishProps[e]-this.beginProps[e];this.start()},update:function(){for(var t in this.changeProps)this.nowProps[t]=this.func(this.time,this.beginProps[t],this.changeProps[t],this.duration),this.target[t]=this.nowProps[t];this.dispatchEvent(tm.event.TweenEvent("change",this.time,this.nowProps))},_resumeTime:function(){this.startTime=(new Date).getTime()-this.time},_startTime:function(){this.startTime=(new Date).getTime()},_updateTime:function(){this.isPlaying&&(this._setTime((new Date).getTime()-this.startTime),setTimeout(arguments.callee.bind(this),1e3/this.fps))},_setTime:function(t){var e=t;e>this.duration?this.isLooping?(this.rewind(),this.update(),this.dispatchEvent(tm.event.TweenEvent("loop",this.time,this.nowProps))):(this.time=this.duration,this.update(),this.stop(),this.dispatchEvent(tm.event.TweenEvent("finish",this.time,this.nowProps))):(this.time=e,this.update())}})}(),function(){tm.anim.easing={"default":function(t,e,i,n){return i*t/n+e},linear:function(t,e,i,n){return i*t/n+e},swing:function(t,e,i,n){return-i*(t/=n)*(t-2)+e},easeInQuad:function(t,e,i,n){return i*(t/=n)*t+e},easeOutQuad:function(t,e,i,n){return-i*(t/=n)*(t-2)+e},easeInOutQuad:function(t,e,i,n){return 1>(t/=n/2)?i/2*t*t+e:-i/2*(--t*(t-2)-1)+e},easeInCubic:function(t,e,i,n){return i*(t/=n)*t*t+e},easeOutCubic:function(t,e,i,n){return i*((t=t/n-1)*t*t+1)+e},easeInOutCubic:function(t,e,i,n){return 1>(t/=n/2)?i/2*t*t*t+e:i/2*((t-=2)*t*t+2)+e},easeOutInCubic:function(t,e,i,n){return n/2>t?tm.anim.easing.easeOutCubic(2*t,e,i/2,n):tm.anim.easing.easeInCubic(2*t-n,e+i/2,i/2,n)},easeInQuart:function(t,e,i,n){return i*(t/=n)*t*t*t+e},easeOutQuart:function(t,e,i,n){return-i*((t=t/n-1)*t*t*t-1)+e},easeInOutQuart:function(t,e,i,n){return 1>(t/=n/2)?i/2*t*t*t*t+e:-i/2*((t-=2)*t*t*t-2)+e},easeOutInQuart:function(t,e,i,n){return n/2>t?tm.anim.easing.easeOutQuart(2*t,e,i/2,n):tm.anim.easing.easeInQuart(2*t-n,e+i/2,i/2,n)},easeInQuint:function(t,e,i,n){return i*(t/=n)*t*t*t*t+e},easeOutQuint:function(t,e,i,n){return i*((t=t/n-1)*t*t*t*t+1)+e},easeInOutQuint:function(t,e,i,n){return 1>(t/=n/2)?i/2*t*t*t*t*t+e:i/2*((t-=2)*t*t*t*t+2)+e},easeOutInQuint:function(t,e,i,n){return n/2>t?tm.anim.easing.easeOutQuint(2*t,e,i/2,n):tm.anim.easing.easeInQuint(2*t-n,e+i/2,i/2,n)},easeInSine:function(t,e,i,n){return-i*Math.cos(t/n*(Math.PI/2))+i+e},easeOutSine:function(t,e,i,n){return i*Math.sin(t/n*(Math.PI/2))+e},easeInOutSine:function(t,e,i,n){return-i/2*(Math.cos(Math.PI*t/n)-1)+e},easeOutInSine:function(t,e,i,n){return n/2>t?tm.anim.easing.easeOutSine(2*t,e,i/2,n):tm.anim.easing.easeInSine(2*t-n,e+i/2,i/2,n)},easeInExpo:function(t,e,i,n){return 0==t?e:i*Math.pow(2,10*(t/n-1))+e-.001*i},easeOutExpo:function(t,e,i,n){return t==n?e+i:1.001*i*(-Math.pow(2,-10*t/n)+1)+e},easeInOutExpo:function(t,e,i,n){return 0==t?e:t==n?e+i:1>(t/=n/2)?i/2*Math.pow(2,10*(t-1))+e-5e-4*i:1.0005*(i/2)*(-Math.pow(2,-10*--t)+2)+e},easeOutInExpo:function(t,e,i,n){return n/2>t?tm.anim.easing.easeOutExpo(2*t,e,i/2,n):tm.anim.easing.easeInExpo(2*t-n,e+i/2,i/2,n)},easeInCirc:function(t,e,i,n){return-i*(Math.sqrt(1-(t/=n)*t)-1)+e},easeOutCirc:function(t,e,i,n){return i*Math.sqrt(1-(t=t/n-1)*t)+e},easeInOutCirc:function(t,e,i,n){return 1>(t/=n/2)?-i/2*(Math.sqrt(1-t*t)-1)+e:i/2*(Math.sqrt(1-(t-=2)*t)+1)+e},easeOutInCirc:function(t,e,i,n){return n/2>t?tm.anim.easing.easeOutCirc(2*t,e,i/2,n):tm.anim.easing.easeInCirc(2*t-n,e+i/2,i/2,n)},easeInElastic:function(t,e,i,n,s,r){var o;return 0==t?e:1==(t/=n)?e+i:(r||(r=.3*n),!s||Math.abs(i)>s?(s=i,o=r/4):o=r/(2*Math.PI)*Math.asin(i/s),-(s*Math.pow(2,10*(t-=1))*Math.sin((t*n-o)*2*Math.PI/r))+e)},easeOutElastic:function(t,e,i,n,s,r){var o;return 0==t?e:1==(t/=n)?e+i:(r||(r=.3*n),!s||Math.abs(i)>s?(s=i,o=r/4):o=r/(2*Math.PI)*Math.asin(i/s),s*Math.pow(2,-10*t)*Math.sin((t*n-o)*2*Math.PI/r)+i+e)},easeInOutElastic:function(t,e,i,n,s,r){var o;return 0==t?e:2==(t/=n/2)?e+i:(r||(r=n*.3*1.5),!s||Math.abs(i)>s?(s=i,o=r/4):o=r/(2*Math.PI)*Math.asin(i/s),1>t?-.5*s*Math.pow(2,10*(t-=1))*Math.sin((t*n-o)*2*Math.PI/r)+e:.5*s*Math.pow(2,-10*(t-=1))*Math.sin((t*n-o)*2*Math.PI/r)+i+e)},easeOutInElastic:function(t,e,i,n,s,r){return n/2>t?tm.anim.easing.easeOutElastic(2*t,e,i/2,n,s,r):tm.anim.easing.easeInElastic(2*t-n,e+i/2,i/2,n,s,r)},easeInBack:function(t,e,i,n,s){return void 0==s&&(s=1.70158),i*(t/=n)*t*((s+1)*t-s)+e},easeOutBack:function(t,e,i,n,s){return void 0==s&&(s=1.70158),i*((t=t/n-1)*t*((s+1)*t+s)+1)+e},easeInOutBack:function(t,e,i,n,s){return void 0==s&&(s=1.70158),1>(t/=n/2)?i/2*t*t*(((s*=1.525)+1)*t-s)+e:i/2*((t-=2)*t*(((s*=1.525)+1)*t+s)+2)+e},easeOutInBack:function(t,e,i,n,s){return n/2>t?tm.anim.easing.easeOutBack(2*t,e,i/2,n,s):tm.anim.easing.easeInBack(2*t-n,e+i/2,i/2,n,s)},easeInBounce:function(t,e,i,n){return i-tm.anim.easing.easeOutBounce(n-t,0,i,n)+e},easeOutBounce:function(t,e,i,n){return 1/2.75>(t/=n)?i*7.5625*t*t+e:2/2.75>t?i*(7.5625*(t-=1.5/2.75)*t+.75)+e:2.5/2.75>t?i*(7.5625*(t-=2.25/2.75)*t+.9375)+e:i*(7.5625*(t-=2.625/2.75)*t+.984375)+e},easeInOutBounce:function(t,e,i,n){return n/2>t?.5*tm.anim.easing.easeInBounce(2*t,0,i,n)+e:.5*tm.anim.easing.easeOutBounce(2*t-n,0,i,n)+.5*i+e},easeOutInBounce:function(t,e,i,n){return n/2>t?tm.anim.easing.easeOutBounce(2*t,e,i/2,n):tm.anim.easing.easeInBounce(2*t-n,e+i/2,i/2,n)}}}(),tm.app=tm.app||{},function(){tm.app.BaseApp=tm.createClass({element:null,mouse:null,touch:null,pointing:null,keyboard:null,accelerometer:null,stats:null,frame:0,fps:30,isPlaying:null,_scenes:null,_sceneIndex:0,init:function(t){this.element=t,this.mouse=tm.input.Mouse(this.element),this.touch=tm.input.Touch(this.element,0),this.keyboard=tm.input.Keyboard(),this.pointing=tm.isMobile?this.touch:this.mouse,this.accelerometer=tm.input.Accelerometer(),this.isPlaying=!0,this._scenes=[tm.app.Scene()],this._sceneIndex=0,this.element.addEventListener("touchstart",function(t){t.stop()}),window.addEventListener("focus",function(){this.currentScene.dispatchEvent(tm.event.Event("focus"))}.bind(this)),window.addEventListener("blur",function(){this.currentScene.dispatchEvent(tm.event.Event("blur"))}.bind(this)),this.element.addEventListener(tm.isMobile?"touchstart":"mousedown",this._onclick.bind(this))},run:function(){var t=this;return tm.setLoop(function(){t._loop()},1e3/this.fps),void 0;var t},_loop:function(){this.update&&this.update(),this._update(),this.draw&&this.draw(),this._draw(),this.stats&&this.stats.update()},replaceScene:function(t){var e=null;return this.currentScene&&(e=tm.event.Event("exit"),e.app=this,this.currentScene.dispatchEvent(e),this.currentScene.app=null),e=tm.event.Event("enter"),e.app=this,this.currentScene=t,this.currentScene.app=this,this.currentScene.dispatchEvent(e),this},pushScene:function(t){return e=tm.event.Event("exit"),e.app=this,this.currentScene.dispatchEvent(e),this._scenes.push(t),++this._sceneIndex,e=tm.event.Event("enter"),e.app=this,t.app=this,t.dispatchEvent(e),this},popScene:function(){var t=this._scenes.pop();return--this._sceneIndex,e=tm.event.Event("exit"),e.app=this,t.dispatchEvent(e),t.app=null,e=tm.event.Event("enter"),e.app=this,this.currentScene.dispatchEvent(e),t},enableStats:function(){return window.Stats?(this.stats=new Stats,this.stats.domElement.style.position="fixed",this.stats.domElement.style.left="5px",this.stats.domElement.style.top="20px",document.body.appendChild(this.stats.domElement)):console.warn("not defined stats."),this},enableDatGUI:function(){if(window.dat){var t=new dat.GUI;return t}},start:function(){return this.isPlaying=!0,this},stop:function(){return this.isPlaying=!1,this},_update:function(){this.mouse.update(),this.keyboard._update(),this.touch.update(),this.isPlaying&&(this.currentScene._update(this),++this.frame)},_draw:function(){},getElement:function(){return this.element},_onclick:function(t){var e=t.pointX,i=t.pointY;this.element.style.width&&(e*=this.element.width/parseInt(this.element.style.width)),this.element.style.height&&(i*=this.element.height/parseInt(this.element.style.height));var n=function(t){t.children.length>0&&t.children.each(function(t){t.hasEventListener("click")&&t.isHitPoint&&t.isHitPoint(e,i)&&t.dispatchEvent(tm.event.Event("click"))})};n(this.currentScene)}}),tm.app.BaseApp.prototype.accessor("currentScene",{get:function(){return this._scenes[this._sceneIndex]},set:function(t){this._scenes[this._sceneIndex]=t}})}(),tm.app=tm.app||{},function(){tm.app.Element=tm.createClass({superClass:tm.event.EventDispatcher,parent:null,children:null,_listeners:null,init:function(){this.superInit(),this.children=[],this._listeners={}},remove:function(){return console.assert(this.parent),this.parent.removeChild(this),this.parent=null,this},addChild:function(t){t.parent&&t.remove(),t.parent=this,this.children.push(t);var e=tm.event.Event("added");return t.dispatchEvent(e),t},addChildTo:function(t){return t.addChild(this),this},addChildren:function(t){for(var e=t.slice(),i=beginIndex,n=e.length;n>i;++i)this.addChild(e[i])},addChildAt:function(t,e){t.parent&&t.remove(),t.parent=this,this.children.splice(e,0,t);var i=tm.event.Event("added");return t.dispatchEvent(i),t},getChildAt:function(t){return this.children.indexOf(t)},removeChild:function(t){var e=this.children.indexOf(t);if(-1!=e){this.children.splice(e,1);var i=tm.event.Event("removed");t.dispatchEvent(i)}},removeChildren:function(t){t=t||0;for(var e=this.children.slice(),i=t,n=e.length;n>i;++i)e[i].remove();this.children=[]},getChildByName:function(t){for(var e=0,i=this.children.length;i>e;++e)if(this.children[e].name==t)return this.children[e];return null},execChildren:function(t,e){e=e&&e.length?e:[e];for(var i=this.children.slice(),n=0,s=i.length;s>n;++n)t.apply(i[n],e)},getParent:function(){return this.parent},getRoot:function(){if(!this.parent)return null;var t=null;for(t=this.parent;null!=t.parent;t=t.parent);return t},fromJSON:function(e){for(var i in e){var n=e[i];if("children"==i)for(var s=0,r=n.length;r>s;++s){var e=n[s],o=e.init||[],a=t[e.type]?t[e.type]:e.type,h=tm.using(a);console.assert(0!==Object.keys(h).length,h+" is not defined.");var u=h.apply(null,o).addChildTo(this);u.fromJSON(e),this[e.name]=u}else this[i]=n}return this}});var t={Sprite:"tm.display.Sprite",Label:"tm.display.Label",Shape:"tm.display.Shape",CircleShape:"tm.display.CircleShape",TriangleShape:"tm.display.TriangleShape",RectangleShape:"tm.display.RectangleShape",StarShape:"tm.display.StarShape",PolygonShape:"tm.display.PolygonShape",HeartShape:"tm.display.HeartShape",AnimationSprite:"tm.display.AnimationSprite",LabelButton:"tm.ui.LabelButton",IconButton:"tm.ui.IconButton",GlossyButton:"tm.ui.GlossyButton",FlatButton:"tm.ui.FlatButton"}}(),function(){tm.define("tm.app.Object2D",{superClass:"tm.app.Element",position:null,scale:null,rotation:0,_width:64,_height:64,init:function(){this.superInit(),this.position=tm.geom.Vector2(0,0),this.scale=tm.geom.Vector2(1,1),this.pointing=tm.geom.Vector2(0,0),this.origin=tm.geom.Vector2(.5,.5),this._matrix=tm.geom.Matrix33(),this._matrix.identity(),this.boundingType="circle",this.interactive=!1,this.hitFlags=[],this.downFlags=[],this._worldMatrix=tm.geom.Matrix33(),this._worldMatrix.identity(),this._worldAlpha=1},getFinalMatrix:function(){var t=tm.geom.Matrix33();return this.parent&&t.multiply(this.parent.getFinalMatrix()),t.translate(this.centerX,this.centerY),t.rotateZ(this.rotation*Math.DEG_TO_RAD),t.scale(this.scaleX,this.scaleY),t},isHitPoint:function(t,e){var i=this.globalToLocal(tm.geom.Vector2(t,e));return this.pointing.x=i.x,this.pointing.y=i.y,i.x*i.x+i.y*i.yi*i+n*n?!0:!1},isHitPointRect:function(t,e){var i=this.x-this.width*this.originX,n=this.x+this.width*(1-this.originX),s=this.y-this.height*this.originY,r=this.y+this.height*(1-this.originY);return t>i&&n>t&&e>s&&r>e?!0:!1},isHitPointCircleHierarchy:function(t,e){var i=this.globalToLocal(tm.geom.Vector2(t,e));return this.pointing.x=i.x,this.pointing.y=i.y,i.x*i.x+i.y*i.yn&&s>i.x&&i.y>r&&o>i.y?!0:!1},isHitElement:function(t){return this.parent.localToGlobal(this),(this.x-t.x)*(this.x-t.x)+(this.y-t.y)*(this.y-t.y)<(this.radius+t.radius)*(this.radius+t.radius)?!0:!1},isHitElementCircle:function(t){return tm.collision.testCircleCircle(this.getBoundingCircle(),t.getBoundingCircle())},isHitElementRect:function(t){return tm.collision.testRectRect(this.getBoundingRect(),t.getBoundingRect())},getBoundingCircle:function(){return tm.geom.Circle(this.centerX,this.centerY,this.radius)},getBoundingRect:function(){return tm.geom.Rect(this.left,this.top,this.width,this.height)},localToGlobal:function(t){return this.getFinalMatrix().multiplyVector2(t)},globalToLocal:function(t){var e=this._worldMatrix.clone();return e.invert(),e.transpose(),e.multiplyVector2(t)},setX:function(t){return this.position.x=t,this},setY:function(t){return this.position.y=t,this},setPosition:function(t,e){return this.position.x=t,this.position.y=e,this},setRotation:function(t){return this.rotation=t,this},setScale:function(t,e){return this.scale.x=t,this.scale.y=1>=arguments.length?t:e,this},setOrigin:function(t,e){return this.origin.x=t,this.origin.y=e,this},setWidth:function(t){return this.width=t,this},setHeight:function(t){return this.height=t,this},setSize:function(t,e){return this.width=t,this.height=e,this},wakeUp:function(){return this.isUpdate=!0,this},sleep:function(){return this.isUpdate=!1,this},setInteractive:function(t){return this.interactive=t,this},setBoundingType:function(t){return this.boundingType=t,this},_update:function(t){if(0!=this.isUpdate){if(this.update&&this.update(t),this.hasEventListener("enterframe")){var e=tm.event.Event("enterframe");e.app=t,this.dispatchEvent(e)}if(this.interactive&&this._checkPointing(t),this.children.length>0)for(var i=this.children.slice(),n=0,s=i.length;s>n;++n)i[n]._update(t)}},_checkPointing:function(){console.assert(!1)},_checkMouse:function(t){this.__checkPointing(t,t.pointing,0)},_checkTouch:function(t){this.__checkPointing(t,t.pointing,0)},__checkPointing:function(t,e,i){this.element;var n=this.hitFlags[i];this.hitFlags[i]=this.isHitPoint(e.x,e.y),!n&&this.hitFlags[i]&&this._dispatchPointingEvent("mouseover","touchover","pointingover",t,e),n&&!this.hitFlags[i]&&this._dispatchPointingEvent("mouseout","touchout","pointingout",t,e),this.hitFlags[i]&&e.getPointingStart()&&(this._dispatchPointingEvent("mousedown","touchstart","pointingstart",t,e),this.downFlags[i]=!0),this.downFlags[i]&&this._dispatchPointingEvent("mousemove","touchmove","pointingmove",t,e),1==this.downFlags[i]&&e.getPointingEnd()&&(this._dispatchPointingEvent("mouseup","touchend","pointingend",t,e),this.downFlags[i]=!1)},_dispatchPointingEvent:function(t,e,i,n,s){this.dispatchEvent(tm.event.MouseEvent(t,n,s)),this.dispatchEvent(tm.event.TouchEvent(e,n,s)),this.dispatchEvent(tm.event.PointingEvent(i,n,s))},_calcWorldMatrix:function(){if(this.parent){if(this.rotation!=this.rotationCache){this.rotationCache=this.rotation;var t=this.rotation*Math.DEG_TO_RAD;this._sr=Math.sin(t),this._cr=Math.cos(t)}var e=this._matrix.m,i=this.parent._worldMatrix.m,n=this._worldMatrix.m;e[0]=this._cr*this.scale.x,e[1]=-this._sr*this.scale.y,e[3]=this._sr*this.scale.x,e[4]=this._cr*this.scale.y,e[2]=this.position.x,e[5]=this.position.y;var s=e[0],r=e[1],o=e[2],a=e[3],h=e[4],u=e[5],c=i[0],l=i[1],m=i[2],d=i[3],f=i[4],p=i[5];n[0]=c*s+l*a,n[1]=c*r+l*h,n[2]=c*o+l*u+m,n[3]=d*s+f*a,n[4]=d*r+f*h,n[5]=d*o+f*u+p}},_dirtyCalc:function(){this._calcWorldMatrix()}}),tm.app.Object2D.prototype.accessor("x",{get:function(){return this.position.x},set:function(t){this.position.x=t}}),tm.app.Object2D.prototype.accessor("y",{get:function(){return this.position.y},set:function(t){this.position.y=t}}),tm.app.Object2D.prototype.accessor("originX",{get:function(){return this.origin.x},set:function(t){this.origin.x=t}}),tm.app.Object2D.prototype.accessor("originY",{get:function(){return this.origin.y},set:function(t){this.origin.y=t}}),tm.app.Object2D.prototype.accessor("scaleX",{get:function(){return this.scale.x},set:function(t){this.scale.x=t}}),tm.app.Object2D.prototype.accessor("scaleY",{get:function(){return this.scale.y},set:function(t){this.scale.y=t}}),tm.app.Object2D.prototype.accessor("width",{get:function(){return this._width},set:function(t){this._width=t}}),tm.app.Object2D.prototype.accessor("height",{get:function(){return this._height},set:function(t){this._height=t}}),tm.app.Object2D.prototype.accessor("radius",{get:function(){return this._radius||(this.width+this.height)/4},set:function(t){this._radius=t}}),tm.app.Object2D.prototype.getter("top",function(){return this.y-this.height*this.originY}),tm.app.Object2D.prototype.getter("right",function(){return this.x+this.width*(1-this.originX)}),tm.app.Object2D.prototype.getter("bottom",function(){return this.y+this.height*(1-this.originY)}),tm.app.Object2D.prototype.getter("left",function(){return this.x-this.width*this.originX}),tm.app.Object2D.prototype.accessor("centerX",{get:function(){return this.x+this.width/2-this.width*this.originX},set:function(){}}),tm.app.Object2D.prototype.accessor("centerY",{get:function(){return this.y+this.height/2-this.height*this.originY},set:function(){}}),tm.app.Object2D.prototype.accessor("boundingType",{get:function(){return this._boundingType},set:function(t){this._boundingType=t,this._setIsHitFunc()}}),tm.app.Object2D.prototype.accessor("checkHierarchy",{get:function(){return this._checkHierarchy},set:function(t){this._checkHierarchy=t,this._setIsHitFunc()}});var t={rect:tm.app.Object2D.prototype.isHitPointRect,circle:tm.app.Object2D.prototype.isHitPointCircle,"true":function(){return!0},"false":function(){return!1}},e={rect:tm.app.Object2D.prototype.isHitPointRectHierarchy,circle:tm.app.Object2D.prototype.isHitPointCircleHierarchy,"true":function(){return!0},"false":function(){return!1}},i={rect:tm.app.Object2D.prototype.isHitElementRect,circle:tm.app.Object2D.prototype.isHitElementCircle,"true":function(){return!0},"false":function(){return!1}};tm.app.Object2D.prototype._setIsHitFunc=function(){var n=this.checkHierarchy?e:t,s=this.boundingType;n[s]?n[s]:n["true"],this.isHitPoint=n[s]?n[s]:n["true"],this.isHitElement=i[s]?i[s]:i["true"]},tm.app.Object2D.prototype._checkPointing=tm.isMobile?tm.app.Object2D.prototype._checkTouch:tm.app.Object2D.prototype._checkMouse}(),tm.app=tm.app||{},function(){tm.app.Scene=tm.createClass({superClass:tm.app.Object2D,_sceneResultCallback:null,init:function(){this.superInit(),this.boundingType="none",this.setInteractive(!0)}})}(),function(){var t={title:"Time is money",titleSize:32,width:465,height:465};tm.app.TitleScene=tm.createClass({superClass:tm.app.Scene,init:function(e){if(this.superInit(),e={}.$extend(t,e),e.backgroundImage){var i=tm.asset.Manager.get(e.backgroundImage);this._backgroundImage=tm.display.Sprite(i,e.width,e.height),this._backgroundImage.originX=this._backgroundImage.originY=0,this.addChild(this._backgroundImage)}var n=tm.display.Label(e.title);n.x=e.width/2,n.y=e.height/2,n.width=e.width,n.align="center",n.baseline="middle",n.fontSize=e.titleSize,this.addChild(n)},onpointingstart:function(){var t=tm.event.Event("nextscene");this.dispatchEvent(t)}})}(),function(){var t={score:256,msg:"tmlib.js のサンプルです!",hashtags:"tmlibjs",url:"https://github.com/phi1618/tmlib.js/",width:465,height:465,related:"tmlib.js tmlife javascript"};tm.app.ResultScene=tm.createClass({superClass:tm.app.Scene,init:function(e){this.superInit(),e={}.$extend(t,e);var i="SCORE: {score}, {msg}".format(e),n=this.tweetURL=tm.social.Twitter.createURL({type:"tweet",text:i,hashtags:e.hashtags,url:e.url});if(e.backgroundImage){var s=tm.asset.Manager.get(e.backgroundImage);this._backgroundImage=tm.display.Sprite(s,e.width,e.height),this._backgroundImage.originX=this._backgroundImage.originY=0,this.addChild(this._backgroundImage)}var r=tm.display.Label("SCORE: {score}".format(e));r.x=e.width/2,r.y=e.height/2-70,r.width=e.width,r.align="center",r.baseline="middle",r.fontSize=32,this.addChild(r);var o=tm.display.Label(e.msg);o.x=e.width/2,o.y=e.height/2-20,o.width=e.width,o.align="center",o.baseline="middle",o.fontSize=16,this.addChild(o);var a=this.tweetButton=tm.ui.GlossyButton(120,50,"blue","Tweet").addChildTo(this);a.setPosition(e.width/2-65,e.height/2+50),a.onclick=function(){window.open(n)};var h=tm.ui.GlossyButton(120,50,"black","Back").addChildTo(this);h.setPosition(e.width/2+65,e.height/2+50),h.onpointingstart=function(){var t=tm.event.Event("nextscene");this.dispatchEvent(t)}.bind(this)}})}(),tm.app=tm.app||{},function(){tm.app.Collision=tm.createClass({element:null,collideList:null,init:function(t){this.element=t,this.collideList=[]},update:function(){for(var t=this.collideList.clone(),e=this.element,i=0,n=t.length;n>i;++i){var s=t[i];if(e.isHitElement(s.element)){if(s.collide===!1){var r=tm.event.Event("collisionenter");r.other=s.element,e.dispatchEvent(r)}var r=tm.event.Event("collisionstay");r.other=s.element,e.dispatchEvent(r),s.collide=!0}else{if(1==s.collide){var r=tm.event.Event("collisionexit");r.other=s.element,e.dispatchEvent(r)}s.collide=!1}}},add:function(t){this.collideList.push({element:t,collide:!1})},remove:function(t){this.collideList.eraseIf(function(e){return e.element==t})}}),tm.app.Element.prototype.getter("collision",function(){return this._collision||(this._collision=tm.app.Collision(this),this.addEventListener("enterframe",function(t){this._collision.update(t.app)})),this._collision})}(),function(){tm.define("tm.app.Tweener",{superClass:"tm.event.EventDispatcher",init:function(t){this.superInit(),this.setTarget(t),this.loop=!1,this._init()},_init:function(){this._index=0,this._tasks=[],this._func=this._updateTask,this.isPlaying=!0},setTarget:function(t){this._fn&&this.element.removeEventListener("enterframe",this._fn),this.element=t,this._fn=function(t){this.update(t.app)}.bind(this),this.element.addEventListener("enterframe",this._fn)},update:function(t){return this._func(t),void 0},_updateTask:function(t){if(this.isPlaying){var e=this._tasks[this._index];if(!e)return this.loop===!0?this._index=0:this.isPlaying=!1,void 0;if(this._index++,"tween"==e.type){e.data;var i=e.data.type,n=e.data.args;this._tween=tm.anim.Tween(),this._tween[i].apply(this._tween,n),this._func=this._updateTween,this._func(t)}else"wait"==e.type?(this._wait=e.data,this._wait.time=0,this._func=this._updateWait,this._func(t)):"call"==e.type?(e.data.func.apply(null,e.data.args),this._updateTask(t)):"set"==e.type&&(this.element.$extend(e.data.values),this._updateTask(t))}},_updateTween:function(t){var e=this._tween,i=e.time+1e3/t.fps;e._setTime(i),e.time>=e.duration?(delete this._tween,this._tween=null,this._func=this._updateTask):e.update()},_updateWait:function(t){var e=this._wait;e.time+=1e3/t.fps,e.time>=e.limit&&(delete this._wait,this._wait=null,this._func=this._updateTask)},add:function(t){if(t.target||(t.target=this.element),this._tasks.push({type:"tween",data:t}),0==this.isAnimation){this.isAnimation=!0;var e=tm.event.Event("animationstart");this.element.dispatchEvent(e)}return this},by:function(t,e,i){return this._addTweenTask({props:t,duration:e,fn:i,type:"by"}),this},to:function(t,e,i){return this._addTweenTask({props:t,duration:e,fn:i,type:"to"}),this},move:function(t,e,i,n){return this.to({x:t,y:e},i,n)},moveBy:function(t,e,i,n){return this.by({x:t,y:e},i,n)},rotate:function(t,e,i){return this.to({rotation:t},e,i)},scale:function(t,e,i){return this.to({scaleX:t,scaleY:t},e,i)},fade:function(t,e){return this.to({alpha:t},e),this},fadeIn:function(t){return this.fade(1,t),this},fadeOut:function(t){return this.fade(0,t),this},_addTweenTask:function(t){if(t.target=void 0!==t.target?t.target:this.element,t.duration=void 0!==t.duration?t.duration:1e3,this._tasks.push({type:"tween",data:{args:[t.target,t.props,t.duration,t.fn],type:t.type}}),0==this.isAnimation){this.isAnimation=!0;var e=tm.event.Event("animationstart");this.element.dispatchEvent(e)}return this},wait:function(t){return this._tasks.push({type:"wait",data:{limit:t}}),this},call:function(t,e){return this._tasks.push({type:"call",data:{func:t,args:e}}),this},set:function(t,e){var i=null;return 2==arguments.length?(i={},i[t]=e):i=t,this._tasks.push({type:"set",data:{values:i}}),this},play:function(){return this.isPlaying=!0,this},pause:function(){return this.isPlaying=!1,this},rewind:function(){return this._func=this._updateTask,this._index=0,this.play(),this},setLoop:function(t){return this.loop=t,this},clear:function(){return this._init(),this}}),tm.app.Element.prototype.getter("tweener",function(){return this._tweener||(this._tweener=tm.app.Tweener(this)),this._tweener})}(),tm.namespace("tm.app",function(){tm.define("tm.app.Timeline",{superClass:"tm.event.EventDispatcher",init:function(t){this.superInit(),this.setTarget(t),this.fps=30,this.currentFrame=0,this.duration=0,this.isPlay=!0,this._tweens=[],this._actions=[]},update:function(){this.isPlay&&(this.currentFrame>this.duration||(this._updateTween(),this._updateAction()),this.currentFrame++)},_updateTween:function(){for(var t=this._tweens,e=0,i=t.length;i>e;++e){var n=t[e];if(!(n.delay>this.currentFrame)){var s=this.currentFrame-n.delay;n._setTime(s),n.time>=n.duration||n.update()}}},_updateAction:function(){for(var t=this._actions,e=0,i=t.length;i>e;++e){var n=t[e];if(n.delay==this.currentFrame)if("call"==n.type)n.func();else if("set"==n.type){var s=n.props;for(var r in s)this.element[r]=s[r]}}},to:function(t,e,i,n){return this._addTween({props:t,duration:e,fn:n,delay:i}),this},by:function(t,e,i,n){for(var s in t)t[s]+=this.element[s]||0;return this._addTween({props:t,duration:e,fn:n,delay:i}),this},call:function(t,e){return this._addAction({type:"call",func:t,delay:e}),this},set:function(t,e){return this._addAction({type:"set",props:t,delay:e}),this},setTarget:function(t){this._fn&&this.element.removeEventListener("enterframe",this._fn),this.element=t,this._fn=function(t){this.update(t.app)}.bind(this),this.element.addEventListener("enterframe",this._fn)},getTarget:function(){return this.element},gotoAndPlay:function(t){this.isPlay=!0,this.currentFrame=t,this._updateTween()},gotoAndStop:function(t){this.currentFrame=t,this.isPlay=!1,this._updateTween()},_addTween:function(t){t.duration=t.duration||1e3,t.duration=this._dirty(t.duration),t.delay=t.delay||0,t.delay=this._dirty(t.delay);var e=tm.anim.Tween();e.to(this.element,t.props,t.duration,t.fn),e.delay=t.delay,this._tweens.push(e),this._updateDuration(e)},_addAction:function(t){t.delay=t.delay||0,t.delay=this._dirty(t.delay),this._actions.push(t),this._updateDuration(t)},_updateDuration:function(t){var e=t.delay+(t.duration?t.duration:0);return e>this.duration&&(this.duration=e),this},_dirty:function(t){return(t/this.fps).toInt() },load:function(t){for(var e in t.timeline)t.timeline[e];return this},clear:function(){return this.currentFrame=0,this.duration=0,this.isPlay=!0,this._tweens=[],this._actions=[],this}}),tm.app.Element.prototype.getter("timeline",function(){return this._timeline||(this._timeline=tm.app.Timeline(this)),this._timeline})}),tm.display=tm.display||{},function(){tm.display.CanvasApp=tm.createClass({superClass:tm.app.BaseApp,init:function(t){this.element=t instanceof HTMLCanvasElement?t:"string"==typeof t?document.querySelector(t):document.createElement("canvas"),this.superInit(this.element),this.canvas=tm.graphics.Canvas(this.element),this.renderer=tm.display.CanvasRenderer(this.canvas),this.background="black",this._scenes=[tm.app.Scene()]},resize:function(t,e){return this.width=t,this.height=e,this},resizeWindow:function(){return this.width=innerWidth,this.height=innerHeight,this},fitWindow:function(t){return this.canvas.fitWindow(t),this.mouse._mousemove=this.mouse._mousemoveScale,this.touch._touchmove=this.touch._touchmoveScale,this},_draw:function(){this.canvas.clearColor(this.background,0,0),this.canvas.fillStyle="white",this.canvas.strokeStyle="white",this.canvas.save();for(var t=0,e=this._scenes.length;e>t;++t)this.renderer.render(this._scenes[t]);this.canvas.restore()}}),tm.display.CanvasApp.prototype.accessor("width",{get:function(){return this.canvas.width},set:function(t){this.canvas.width=t}}),tm.display.CanvasApp.prototype.accessor("height",{get:function(){return this.canvas.height},set:function(t){this.canvas.height=t}})}(),tm.display=tm.display||{},function(){tm.display.CanvasElement=tm.createClass({superClass:tm.app.Object2D,isUpdate:!0,visible:!0,fillStyle:"white",strokeStyle:"white",alpha:1,blendMode:"source-over",shadowColor:"black",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:0,init:function(){this.superInit()},setAlpha:function(t){return this.alpha=t,this},setShadowColor:function(t){return this.shadowColor=t,this},setShadowBlur:function(t){return this.shadowBlur=t,this},setShadowOffset:function(t,e){return this.shadowOffsetX=t,this.shadowOffsetY=e,this},drawBoundingCircle:function(t){t.save(),t.lineWidth=2,t.strokeCircle(0,0,this.radius),t.restore()},drawBoundingRect:function(t){t.save(),t.lineWidth=2,t.strokeRect(-this.width*this.originX,-this.height*this.originY,this.width,this.height),t.restore()},drawFillRect:function(t){return t.fillRect(-this.width/2,-this.height/2,this.width,this.height),this},drawStrokeRect:function(t){return t.strokeRect(-this.width/2,-this.height/2,this.width,this.height),this},drawFillArc:function(t){return t.beginPath(),t.arc(0,0,this.radius,0,2*Math.PI,!1),t.fill(),t.closePath(),this},drawStrokeArc:function(t){return t.beginPath(),t.arc(0,0,this.radius,0,2*Math.PI,!1),t.stroke(),t.closePath(),this},show:function(){return this.visible=!0,this},hide:function(){return this.visible=!1,this},setFillStyle:function(t){return this.fillStyle=t,this},setStrokeStyle:function(t){return this.strokeStyle=t,this},setBlendMode:function(t){return this.blendMode=t,this},load:function(t){var e=this;t.layers.forEach(function(t){if("objectgroup"==t.type){var i=tm.display.CanvasElement().addChildTo(e);i.width=t.width,i.height=t.height,t.objects.forEach(function(t){var e=tm.using(t.type);0===Object.keys(e).length&&(e=tm.display[t.type]);var n=null;t.properties.init&&(n=JSON.parse(t.properties.init));var s=e.apply(null,n).addChildTo(i),r=t.properties;for(var o in r)if("init"!=o){var a=r[o];s[o]=a}s.x=t.x,s.y=t.y,s.width=t.width,s.height=t.height}),e[t.name]=i}})},fromJSON:function(t){for(var e in t){var i=t[e];if("children"==e)for(var n=0,s=i.length;s>n;++n){var t=i[n],r=t.init||[],o=tm.using(t.type);0===Object.keys(o).length&&(o=tm.display[t.type]);var a=o.apply(null,r).addChildTo(this);a.fromJSON(t),this[t.name]=a}else this[e]=i}return this},toJSON:function(){},_calcAlpha:function(){return this.parent?(this._worldAlpha=this.parent._worldAlpha*this.alpha,void 0):(this._worldAlpha=this.alpha,void 0)},_dirtyCalc:function(){this._calcAlpha(),this._calcWorldMatrix()}})}(),tm.display=tm.display||{},function(){tm.display.Sprite=tm.createClass({superClass:tm.display.CanvasElement,init:function(t,e,i){if(this.superInit(),console.assert("number"!=typeof t,"Sprite の第一引数はテクスチャもしくはテクスチャ名に変わりました"),this.srcRect=tm.geom.Rect(0,0,64,64),1==arguments.length){var t=arguments[0];"string"==typeof t&&(t=tm.asset.Manager.get(t)),console.assert(null!=t,"don't find '"+t+"' as image."),this.width=t.width,this.height=t.height,this.image=t}else e=e||64,i=i||64,this.width=e,this.height=i,t&&(this.image=t)},setFrameIndex:function(t,e){var i=e||this.width,n=e||this.height,s=~~(this.image.width/i),r=t%s,o=~~(t/s);return this.srcRect.x=r*i,this.srcRect.y=o*n,this.srcRect.width=i,this.srcRect.height=n,this},_refreshSize:function(){}}),tm.display.Sprite.prototype.accessor("image",{get:function(){return this._image},set:function(t){if("string"==typeof t){var e=t;t=tm.asset.Manager.get(e),console.assert(null!=t,"don't find '"+e+"' as image.")}this._image=t,this.srcRect.x=0,this.srcRect.y=0,this.srcRect.width=t.element.width,this.srcRect.height=t.element.height}})}(),tm.display=tm.display||{},function(){tm.display.Shape=tm.createClass({superClass:tm.display.CanvasElement,init:function(t,e){this.superInit(),t=t||64,e=e||64,this.canvas=tm.graphics.Canvas(),this.width=t,this.height=e,this.canvas.resize(t,e)},renderCircle:function(t){var e=this.canvas;t={}.$extend(tm.display.Shape.DEFAULT_SHAPE_PARAM_CIRCLE,t),e.save(),e.fillStyle=t.fillStyle,e.strokeStyle=t.strokeStyle,e.lineWidth=t.lineWidth,e.fillCircle(this.width/2,this.height/2,this.radius),e.strokeCircle(this.width/2,this.height/2,this.radius-Number(e.lineWidth)/2),e.restore()},renderTriangle:function(t){var e=this.canvas;t={}.$extend(tm.display.Shape.DEFAULT_SHAPE_PARAM_TRIANGLE,t),e.save(),e.fillStyle=t.fillStyle,e.strokeStyle=t.strokeStyle,e.lineWidth=t.lineWidth,e.fillPolygon(this.width/2,this.height/2,this.radius,3),e.strokePolygon(this.width/2,this.height/2,this.radius-Number(e.lineWidth)/2,3),e.restore()},renderRectangle:function(t){var e=this.canvas;t={}.$extend(tm.display.Shape.DEFAULT_SHAPE_PARAM_RECTANGLE,t),e.save(),e.fillStyle=t.fillStyle,e.strokeStyle=t.strokeStyle,e.lineWidth=t.lineWidth;var i=Number(e.lineWidth),n=i/2;e.fillRect(0,0,this.width,this.height),e.strokeRect(n,n,this.width-i,this.height-i),e.restore()},renderRoundRectangle:function(t){var e=this.canvas;t={}.$extend(tm.display.Shape.DEFAULT_SHAPE_PARAM_ROUND_RECTANGLE,t),e.save(),e.fillStyle=t.fillStyle,e.strokeStyle=t.strokeStyle,e.lineWidth=t.lineWidth;var i=Number(e.lineWidth),n=i/2;e.fillRoundRect(0,0,this.width,this.height,t.radius),e.strokeRoundRect(n,n,this.width-i,this.height-i,t.radius),e.restore()},renderStar:function(t){var e=this.canvas;t={}.$extend(tm.display.Shape.DEFAULT_SHAPE_PARAM_STAR,t),e.save(),e.fillStyle=t.fillStyle,e.strokeStyle=t.strokeStyle,e.lineWidth=t.lineWidth,Number(e.lineWidth);var i=t.sides,n=t.sideIndent,s=t.offsetAngle;e.fillStar(this.width/2,this.height/2,this.radius,i,n,s),e.strokeStar(this.width/2,this.height/2,this.radius-Number(e.lineWidth)/2,i,n,s),e.restore()},renderPolygon:function(t){var e=this.canvas;t={}.$extend(tm.display.Shape.DEFAULT_SHAPE_PARAM_POLYGON,t),e.save(),e.fillStyle=t.fillStyle,e.strokeStyle=t.strokeStyle,e.lineWidth=t.lineWidth,e.textAlign="center",e.textBaseline="middle",Number(e.lineWidth);var i=t.sides;t.sideIndent;var n=t.offsetAngle;e.fillPolygon(this.width/2,this.height/2,this.radius,i,n),e.strokePolygon(this.width/2,this.height/2,this.radius-Number(e.lineWidth)/2,i,n),e.restore()},renderHeart:function(t){var e=this.canvas;t={}.$extend(tm.display.Shape.DEFAULT_SHAPE_PARAM_HEART,t),e.save(),e.fillStyle=t.fillStyle,e.strokeStyle=t.strokeStyle,e.lineWidth=t.lineWidth,e.fillHeart(this.width/2,this.height/2,this.radius,t.angle),e.strokeHeart(this.width/2,this.height/2,this.radius-Number(e.lineWidth)/2,t.angle),e.restore()},renderText:function(t){var e=this.canvas;t={}.$extend(tm.display.Shape.DEFAULT_SHAPE_PARAM_TEXT,t),e.save(),e.fillStyle=t.fillStyle,e.strokeStyle=t.strokeStyle,e.lineWidth=t.lineWidth,e.font=t.font,e.textAlign=t.textAlign,e.textBaseline=t.textBaseline,e.strokeText(t.text,this.width/2,this.height/2),e.fillText(t.text,this.width/2,this.height/2),e.restore()}}),tm.display.Shape.DEFAULT_SHAPE_PARAM_CIRCLE={fillStyle:"red",strokeStyle:"white",lineWidth:"2"},tm.display.Shape.DEFAULT_SHAPE_PARAM_TRIANGLE={fillStyle:"green",strokeStyle:"white",lineWidth:"2"},tm.display.Shape.DEFAULT_SHAPE_PARAM_RECTANGLE={fillStyle:"blue",strokeStyle:"white",lineWidth:"2"},tm.display.Shape.DEFAULT_SHAPE_PARAM_ROUND_RECTANGLE={fillStyle:"blue",strokeStyle:"white",lineWidth:"2",radius:10},tm.display.Shape.DEFAULT_SHAPE_PARAM_STAR={fillStyle:"yellow",strokeStyle:"white",lineWidth:"2",sides:5,sideIndent:void 0,offsetAngle:void 0},tm.display.Shape.DEFAULT_SHAPE_PARAM_POLYGON={fillStyle:"cyan",strokeStyle:"white",lineWidth:"2",sides:5,offsetAngle:void 0},tm.display.Shape.DEFAULT_SHAPE_PARAM_HEART={fillStyle:"pink",strokeStyle:"white",lineWidth:"2",angle:45},tm.display.Shape.DEFAULT_SHAPE_PARAM_TEXT={text:"hello, world",fillStyle:"pink",strokeStyle:"white",lineWidth:"1",textAlign:"center",textBaseline:"middle",font:"24px 'Consolas', 'Monaco', 'MS ゴシック'"}}(),function(){tm.display.CircleShape=tm.createClass({superClass:tm.display.Shape,init:function(t,e,i){this.superInit(t,e),this.renderCircle(i)}})}(),function(){tm.display.TriangleShape=tm.createClass({superClass:tm.display.Shape,init:function(t,e,i){this.superInit(t,e),this.renderTriangle(i)}})}(),function(){tm.display.RectangleShape=tm.createClass({superClass:tm.display.Shape,init:function(t,e,i){this.superInit(t,e),this.renderRectangle(i)}})}(),function(){tm.display.RoundRectangleShape=tm.createClass({superClass:tm.display.Shape,init:function(t,e,i){this.superInit(t,e),this.renderRoundRectangle(i)}})}(),function(){tm.display.StarShape=tm.createClass({superClass:tm.display.Shape,init:function(t,e,i){this.superInit(t,e),this.renderStar(i)}})}(),function(){tm.display.PolygonShape=tm.createClass({superClass:tm.display.Shape,init:function(t,e,i){this.superInit(t,e),this.renderPolygon(i)}})}(),function(){tm.display.HeartShape=tm.createClass({superClass:tm.display.Shape,init:function(t,e,i){this.superInit(t,e),this.renderHeart(i)}})}(),function(){tm.define("tm.display.TextShape",{superClass:"tm.display.Shape",init:function(t,e,i){this.superInit(t,e),this.renderText(i)}})}(),tm.display=tm.display||{},function(){var t=null,e=null;tm.display.Label=tm.createClass({superClass:tm.display.CanvasElement,fill:!0,stroke:!1,debugBox:!1,init:function(t,e){this.superInit(),this.text=t||"",this._fontSize=e||24,this._fontFamily="'Consolas', 'Monaco', 'MS ゴシック'",this._fontWeight="",this._lineHeight=1.2,this._updateFont(),this.align="start",this.baseline="alphabetic",this.maxWidth=null},setAlign:function(t){return this.align=t,this},setBaseline:function(t){return this.baseline=t,this},setFontSize:function(t){return this.fontSize=t,this},setFontFamily:function(t){return this.fontFamily=t,this},setFontWeight:function(t){return this.fontWeight=t,this},_updateFont:function(){this.fontStyle="{fontWeight} {fontSize}px {fontFamily}".format(this),t||(t=document.createElement("canvas"),e=t.getContext("2d")),e.font=this.fontStyle,this.textSize=e.measureText("あ").width*this.lineHeight},_updateLines:function(){this._lines=(this._text+"").split("\n")}}),tm.display.Label.prototype.accessor("text",{get:function(){return this._text},set:function(t){this._text=null==t||void 0==t?"":t,this._updateLines()}}),tm.display.Label.prototype.accessor("fontSize",{get:function(){return this._fontSize},set:function(t){this._fontSize=t,this._updateFont()}}),tm.display.Label.prototype.accessor("fontFamily",{get:function(){return this._fontFamily},set:function(t){this._fontFamily=t,this._updateFont()}}),tm.display.Label.prototype.accessor("fontWeight",{get:function(){return this._fontWeight},set:function(t){this._fontWeight=t,this._updateFont()}}),tm.display.Label.prototype.accessor("lineHeight",{get:function(){return this._lineHeight},set:function(t){this._lineHeight=t,this._updateFont()}})}(),tm.display=tm.display||{},function(){tm.display.AnimationSprite=tm.createClass({superClass:tm.display.CanvasElement,init:function(t,e,i){if(this.superInit(),"string"==typeof t){var t=tm.asset.Manager.get(t);console.assert(t,"not found "+t)}console.assert("object"==typeof t,"AnimationSprite の第一引数はスプライトシートもしくはスプライトシート名に変わりました"),this.ss=t,this.width=e||t.frame.width,this.height=i||t.frame.height,this.currentFrame=0,this.currentFrameIndex=0,this.paused=!0,this.currentAnimation=null,this.addEventListener("enterframe",function(t){this.paused||0!==t.app.frame%this.currentAnimation.frequency||this._updateFrame()})},draw:function(t){var e=this.ss.getFrame(this.currentFrame),i=this.ss.image.element;t.drawImage(i,e.x,e.y,e.width,e.height,-this.width*this.originX,-this.height*this.originY,this.width,this.height)},gotoAndPlay:function(t){return t=void 0!==t?t:"default",this.paused=!1,this.currentAnimation=this.ss.animations[t],this.currentFrame=0,this.currentFrameIndex=0,this._normalizeFrame(),this},gotoAndStop:function(t){return t=void 0!==t?t:"default",this.paused=!0,this.currentAnimation=this.ss.animations[t],this.currentFrame=0,this.currentFrameIndex=0,this._normalizeFrame(),this},_updateFrame:function(){this.currentFrameIndex+=1,this._normalizeFrame()},_normalizeFrame:function(){var t=this.currentAnimation;if(t)if(this.currentFrameIndex0)for(var n=t.children.slice(),s=0,r=n.length;r>s;++s)this.renderObject(n[s])}},_setRenderFunction:function(e){e.draw=e instanceof tm.display.Sprite?t.sprite:e instanceof tm.display.MapSprite?function(){}:e instanceof tm.display.Label?t.label:e instanceof tm.display.Shape?t.shape:function(){}}});var t={sprite:function(t){var e=this.srcRect,i=this._image.element;t.context.drawImage(i,e.x,e.y,e.width,e.height,-this.width*this.origin.x,-this.height*this.origin.y,this.width,this.height)},shape:function(t){this.srcRect,t.drawImage(this.canvas.canvas,0,0,this.canvas.width,this.canvas.height,-this.width*this.origin.x,-this.height*this.origin.y,this.width,this.height)},label:function(t){t.setText(this.fontStyle,this.align,this.baseline),this.fill&&(this.maxWidth?this._lines.each(function(e,i){t.fillText(e,0,this.textSize*i,this.maxWidth)}.bind(this)):this._lines.each(function(e,i){t.fillText(e,0,this.textSize*i)}.bind(this))),this.stroke&&(this.maxWidth?this._lines.each(function(e,i){t.strokeText(e,0,this.textSize*i,this.maxWidth)}.bind(this)):this._lines.each(function(e,i){t.strokeText(e,0,this.textSize*i)}.bind(this))),this.debugBox&&t.strokeRect(0,0,this.width,-this.size)}}}(),function(){tm.define("tm.display.BoundingRectRenderer",{superClass:"tm.display.CanvasRenderer",init:function(t){this.superInit(t)},_setRenderFunction:function(e){e.draw=t}});var t=function(t){t.save(),t.lineWidth=2,t.strokeRect(-this.width*this.originX,-this.height*this.originY,this.width,this.height),t.restore()}}(),tm.ui=tm.ui||{},function(){tm.ui.Pad=tm.createClass({superClass:tm.display.Shape,isTouching:!1,circle:null,init:function(){this.superInit(120,120);var t=this.canvas;t.fillStyle="#fff",t.fillCircle(60,60,60),t.fillStyle="#eee",this._createCircle(),this.setInteractive(!0),this.alpha=.75},_createCircle:function(){var t=this.circle=tm.display.Shape(80,80);this.addChild(t);var e=t.canvas;e.fillStyle="#222",e.setShadow("black",2,2,2),e.fillCircle(40,40,35)},onpointingstart:function(){this.isTouching=!0},onpointingend:function(){this.isTouching=!1,this.circle.position.set(0,0)},onpointingmove:function(t){if(0!=this.isTouching){var e=t.pointing,i=tm.geom.Vector2(e.x-this.x,e.y-this.y),n=i.length();i.div(n),n>40&&(n=40),this.angle=Math.radToDeg(i.toAngle()),this.circle.position.set(i.x*n,i.y*n),this.distance=n/40,this.direction=i.mul(this.distance)}}})}(),tm.ui=tm.ui||{},function(){tm.ui.LabelButton=tm.createClass({superClass:tm.display.Label,init:function(t){this.superInit(t),this.alpha=tm.ui.LabelButton.DEFAULT_ALPHA,this.setAlign("center").setBaseline("middle"),this.setInteractive(!0),this.boundingType="rect",this.addEventListener("pointingover",function(){this.tweener.clear(),this.tweener.fadeIn(250)}.bind(this)),this.addEventListener("pointingout",function(){this.tweener.clear(),this.tweener.fade(tm.ui.LabelButton.DEFAULT_ALPHA,250)}.bind(this))}}),tm.ui.LabelButton.DEFAULT_ALPHA=.5}(),function(){tm.ui.IconButton=tm.createClass({superClass:tm.display.Sprite,init:function(t){t?this.superInit(t,t.width,t.height):this.superInit(),this.alpha=tm.ui.IconButton.DEFAULT_ALPHA,this.setInteractive(!0),this.boundingType="rect",this.addEventListener("pointingover",function(){this.tweener.clear(),this.tweener.fade(1,250)}),this.addEventListener("pointingout",function(){this.tweener.clear(),this.tweener.fade(tm.ui.LabelButton.DEFAULT_ALPHA,250)})}}),tm.ui.IconButton.DEFAULT_ALPHA=.5}(),function(){tm.ui.GlossyButton=tm.createClass({superClass:tm.display.Shape,init:function(t,e,i,n){this.superInit(t,e),n=n||"Button",this.backgroundColor=i||"black",this.alpha=tm.ui.GlossyButton.DEFAULT_ALPHA,this.setInteractive(!0),this.boundingType="rect",this.addEventListener("pointingover",function(){this.tweener.clear(),this.tweener.fade(1,250)}),this.addEventListener("pointingout",function(){this.tweener.clear(),this.tweener.fade(tm.ui.GlossyButton.DEFAULT_ALPHA,250)}),this.label=tm.display.Label(n||"").addChildTo(this),this.label.setAlign("center").setBaseline("middle"),this._refresh()},setBackgroundColor:function(t){return this.backgroundColor=t,this._refresh(),this},_refresh:function(){var t=this.canvas;t.resize(this.width,this.height),t.fillStyle=this.backgroundColor,t.fillRoundRect(2,2,this.width-4,this.height-4,10),t.strokeStyle="rgba(100,100,100,0.75)",t.lineWidth=2,t.strokeRoundRect(2,2,this.width-4,this.height-4,10),t.roundRect(2,2,this.width-4,this.height-4,10),t.clip();var e=tm.graphics.LinearGradient(0,0,0,this.height);e.addColorStop(0,"rgba(255,255,255,0.9)"),e.addColorStop(.5,"rgba(255,255,255,0.5)"),e.addColorStop(.51,"rgba(255,255,255,0.2)"),e.addColorStop(1,"rgba(255,255,255,0.0)"),t.setGradient(e),t.fillRect(2,2,this.width-4,this.height-4,10),this.label.setSize(this.width,this.height)}}),tm.ui.GlossyButton.DEFAULT_ALPHA=.5}(),function(){tm.define("tm.ui.FlatButton",{superClass:tm.display.Shape,init:function(t){t.$safe({width:300,height:100,bgColor:"rgb(180, 180, 180)",text:"ABC",fontSize:50,fontFamily:"'ヒラギノ角ゴ Pro W3', 'Hiragino Kaku Gothic Pro', 'メイリオ', 'Meiryo', 'MS Pゴシック', 'MS PGothic', sans-serif"}),this.superInit(t.width,t.height),this.canvas.clearColor(t.bgColor),this.setInteractive(!0),this.setBoundingType("rect"),this.label=tm.display.Label(t.text).addChildTo(this),this.label.setFontSize(t.fontSize).setFontFamily(t.fontFamily).setAlign("center").setBaseline("middle")}})}(),function(){tm.define("tm.ui.MenuDialog",{superClass:tm.app.Scene,titleText:null,menu:null,descriptions:null,showExit:!1,title:null,selections:[],description:null,box:null,cursor:null,_selected:0,_opened:!1,_finished:!1,_screenWidth:0,_screenHeight:0,init:function(t){this.superInit(),this._screenWidth=t.screenWidth,this._screenHeight=t.screenHeight,this.titleText=t.title,this.menu=[].concat(t.menu),this._selected=~~t.defaultSelected,this.showExit=!!t.showExit,this.descriptions=t.menuDesctiptions?t.menuDesctiptions:[].concat(t.menu),this.showExit&&(this.menu.push("exit"),this.descriptions.push("前の画面へ戻ります"));var e=Math.max(50*(1+this.menu.length),50)+40;this.box=tm.display.RectangleShape(.8*this._screenWidth,e,{strokeStyle:"rgba(0,0,0,0)",fillStyle:"rgba(43,156,255, 0.8)"}).setPosition(.5*this._screenWidth,.5*this._screenHeight),this.box.width=1,this.box.height=1,this.box.setBoundingType("rect"),this.box.tweener.to({width:.8*this._screenWidth,height:e},200,"easeOutExpo").call(this._onOpen.bind(this)),this.box.addChildTo(this),this.description=tm.display.Label("",14).setAlign("center").setBaseline("middle").setPosition(.5*this._screenWidth,this._screenHeight-10).addChildTo(this)},_onOpen:function(){var t=this,e=.5*this._screenHeight-25*this.menu.length;this.title=tm.display.Label(this.titleText,30).setAlign("center").setBaseline("middle").setPosition(.5*this._screenWidth,e).addChildTo(this),this.cursor=this._createCursor(),this.selections=this.menu.map(function(t,i){var n=this;e+=50;var s=tm.ui.LabelButton(t).setPosition(.5*this._screenWidth,e).addChildTo(this);return s.interactive=!0,s.addEventListener("click",function(){if(n._selected===i)n.closeDialog(n._selected);else{n._selected=i;var t=tm.event.Event("menuselect");t.selectValue=n.menu[n._selected],t.selectIndex=i,n.dispatchEvent(t)}}),s.width=.7*this._screenWidth,s}.bind(this)),this.cursor.y=this.selections[this._selected].y,this._opened=!0,this.addEventListener("pointingend",function(e){var i=e.app.pointing;t.box.isHitPoint(i.x,i.y)||t.closeDialog(t._selected)});var i=tm.event.Event("menuopened");this.dispatchEvent(i)},_createCursor:function(){var t=tm.display.RectangleShape(.7*this._screenWidth,30,{strokeStyle:"rgba(0,0,0,0)",fillStyle:"rgba(12,79,138,1)"}).addChildTo(this);return t.x=.5*this._screenWidth,t.target=this._selected,t.update=function(){this.target!==this.parent._selected&&(this.target=this.parent._selected,this.tweener.clear(),this.tweener.to({y:this.parent.selections[this.parent._selected].y},200,"easeOutExpo"))},t},update:function(){this.description.text=this.descriptions[this._selected]},closeDialog:function(t){this._finished=!0;var e=tm.event.Event("menuselected");e.selectIndex=t,this.dispatchEvent(e),this.tweener.clear().wait(200).call(function(){this.cursor.remove(),this.title.remove(),this.selections.each(function(t){t.remove()}),this.box.tweener.clear(),this.box.tweener.to({width:1,height:1},200,"easeInExpo").call(function(){this.app.popScene();var e=tm.event.Event("menuclosed");e.selectIndex=t,this.dispatchEvent(e)}.bind(this))}.bind(this)),this.cursor.tweener.clear().call(function(){this.visible=!this.visible}.bind(this.cursor)).setLoop(!0)},draw:function(t){t.fillStyle="rgba(0,0,0,0.8)",t.fillRect(0,0,this._screenWidth,this._screenHeight)}})}(),function(){var t={bgColor:"rgba(255, 255, 255, 1.0)",penColor:"rgba(0, 0, 0, 1.0)",lineWidth:16};tm.define("tm.ui.Sketch",{superClass:"tm.display.Shape",init:function(e,i,n){this.superInit(e,i),n=n||{},n.$safe(t),this._setup(n)},_setup:function(t){var e=this;this.boundingType="rect",this.setInteractive(!0);var i=this.canvas.context;i.lineCap="round",i.lineJoin="round",i.miterLimit=10,this.bgColor=t.bgColor,this.penColor=t.penColor,this.lineWidth=t.lineWidth,this.on("pointingstart",function(t){var i=t.app.pointing;e._drawPoint(i.position)}),this.on("pointingmove",function(t){var i=t.app.pointing;e._drawLine(i.prevPosition,i.position)})},clear:function(){return this.canvas.clear(),this.canvas.clearColor(this.bgColor),this},_drawPoint:function(t){this.canvas.drawPoint(t.x-this.left,t.y-this.top)},_drawLine:function(t,e){this.canvas.drawLine(t.x-this.left,t.y-this.top,e.x-this.left,e.y-this.top)}}),tm.ui.Sketch.prototype.accessor("penColor",{get:function(){return this._penColor},set:function(t){this._penColor=t,this.canvas.strokeStyle=t}}),tm.ui.Sketch.prototype.accessor("bgColor",{get:function(){return this._bgColor},set:function(t){this._bgColor=t,this.clear()}}),tm.ui.Sketch.prototype.accessor("lineWidth",{get:function(){return this._lineWidth},set:function(t){this._lineWidth=t,this.canvas.lineWidth=t}})}(),function(){tm.ui.Gauge=tm.createClass({superClass:tm.display.CanvasElement,animationFlag:!0,animationTime:1e4,init:function(t){this.superInit(),t=t||{},t.$safe({width:300,height:25,color:"hsl(220, 100%, 50%)",bgColor:"#444",borderColor:"white",borderWidth:4}),this.$extend(t),this._reset()},isFull:function(){return this.targetProp===this._maxValue},isEmpty:function(){return 0==this.targetProp},_reset:function(){this.originX=0,this._value=100,this._value=this._maxValue=100},setValue:function(t){if(t=Math.clamp(t,0,this._maxValue),this._realValue=t,this._value!==t){if(this.fire(tm.event.Event("change")),this.isAnimation()){this.tweener.clear();var e=Math.abs(this._value-t)/100*this.animationTime;this.tweener.clear().to({_value:t},e).call(function(){this.fire(tm.event.Event("changed"))}.bind(this))}else this._value=t,this.fire(tm.event.Event("change")),this.fire(tm.event.Event("changed"));return this}},getValue:function(){return this.value},setPercent:function(t){return this.setValue(.01*this._maxValue*t)},getPercent:function(){return 100*(this._value/this._maxValue)},setRatio:function(){return this.setValue(this._maxValue*percent)},getRatio:function(){return this._value/this._maxValue},isAnimation:function(){return this.animationFlag},draw:function(t){t.save(),t.fillStyle=this.bgColor,t.fillRect(0,0,this.width,this.height),t.fillStyle=this.color,t.fillRect(0,0,this.width*this.getRatio(),this.height),t.strokeStyle=this.borderColor,t.lineWidth=this.borderWidth,t.strokeRect(0,0,this.width,this.height),t.restore()}}),tm.ui.Gauge.prototype.accessor("value",{get:function(){return this._value},set:function(t){this.setValue(t)}}),tm.ui.Gauge.prototype.accessor("percent",{get:function(){return this.getPercent()},set:function(t){this.setPercent(t)}}),tm.ui.Gauge.prototype.accessor("ratio",{get:function(){return this.getRatio()},set:function(t){this.setRatio(t)}})}(),function(){tm.define("tm.ui.FlatGauge",{superClass:"tm.ui.Gauge",init:function(t){this.superInit(t)},draw:function(t){t.save(),t.save(),t.roundRect(0,0,this.width,this.height,this.height/2),t.clip(),t.fillStyle=this.bgColor,t.fillRect(0,0,this.width,this.height),t.fillStyle=this.color,t.fillRect(0,0,this.width*this.getRatio(),this.height),t.restore(),t.strokeStyle=this.borderColor,t.lineWidth=this.borderWidth,t.strokeRoundRect(0,0,this.width,this.height,this.height/2),t.restore()}})}(),function(){tm.define("tm.ui.GlossyGauge",{superClass:"tm.ui.Gauge",init:function(t){t=t||{},t.borderWidth=t.borderWidth||2,this.superInit(t)},draw:function(t){t.save(),t.roundRect(0,0,this.width,this.height,this.height/2),t.clip(),t.fillStyle=this.bgColor,t.fillRect(0,0,this.width,this.height),t.fillStyle=this.color,t.fillRect(0,0,this.width*this.getRatio(),this.height);var e=tm.graphics.LinearGradient(0,0,0,this.height);e.addColorStop(0,"rgba(255,255,255,0.9)"),e.addColorStop(.5,"rgba(255,255,255,0.5)"),e.addColorStop(.51,"rgba(255,255,255,0.2)"),e.addColorStop(1,"rgba(255,255,255,0.0)"),t.setGradient(e),t.fillRect(0,0,this.width*this.getRatio(),this.height),t.restore(),t.lineWidth=this.borderWidth,t.strokeStyle=this.borderColor,t.strokeRoundRect(0,0,this.width,this.height,this.height/2)}})}(),function(){var t={width:465,height:465};tm.define("tm.ui.LoadingScene",{superClass:"tm.app.Scene",init:function(e){this.superInit(),e={}.$extend(t,e),this.bg=tm.display.Shape(e.width,e.height).addChildTo(this),this.bg.canvas.clearColor("hsla(200, 80%, 70%, 1.0)"),this.bg.setOrigin(0,0);var i=tm.display.Label("Loading");i.x=e.width/2,i.y=e.height/2,i.width=e.width,i.align="center",i.baseline="middle",i.fontSize=32,i.counter=0,i.update=function(t){0==t.frame%30&&(this.text+=".",this.counter+=1,this.counter>3&&(this.counter=0,this.text="Loading"))},i.addChildTo(this.bg);var n=tm.display.Shape(84,84);n.setPosition(e.width,e.height-80),n.canvas.setColorStyle("white","yellow").fillCircle(42,42,32),n.canvas.setColorStyle("white","black").fillCircle(27,27,2),n.canvas.setColorStyle("white","brown").fillRect(40,70,4,15).fillTriangle(0,40,11,35,11,45),n.update=function(){n.x-=4,-80>n.x&&(n.x=e.width),n.rotation-=7},n.addChildTo(this.bg),this.alpha=0,this.bg.tweener.clear().fadeIn(100).call(function(){if(e.assets){var t=tm.asset.Loader();t.onload=function(){this.bg.tweener.clear().wait(200).fadeOut(200).call(function(){e.nextScene&&this.app.replaceScene(e.nextScene());var t=tm.event.Event("load");this.fire(t)}.bind(this))}.bind(this),t.onprogress=function(t){var e=tm.event.Event("progress");e.progress=t.progress,this.fire(e)}.bind(this),t.load(e.assets)}}.bind(this))}})}(),tm.three=tm.three||{},function(){tm.global.THREE&&(tm.three.ThreeApp=tm.createClass({superClass:tm.app.BaseApp,canvas:null,background:null,_scenes:null,_sceneIndex:0,init:function(t){t instanceof HTMLCanvasElement?this.element=t:"string"==typeof t?this.element=document.querySelector(t):(this.element=document.createElement("canvas"),document.body.appendChild(this.element)),this.superInit(this.element),this.renderer=new THREE.WebGLRenderer({canvas:this.element,clearColor:2236962,clearAlpha:1}),this.renderer.setSize(this.element.width,this.element.height),this._scenes=[tm.three.Scene()]},resize:function(t,e){return this.width=t,this.height=e,this.renderer.setSize(this.width,this.height),this},resizeWindow:function(){return this.width=innerWidth,this.height=innerHeight,this.renderer.setSize(this.width,this.height),this},fitWindow:function(t){var e=function(){t=void 0===t?!0:t;var e=this.element,i=e.style;i.position="absolute",i.left="0px",i.top="0px";var n=e.width/window.innerWidth,s=e.height/window.innerHeight,r=e.height/e.width;n>s?(i.width=innerWidth+"px",i.height=innerWidth*r+"px"):(i.width=innerHeight/r+"px",i.height=innerHeight+"px")}.bind(this);e(),t&&window.addEventListener("resize",e,!1),this.mouse._mousemove=this.mouse._mousemoveScale,this.touch._touchmove=this.touch._touchmoveScale},_draw:function(){for(var t=0,e=this._scenes.length;e>t;++t)this.renderer.render(this.currentScene,this.currentScene.camera) }}),tm.three.ThreeApp.prototype.accessor("width",{get:function(){return this.element.width},set:function(t){this.element.width=t}}),tm.three.ThreeApp.prototype.accessor("height",{get:function(){return this.element.height},set:function(t){this.element.height=t}}))}(),function(){tm.global.THREE&&(tm.three.Element=tm.createClass({superClass:THREE.Object3D,init:function(){THREE.Object3D.call(this),tm.event.EventDispatcher.prototype.init.call(this)},update:function(){},_update:function(t){if(0!=this.isUpdate){this.update(t);var e=tm.event.Event("enterframe");if(e.app=t,this.dispatchEvent(e),this.children.length>0)for(var i=this.children.slice(),n=0,s=i.length;s>n;++n){var r=i[n];r._update&&r._update(t)}}}}),tm.three.Element.prototype.$safe(tm.event.EventDispatcher.prototype))}(),function(){tm.global.THREE&&(tm.three.MeshElement=tm.createClass({superClass:THREE.Mesh,init:function(t,e){e=e||new THREE.MeshNormalMaterial,THREE.Mesh.call(this,t,e),tm.three.Element.prototype.init.call(this)}}),tm.three.MeshElement.prototype.$safe(tm.three.Element.prototype),tm.three.CubeElement=tm.createClass({superClass:tm.three.MeshElement,init:function(t,e,i){t=t||100,e=e||100,i=i||100;var n=new THREE.CubeGeometry(t,e,i),s=new THREE.MeshNormalMaterial;this.superInit(n,s)}}),tm.three.SphereElement=tm.createClass({superClass:tm.three.MeshElement,init:function(t,e,i){t=t||45,e=e||16,i=i||12;var n=new THREE.SphereGeometry(t,e,i),s=new THREE.MeshNormalMaterial;this.superInit(n,s)}}),tm.three.PlaneElement=tm.createClass({superClass:tm.three.MeshElement,init:function(t,e){var i=new THREE.PlaneGeometry(t,e),n=new THREE.MeshNormalMaterial;this.superInit(i,n)}}),tm.three.FloorElement=tm.createClass({superClass:tm.three.MeshElement,init:function(t,e){t=t||1e3,e=e||1e3;var i=new THREE.PlaneGeometry(t,e),n=new THREE.MeshBasicMaterial;this.superInit(i,n),this.rotation.x=-Math.PI/2,this._render()},_render:function(){var t=tm.graphics.Canvas();t.resize(128,128),t.clearColor("#444"),t.setFillStyle("white"),t.fillRect(0,0,64,64),t.fillRect(64,64,64,64);var e=new THREE.Texture(t.element);e.wrapS=e.wrapT=THREE.RepeatWrapping,e.repeat.set(10,10),e.needsUpdate=!0,this.material.map=e}}),tm.three.TextElement=tm.createClass({superClass:tm.three.MeshElement,init:function(t,e){var i=new THREE.TextGeometry(t,e),n=new THREE.MeshNormalMaterial;this.superInit(i,n)}}),tm.three.CanvasTexture=tm.createClass({superClass:THREE.Texture,canvas:null,init:function(){this.canvas=tm.graphics.Canvas(),THREE.Texture.call(this,this.canvas.element),this.needsUpdate=!0}}))}(),function(){tm.global.THREE&&(tm.three.Scene=tm.createClass({superClass:THREE.Scene,init:function(t,e){t=t||60,e=e||640/480,THREE.Scene.call(this),tm.three.Element.prototype.init.call(this),this.camera=new THREE.PerspectiveCamera(t,e,1,1e4),this.camera.position.y=100,this.camera.position.z=500,this.projector=new THREE.Projector},intersect:function(t){t=t||this.children;var e=this.app.pointing.x,i=this.app.pointing.y;e=2*(e/this.app.width)-1,i=2*-(i/this.app.height)+1;var n=new THREE.Vector3(e,i,.5);this.projector.unprojectVector(n,this.camera);var s=new THREE.Raycaster(this.camera.position,n.sub(this.camera.position).normalize());return s.intersectObjects(t)}}),tm.three.Scene.prototype.$safe(tm.three.Element.prototype))}(),tm.sound=tm.sound||{},function(){tm.sound.globalVolume=1}(),function(){if(tm.sound.Sound=tm.createClass({element:null,loaded:!1,isPlay:!1,init:function(t){this.element=new Audio,this.element.src=t,this.element.load(),this.element.setAttribute("preload","auto");var e=this;this.element.addEventListener("canplaythrough",function(){e.loaded=!0}),this.element.addEventListener("ended",function(){e.isPlay=!1}),this.element.addEventListener("error",function(){console.warn(this.src+"の読み込みに失敗しました")}),this.element.volume=1,tm.isMobile&&(this.loaded=!0)},play:function(){return this.element.play(),this.isPlay=!0,this},stop:function(){return this.element.pause(),tm.isMobile||(this.element.currentTime=0),this.isPlay=!1,this},pause:function(){return this.element.pause(),this},clone:function(){return tm.sound.Sound(this.element.src)}}),tm.sound.Sound.prototype.accessor("volume",{get:function(){return this.element.volume},set:function(t){this.element.volume=t}}),void 0!==(new Audio).loop)tm.sound.Sound.prototype.accessor("loop",{get:function(){return this.element.loop},set:function(t){this.element.loop=t}});else{var t=function(){this.play()};tm.sound.Sound.prototype.accessor("loop",{get:function(){return this.element.loop},set:function(e){1!=this.element.loop&&1==e?this.element.addEventListener("ended",t,!1):1==this.element.loop&&0==e&&this.element.removeEventListener("ended",t,!1),this.element.loop=e}})}tm.sound.Sound.SUPPORT_EXT=function(){var t="",e=new Audio;return"maybe"==e.canPlayType("audio/wav")?t="wav":"maybe"==e.canPlayType("audio/mp3")?t="mp3":"maybe"==e.canPlayType("audio/ogg")&&(t="ogg"),t}()}(),function(){var t=tm.isMobile?1:4;tm.sound.SoundManager={sounds:{}},tm.sound.SoundManager.add=function(e,i,n){n=n||t,-1==i.split("/").at(-1).indexOf(".")&&(i+="."+tm.sound.Sound.SUPPORT_EXT);for(var s=this.sounds[e]=[],r=0;n>r;++r){var o=tm.sound.Sound(i);s.push(o)}return this},tm.sound.SoundManager.get=function(t){for(var e=this.sounds[t],i=0,n=e.length;n>i;++i)if(0==e[i].isPlay)return e[i];return e[0]},tm.sound.SoundManager.getByIndex=function(t,e){return this.sounds[t][e]},tm.sound.SoundManager.remove=function(){return this},tm.sound.SoundManager.setVolume=function(){return this},tm.sound.SoundManager.isLoaded=function(){for(var t in this.sounds)for(var e=this.sounds[t],i=0,n=e.length;n>i;++i)if(0==e[i].loaded)return!1;return!0},tm.addLoadCheckList(tm.sound.SoundManager)}(),tm.sound=tm.sound||{},function(){var t=tm.global.webkitAudioContext?!0:!1,e=t?new webkitAudioContext:null;tm.sound.WebAudio=tm.createClass({superClass:tm.event.EventDispatcher,loaded:!1,context:null,panner:null,volume:.8,init:function(t){this.superInit(),this.context=e;var i=typeof t;"string"===i?(this.loaded=!1,this._load(t)):"object"===i?(this._setup(),this.buffer=t,this.loaded=!0,this.dispatchEvent(tm.event.Event("load"))):(this._setup(),this.loaded=!1)},play:function(t){return void 0===t&&(t=0),this.source.noteOn(this.context.currentTime+t),this},stop:function(t){void 0===t&&(t=0),this.source.noteOff(this.context.currentTime+t);var e=this.buffer,i=this.volume,n=this.loop;return this.source=this.context.createBufferSource(),this.source.connect(this.panner),this.buffer=e,this.volume=i,this.loop=n,this},pause:function(){return this.source.disconnect(),this},resume:function(){return this.source.connect(this.panner),this},clone:function(){var t=tm.sound.WebAudio(this.buffer);return t.volume=this.volume,t},setPosition:function(t,e,i){return this.panner.setPosition(t,e||0,i||0),this},setVelocity:function(t,e,i){return this.panner.setVelocity(t,e||0,i||0),this},setOrientation:function(t,e,i){return this.panner.setOrientation(t,e||0,i||0),this},setBuffer:function(t){return this.buffer=t,this},setLoop:function(t){return this.loop=t,this},setVolume:function(t){return this.volume=t,this},setPlaybackRate:function(t){return this.playbackRate=t,this},_load:function(t){if(this.context){var e=new XMLHttpRequest,i=this;e.onreadystatechange=function(){4===e.readyState&&(200===e.status||0===e.status?i.context.decodeAudioData(e.response,function(t){i._setup(),i.buffer=t,i.loaded=!0,i.dispatchEvent(tm.event.Event("load"))}):console.error(e))},e.open("GET",t,!0),e.responseType="arraybuffer",e.send()}},_setup:function(){this.source=this.context.createBufferSource(),this.panner=this.context.createPanner(),this.analyser=this.context.createAnalyser(),this.source.connect(this.panner),this.panner.connect(this.analyser),this.analyser.connect(this.context.destination)},tone:function(t,e){t=void 0!==t?t:200,e=void 0!==e?e:1;for(var i=1,n=44100,s=2,r=this.context.createBuffer(i,e*n,n),o=r.getChannelData(0),a=0;o.length>a;a++){var h=a/r.sampleRate,u=t*h*Math.PI;o[a]=Math.sin(u)*s}return this.buffer=r,this}}),tm.sound.WebAudio.prototype.accessor("buffer",{get:function(){return this.source.buffer},set:function(t){this.source.buffer=t}}),tm.sound.WebAudio.prototype.accessor("loop",{get:function(){return this.source.loop},set:function(t){this.source.loop=t}}),tm.sound.WebAudio.prototype.accessor("volume",{get:function(){return this.source.gain.value},set:function(t){this.source.gain.value=t}}),tm.sound.WebAudio.prototype.accessor("playbackRate",{get:function(){return this.source.playbackRate.value},set:function(t){this.source.playbackRate.value=t}}),tm.sound.WebAudio.isAvailable=tm.global.webkitAudioContext?!0:!1}(),tm.social=tm.social||{},function(){tm.social.Twitter=tm.social.Twitter||{},tm.social.Twitter.API_URL="http://api.twitter.com/1";var t="http://twitter.com/intent";tm.social.Twitter.createURL=function(e){var i=[];for(var n in e)if("type"!=n){var s=encodeURIComponent(e[n]),r=n+"="+s;i.push(r)}var o="{baseURL}/{type}?{param}".format({baseURL:t,type:e.type,param:i.join("&")});return o}}(),function(){var t="http://api.twitter.com/1/{type}/{kind}.json";tm.social.Twitter.api=function(e,i,n,s){var r=t.format({type:e,kind:i}),o=tm.util.QueryString.stringify(n);tm.util.Ajax.loadJSONP(r+"?"+o,s)}}(),function(){var t="http://search.twitter.com/search.json";tm.social.Twitter.search=function(e,i){var n=t,s=tm.util.QueryString.stringify(e);tm.util.Ajax.loadJSONP(n+"?"+s,i)}}(),function(){tm.social.Twitter.getFollowers=function(t,e){tm.social.Twitter.api("statuses","followers",t,e)}}(),tm.social=tm.social||{},function(){tm.social.Nineleap=tm.social.Nineleap||{};var t="http://9leap.net/games/{id}/result?score={score}&result={result}";tm.social.Nineleap.createURL=function(e,i,n){return t.format({id:e,score:i,result:n})},tm.social.Nineleap.postRanking=function(t,e){if("r.jsgames.jp"==location.hostname){var i=location.pathname.match(/^\/games\/(\d+)/)[1];location.replace(this.createURL(i,t,e))}else console.warn("9leap に投稿されていません!")}}(),tm.google=tm.google||{},function(){tm.google.Chart=tm.google.Chart||{};var t="https://chart.googleapis.com/chart?chst={type}&chld={data}",e="https://chart.googleapis.com/chart?chs={size}&cht={type}&chl={text}&chco={color}";tm.google.Chart.createDynamicIcons=function(e,i){return t.format({type:e,data:i})},tm.google.Chart.createQRCode=function(t,i){return i=encodeURIComponent(i),e.format({type:"qr",size:t,text:i})},tm.google.Chart.createTeX=function(){}}(),function(){tm.app.Element.prototype.getter("interaction",function(){console.assert(!1,"interaction は Object2d に統合されました. obj.setInteractive(true); とすればタッチ判定が有効になります.")});var t={display:["Sprite","Shape","CircleShape","TriangleShape","RectangleShape","StarShape","PolygonShape","HeartShape","TextShape","CanvasRenderer","BoundingRectRenderer","Label","MapSprite","CanvasElement","CanvasApp","AnimationSprite","SpriteSheet"],ui:["LabelButton","IconButton","GlossyButton","FlatButton","LoadingScene"]};for(var e in t){var i=t[e];i.each(function(t){tm.app[t]=tm[e][t]})}tm.asset.AssetManager=tm.asset.Manager}();