/*! * oCanvas v2.7.4 * http://ocanvas.org/ * * Copyright 2011-2015, Johannes Koggdal * Licensed under the MIT license * http://ocanvas.org/license * * Including Xccessors by Eli Grey * Including easing equations by Robert Penner */ (function(a,b,c){var d={version:"2.7.4",canvasList:[],modules:{},inits:{},plugins:{},core:function(a){this.isCore=!0,this.id=d.canvasList.push(this)-1,this.lastObjectID=0,this.children=[],this.domEventHandlers=[];for(var c in d.modules)typeof d.modules[c]=="function"?this[c]=d.modules[c]():this[c]=Object.create(d.modules[c]);this.settings={fps:30,background:"transparent",clearEachFrame:!0,drawEachFrame:!0,disableScrolling:!1,plugins:[]},d.extend(this.settings,a),this.originalSettings=d.extend({},this.settings);if(this.settings.canvas.nodeName&&this.settings.canvas.nodeName.toLowerCase()==="canvas")this.canvasElement=this.settings.canvas;else if(typeof this.settings.canvas=="string")this.canvasElement=b.querySelector(this.settings.canvas);else return!1;this.canvas=this.canvasElement.getContext("2d");var e=this.canvasElement.width,f=this.canvasElement.height;Object.defineProperty(this,"width",{enumerable:!0,configurable:!0,set:function(a){e=isNaN(parseFloat(a))?e:parseFloat(a),this.canvasElement.width=e,this.background.set(this.settings.background),this.redraw()},get:function(){return e}}),Object.defineProperty(this,"height",{enumerable:!0,configurable:!0,set:function(a){f=isNaN(parseFloat(a))?f:parseFloat(a),this.canvasElement.height=f,this.background.set(this.settings.background),this.redraw()},get:function(){return f}});for(var c in d.modules){if(this[c].wrapper===!0)for(var g in this[c])typeof this[c][g]=="object"&&typeof this[c][g].setCore=="function"?this[c][g]=this[c][g].setCore(this):typeof this[c][g].setCore=="function"&&this[c][g].setCore(this),this[c].core=this;this[c].core=this}for(var h in d.inits)if(typeof d.inits[h]=="string"&&typeof this[h][d.inits[h]]=="function")this[h][d.inits[h]]();else if(d.inits[h]==="object")for(var i in d.inits[h])typeof this[h][d.inits[h][i]]=="function"&&this[h][d.inits[h][i]]();var j=this.settings.plugins;if(j.length>0)for(var k=0,l=j.length;k0?d.extend.apply(this,[c].concat(a)):c},d.addDOMEventHandler=function(a,b,c,d,e){a.domEventHandlers.push({obj:b,event:c,handler:d,useCapture:!!e}),b.addEventListener(c,d,e)},d.removeDOMEventHandler=function(a,b){var c=a.domEventHandlers[b];c.obj.removeEventListener(c.event,c.handler,c.useCapture)},d.isNumber=function(a){return!isNaN(parseFloat(a))&&isFinite(a)},typeof Object.create!="function"&&(Object.create=function(a){function b(){}b.prototype=a;return new b}),typeof Object.getPropertyDescriptor!="function"&&(Object.getPropertyDescriptor=function(a,b){var d=Object.getOwnPropertyDescriptor(a,b),e=Object.getPrototypeOf(a);while(d===c&&e!==null)d=Object.getOwnPropertyDescriptor(e,b),e=Object.getPrototypeOf(e);return d}),function(){var b=0,c=["ms","moz","webkit","o"];for(var d=0;d0},getKeysDown:function(){var a,b,c;a=this.keysDown,b=[];for(c in a)a[c]===!0&&b.push(parseInt(c,10));return b},ARROW_UP:38,ARROW_DOWN:40,ARROW_LEFT:37,ARROW_RIGHT:39,SPACE:32,ENTER:13,ESC:27}};d.registerModule("keyboard",f,"init");var g=function(){return{x:0,y:0,buttonState:"up",canvasFocused:!1,canvasHovered:!1,cursorValue:"default",init:function(){this.core.events.addEventTypes("mouse",{move:"mousemove",enter:"mouseenter",leave:"mouseleave",down:"mousedown",up:"mouseup",singleClick:"click",doubleClick:"dblclick"}),this.types={mousemove:"move",mousedown:"down",mouseup:"up",dblclick:"doubleClick"},this.core.pointer=this,(!this.core.touch||!this.core.touch.isTouch)&&this.bindHandlers()},bindHandlers:function(){var c,e,f,g;c=this,e=this.core,f=e.canvasElement;for(g in this.types){d.addDOMEventHandler(e,f,g,function(a){c.canvasHandler(a)},!1),g==="mousemove"&&(g="mouseover"),d.addDOMEventHandler(e,b,g,function(a){c.docHandler(a)},!1);var h=b.createElement("a");h.href=b.referrer,h.host===a.location.host&&a.parent!==a&&d.addDOMEventHandler(e,a.parent.document,g,function(a){c.docHandler(a)},!1)}},canvasHandler:function(a,b){var d,e,f,g;d=this.core.events,e=this.onCanvas(a);if(a.type==="mouseup"&&!e&&!this.canvasUpEventTriggered)d.triggerPointerEvent(this.types.mouseup,d.frontObject,"mouse",a),d.triggerPointerEvent(this.types.mouseup,this.core.canvasElement,"mouse",a),this.canvasUpEventTriggered=!0;else{if(!b&&!e)return;f=b&&a.type==="mouseover"?"mousemove":a.type,b||(this.canvasHovered=!0),f==="mousedown"&&(this.canvasUpEventTriggered=!1,this.canvasFocused=!0,this.buttonState="down"),f==="mouseup"&&(this.buttonState="up"),g=b||!e?c:d.getFrontObject("mouse"),b&&d.frontObject?(d.triggerChain(d.getParentChain(d.frontObject,!0,!0),["mouseleave"]),d.frontObject=null):b?d.triggerHandlers(this.core.canvasElement,["mouseleave"]):d.triggerPointerEvent(this.types[f],g,"mouse",a)}},docHandler:function(a){var b=this.onCanvas(a);b||(this.core.canvasElement.events.hasEntered?a.type==="mouseover"&&this.canvasHandler(a,!0):(a.type==="mouseup"&&this.buttonState==="down"&&this.canvasHandler(a,!0),a.type==="mousedown"&&(this.canvasFocused=!1)))},getPos:function(b){var c=this.core.canvasElement,d=c.getBoundingClientRect(),e=c.width/c.clientWidth,f=c.height/c.clientHeight,g=b.pageX-a.pageXOffset,h=b.pageY-a.pageYOffset,i=e*(g-Math.round(d.left)),j=f*(h-Math.round(d.top));return{x:i,y:j}},updatePos:function(a){var b=this.getPos(a);this.x=b.x,this.y=b.y},onCanvas:function(a){a=a||this.core.events.lastPointerEventObject&&this.core.events.lastPointerEventObject.originalEvent;var b=a?this.getPos(a):{x:this.x,y:this.y};if(b.x>=0&&b.x<=this.core.width&&b.y>=0&&b.y<=this.core.height){this.canvasHovered=!0,a&&this.updatePos(a);return!0}this.canvasHovered=!1;return!1},cancel:function(){this.core.events.lastDownObject=null},hide:function(){this.core.canvasElement.style.cursor="none"},show:function(){this.core.canvasElement.style.cursor=this.cursorValue},cursor:function(a){if(~a.indexOf("url(")){var b=/url\((.*?)\)(\s(.*?)\s(.*?)|)($|,.*?$)/.exec(a),c=b[5]?b[5]:"";a="url("+b[1]+") "+(b[3]?b[3]:0)+" "+(b[4]?b[4]:0)+(c!==""?c:", default")}this.core.canvasElement.style.cursor=a,this.cursorValue=a}}};d.registerModule("mouse",g,"init");var h=function(){return{x:0,y:0,touchState:"up",canvasFocused:!1,canvasHovered:!1,isTouch:"ontouchstart"in a||"createTouch"in b,dblTapInterval:500,init:function(){var a,b;a=this.core,b=a.canvasElement,a.events.addEventTypes("touch",{move:"touchmove",enter:"touchenter",leave:"touchleave",down:"touchstart",up:"touchend",singleClick:"tap",doubleClick:"dbltap"}),this.types={touchmove:"move",touchstart:"down",touchend:"up"},this.isTouch&&(a.pointer=this,b.style.WebkitUserSelect="none",b.style.WebkitTouchCallout="none",b.style.WebkitTapHighlightColor="rgba(0,0,0,0)"),this.bindHandlers()},bindHandlers:function(){var c,e,f,g;c=this,e=this.core,f=e.canvasElement;for(g in this.types){d.addDOMEventHandler(e,f,g,function(a){c.canvasHandler(a)},!1),d.addDOMEventHandler(e,b,g,function(a){c.docHandler(a)},!1);var h=b.createElement("a");h.href=b.referrer,h.host===a.location.host&&a.parent!==a&&d.addDOMEventHandler(e,a.parent.document,g,function(a){c.docHandler(a)},!1)}this.core.settings.disableScrolling&&d.addDOMEventHandler(e,f,"touchmove",function(a){a.preventDefault()},!1)},canvasHandler:function(a,b){var d,e,f,g,h,i;d=this.core.events,e=this.onCanvas(a);if(a.type==="touchend"&&!e&&!this.canvasUpEventTriggered)d.triggerPointerEvent(this.types.touchend,d.frontObject,"touch",a),d.triggerPointerEvent(this.types.touchend,this.core.canvasElement,"touch",a),this.canvasUpEventTriggered=!0;else{if(!b&&!e)return;b||(this.canvasHovered=!0),a.type==="touchstart"&&(this.canvasUpEventTriggered=!1,this.canvasFocused=!0,this.touchState="down"),a.type==="touchend"&&(this.touchState="up"),f=b||!e?c:d.getFrontObject("touch"),b&&d.frontObject?(d.triggerChain(d.getParentChain(d.frontObject,!0,!0),["touchleave"]),d.frontObject=null):b?d.triggerHandlers(this.core.canvasElement,["touchleave"]):d.triggerPointerEvent(this.types[a.type],f,"touch",a),a.type==="touchstart"&&(g=(new Date).getTime(),!this.dblTapStart||g-this.dblTapStart.timestamp>this.dblTapInterval?this.dblTapStart={timestamp:g,obj:f,count:1}:this.dblTapStart.count++),a.type==="touchend"&&this.dblTapStart.count===2&&(g=(new Date).getTime(),h=f===this.dblTapStart.obj,i=g-this.dblTapStart.timestamp,h&&i0){b=f[0];var g=this.core.canvasElement,h=g.getBoundingClientRect(),i=g.width/g.clientWidth,j=g.height/g.clientHeight,k=b.pageX-a.pageXOffset,l=b.pageY-a.pageYOffset;d=i*(k-Math.round(h.left)),e=j*(l-Math.round(h.top))}else d=this.x,e=this.y;return{x:d,y:e}},updatePos:function(a){var b=this.getPos(a);this.x=b.x,this.y=b.y},onCanvas:function(a){a=a||this.core.events.lastPointerEventObject&&this.core.events.lastPointerEventObject.originalEvent;var b=a?this.getPos(a):{x:this.x,y:this.y};if(b.x>=0&&b.x<=this.core.width&&b.y>=0&&b.y<=this.core.height){this.canvasHovered=!0,a&&this.updatePos(a);return!0}this.canvasHovered=!1;return!1},cancel:function(){this.core.events.lastDownObject=null}}};d.registerModule("touch",h,"init");var i=function(){return{transformPointerPosition:function(a,b,c,d,e){d=d||0,e=e||this.core.pointer;if(typeof a=="object"){var f=a.parent,g=[],h={x:0,y:0},i,j,k,l,m;g.push(a);while(f&&f!==this.core)g.push(f),f=f.parent;g.reverse(),i=e;for(k=0,l=g.length;k=b&&e.y<=c,p=e.x>=b&&e.y>=c,q=e.x<=b&&e.y>=c,r=e.x<=b&&e.y<=c,s=Math.sqrt(Math.pow(e.x-b,2)+Math.pow(e.y-c,2)),n=(n/360-Math.floor(n/360))*360-d,t,u,v,w=s===0?0:Math.abs(e.y-c)/s;if(o||q)t=(180-n-Math.asin(w)*180/Math.PI)*Math.PI/180,u=b+Math.cos(t)*s*(o?-1:1),v=c+Math.sin(t)*s*(o?-1:1);else if(r||p)t=(Math.asin(w)*180/Math.PI-n)*Math.PI/180,u=b+Math.cos(t)*s*(r?-1:1),v=c+Math.sin(t)*s*(r?-1:1);return{x:u,y:v}},isPointerInside:function(a,b){var c=a.getOrigin();if(a.type==="line"){var d=Math.abs(a._.end_x-a.abs_x),e=Math.abs(a._.end_y-a.abs_y),f=Math.sqrt(d*d+e*e),g=a.start,h=a.end,i=g.xh.x&&g.y>h.y?-1:1,j=Math.asin(e/f)*(180/Math.PI)*i,k=this.transformPointerPosition(a,a.abs_x,a.abs_y,j,b);return k.x>a.abs_x-f-c.x&&k.xa.abs_y-a.strokeWidth/2-c.y&&k.y0&&su-c.x-l&&k.xw-c.y-l&&k.ya.abs_x-c.x-l&&k.xa.abs_y-c.y-l&&k.y=k.y||G.y=k.y)&&F.x+(k.y-F.y)/(G.y-F.y)*(G.x-F.x)0?360:0):Math.abs(H),J=a.direction==="clockwise"?a.start*-1:a.end*-1,k=this.transformPointerPosition(a,a.abs_x,a.abs_y,J,b),f=Math.sqrt(Math.pow(k.x-a.abs_x+c.x,2)+Math.pow(k.y-a.abs_y+c.y,2)),B=a.radius,K={},L={},z,M,N,j;if(a.strokeWidth===0&&f>B||a.strokeWidth>0&&f>B+a.strokeWidth/2)return!1;if(B===a.strokeWidth/2||a.pieSection){var O=a.pieSection?a.radius:O;if(I>180){var P,Q,R,S;P=Math.abs(a.abs_x-c.x-k.x),Q=Math.abs(a.abs_y-c.y-k.y),R=Math.sqrt(P*P+Q*Q),S=Math.acos(P/R)*180/Math.PI;return k.y>=a.abs_y-c.y&&f<=O?!0:k.y=a.abs_y-c.y&&f<=O?!0:!1;if(I<180){J=90-I/2-(a.direction==="clockwise"?a.start:a.end),k=this.transformPointerPosition(a,a.abs_x,a.abs_y,J,b);var T,P,Q,R,S;B*=2,T=Math.cos(I/2*Math.PI/180)*B,P=Math.abs(a.abs_x-c.x-k.x),Q=Math.abs(a.abs_y-c.y-k.y),R=Math.sqrt(P*P+Q*Q),S=Math.asin(P/R)*180/Math.PI;return k.y>=a.abs_y-c.y+T?!0:k.y>=a.abs_y-c.y&&S<=I/2?!0:!1}}else{if(I>180){z=(360-I)/2,M=Math.cos(z*Math.PI/180)*B,K.x=a.abs_x-c.x+Math.cos(z*Math.PI/180)*M,K.y=a.abs_y-c.y-Math.sin(z*Math.PI/180)*M,N=180-2*z,L.x=a.abs_x-c.x-Math.cos(N*Math.PI/180)*B,L.y=a.abs_y-c.y-Math.sin(N*Math.PI/180)*B;var U=90-(90-N)-(90-z);if(k.yK.y&&k.x>=K.x)j=U-Math.acos(Math.abs(k.x-K.x)/Math.sqrt(Math.pow(k.x-K.x,2)+Math.pow(k.y-K.y,2)))*180/Math.PI;else{if(k.y=K.x)return!1;j=-1e6}if((a.fill===""||a.fill==="transparent")&&a.strokeWidth>0&&f=L.x&&k.y>K.y&&k.y0&&f<=B+a.strokeWidth/2)&&(k.x<=L.x&&k.y<=a.abs_y-c.y||k.y>=a.abs_y-c.y)?!0:!1}if(I===180)return k.y>=a.abs_y-c.y&&(a.strokeWidth===0&&f<=B||a.strokeWidth>0&&f<=B+a.strokeWidth/2)?!0:!1;if(I<180){J=90-I/2-(a.direction==="clockwise"?a.start:a.end),k=this.transformPointerPosition(a,a.abs_x,a.abs_y,J,b);var V,T;V=a.fill===""?B-a.strokeWidth/2:B,T=Math.cos(I/2*Math.PI/180)*V;return a.fill===""&&a.strokeWidth>0?k.y>=a.abs_y-c.y+T&&f>=B-a.strokeWidth/2&&f<=B+a.strokeWidth/2?!0:!1:k.y>=a.abs_y-c.y+T?a.strokeWidth>0?f<=B+a.strokeWidth/2?!0:!1:!0:!1}}}else if(a.shapeType==="radial"){var B=a.radius?a.radius:0;if(B>0){var k=this.transformPointerPosition(a,a.abs_x,a.abs_y,0,b),c=a.getOrigin(),f=Math.sqrt(Math.pow(k.x-a.abs_x+c.x,2)+Math.pow(k.y-a.abs_y+c.y,2));return fe.length-1&&(d=e.length-1),d<0&&(d=0),d>b?(h=e.slice(0,b),j=e.slice(d+1,e.length),i=e.slice(b,d+1),i.shift(),i.push(f)):(h=e.slice(0,d),j=e.slice(b+1,e.length),i=e.slice(d,b+1),i.pop(),i.unshift(f)),a.children=h.concat(i).concat(j)}},clear:function(a){this.core.canvas.clearRect(0,0,this.core.width,this.core.height),a!==!1&&this.core.background.redraw(),this.isCleared=!0;return this},redraw:function(a){a=a||!1,(this.core.settings.clearEachFrame||a)&&this.clear(),this.isCleared=!1,this.drawObjects(this.core.children);return this},drawObjects:function(a){var b=this.core.canvas,d,e,f,g,h,i,j,k,l,m,n,o,p,q;for(d=0,e=a.length;d0&&(b.shadowOffsetX=p.offsetX,b.shadowOffsetY=p.offsetY,b.shadowBlur=p.blur,b.shadowColor=p.color),b.lineCap=f.cap,b.lineJoin=f.join,b.miterLimit=f.miterLimit,f.draw(),f.drawn=!0,f._.abs_x=h,f._.abs_y=i,b.lineCap="butt",b.lineJoin="miter",b.miterLimit=10,b.restore(),this.translation={x:0,y:0},f.children.length>0&&this.drawObjects(f.children)}}}}};d.registerModule("draw",k);var l=function(){return{bg:"",value:"",type:"transparent",loaded:!1,init:function(){this.set(this.core.settings.background)},set:function(a){var b=this;typeof a!="string"&&(a=""),this.value=a,~a.indexOf("gradient")?this.type="gradient":~a.indexOf("image")?this.type="image":this.core.style&&this.core.style.isColor(a)?this.type="color":this.type="transparent";if(this.type==="color")this.bg=a,this.core.timeline&&!this.core.timeline.running&&this.core.draw.redraw(!0),this.loaded=!0;else if(this.type==="gradient")this.bg=this.core.style?this.core.style.getGradient(a,0,0,this.core.width,this.core.height):"",this.core.timeline&&!this.core.timeline.running&&this.core.draw.redraw(!0),this.loaded=!0;else if(this.type==="image"){var c=/image\((.*?)(,(\s|)(repeat|repeat-x|repeat-y|no-repeat)|)\)/.exec(a),d=c[1],e=c[4]||"repeat",f=new Image;f.src=d,f.onload=function(){b.bg=b.core.canvas.createPattern(this,e),b.loaded=!0,b.core.timeline&&!b.core.timeline.running&&b.core.redraw(!0)}}else this.redraw(!0),this.loaded=!0;return this},redraw:function(){var a=this.core;this.type!=="transparent"&&(a.canvas.fillStyle=this.bg,a.canvas.fillRect(0,0,a.width,a.height))}}};d.registerModule("background",l,"init");var m=function(){return{current:"none",scenes:{},create:function(a,b){this.scenes[a]=Object.create(this.scenesBase()),this.scenes[a].name=a,b.call(this.scenes[a]);return this.scenes[a]},scenesBase:function(){return{name:"",objects:[],loaded:!1,add:function(a){this.objects.push(a),this.loaded&&a.add();return this},remove:function(a){var b=this.objects.indexOf(a);~b&&(this.objects.splice(b,1),this.loaded&&a.remove());return this},load:function(){if(!this.loaded){var a=this.objects,b,d=a.length;for(b=0;b-1&&(f=h),e[h].indexOf(")")>-1&&(g=h);var j=g?e.splice(f,g-f+1):c;j&&e.push(j.join(" "));var k=["outside","center","inside"],l="",h,m=e.length,n,o,j,p;if(m>=3)if(!~k.indexOf(e[0])){p=isNaN(parseInt(e[0]));for(h=p?0:1;h3){for(h=2;h1&&~p.indexOf(h[1])&&i.push(h[1]),i.length===0?i.push("top"):k=1;if(i.length===1){if(i[0]==="top")l=b+d/2,m=c,n=b+d/2,o=c+e;else if(i[0]==="right")l=b+d,m=c+e/2,n=b,o=c+e/2;else if(i[0]==="bottom")l=b+d/2,m=c+e,n=b+d/2,o=c;else if(i[0]==="left")l=b,m=c+e/2,n=b+d,o=c+e/2;else if(~i[0].indexOf("deg")){var v,w,x,y,z,A,B,C,D=Math.PI,E=b+d/2,F=c+e/2;v=parseFloat(i)%360*D/180,w=v,v>=0&&v=D/2&&v=D&&v=D*1.5&&v=0&&w=D/2&&w=D&&w=D*1.5&&w=100)break;~g.indexOf(" ")?(h=g.split(" "),i=h[0],j=h[1],~j.indexOf("px")?j=parseFloat(j)/Math.sqrt(Math.pow(eX-sX,2)+Math.pow(eY-sY,2))*100:j=parseFloat(j)):(i=g,j===c?j=0:(j=j||0,j=j+(100-j)/(f-e))),~i.indexOf("###")&&(i=d[/###(\d+)###/.exec(i)[1]]),k.push({pos:j,color:i})}return k},getFont:function(a,b){b=b==="string"?"string":"object";if(typeof a=="object"&&b==="string"){var d=a;a=typeof d.style=="string"?d.style:"normal",a+=" "+(typeof d.variant=="string"?d.variant:"normal"),a+=" "+(typeof d.weight=="string"?d.weight:"normal"),a+=" "+(typeof d.size=="number"?~~(d.size*10+.5)/10+"px":"16px"),a+="/"+(typeof d.lineHeight=="number"?~~(d.lineHeight*10+.5)/10:typeof d.lineHeight=="string"?d.lineHeight.indexOf("px")>-1?d.lineHeight:1:1),a+=" "+(typeof d.family=="string"?d.family:"sans-serif")}if(a.length>0){var e=a.split(" "),f=e.length,g,a,h,i,j="",k=["normal","italic","oblique"],l=["normal","small-caps"],m=["normal","bold","bolder","lighter","100","200","300","400","500","600","700","800","900"],n={};for(g=0;g-1?"px":"relative");else if(!n.size&&/\d+[a-z]{2}(?!\/)/.test(a))isNaN(parseInt(a))||(n.size=parseInt(a));else if(isNaN(parseInt(a))&&!n.family){j="";for(i=g;i1){this.setEndValues(a);return!1}a.options.easing.length===1?d=a.options.easing.call(this.easing,c):d=a.options.easing.call(this.easing,b,0,1,a.options.duration),e=a.startValues,f=a.diffValues;for(g in f)this.setObjectProperty(a.obj,g,e[g],f[g],d);return!0},setObjectProperty:function(a,b,c,e,f){if(d.isNumber(c))a[b]=c+e*f;else for(var g in c)this.setObjectProperty(a[b],g,c[g],e[g],f)},setEndValues:function(a){var b=a.obj,c=a.startValues,d=a.diffValues;for(var e in a.properties)this.setObjectProperty(b,e,c[e],d[e],1);this.core.timeline.running||this.core.draw.redraw(!0)},getAnimateArguments:function(a){var b,d,e,f;typeof a[0]=="number"?b=a[0]:typeof a[0]=="string"?a[0]in this.durations?b=this.durations[a[0]]:a[0]in this.easing&&(d=this.easing[a[0]]):typeof a[0]=="boolean"?e=a[0]:typeof a[0]=="function"&&typeof a[1]=="function"&&(d=a[0],f=a[1]),typeof a[1]=="string"?d=this.easing[a[1]]:typeof a[1]=="function"&&(a[2]!==c?d=a[1]:f=a[1]),a[2]!==c&&(typeof a[2]=="function"?f=a[2]:e=!!a[2]),a[3]!==c&&(f=a[3]),d||(d=typeof a[0]=="string"?a[0]:"",d=~d.indexOf("cubic-bezier")?d:c,d||(d=typeof a[1]=="string"?a[1]:"",d=~d.indexOf("cubic-bezier")?d:c),d&&(d=this.getCustomCubicBezier(d))),b=b||this.durations[this.defaults.duration],d=d||this.easing[this.defaults.easing],e=e!==c?e:!1,f=f||function(){};return{duration:b,easing:d,queue:e?c:"default",callback:f}},getCustomCubicBezier:function(a){var b,c,d,e,f;b=a.match(/cubic-bezier\(\s*(.*?),\s*(.*?),\s*(.*?),\s*(.*?)\)/);if(!!b){c=isNaN(parseFloat(b[1]))?0:parseFloat(b[1]),d=isNaN(parseFloat(b[2]))?0:parseFloat(b[2]),e=isNaN(parseFloat(b[3]))?1:parseFloat(b[3]),f=isNaN(parseFloat(b[4]))?1:parseFloat(b[4]);return function(a){return this.cubicBezier(c,d,e,f,a)}}},stop:function(a){for(var b in a.animationQueues)a.animationQueues[b].clear(!1)},finish:function(a){for(var b in a.animationQueues)a.animationQueues[b].clear(!0)},delay:function(a,b,c){var d=a.animationQueues[c&&c.queue||"default"];d&&d.add({type:"delay",duration:b||0})},mainTimer:{animations:[],add:function(a){this.animations.push(a),this.animations.length===1&&this.start()},remove:function(a){this.animations.splice(this.animations.indexOf(a),1),this.animations.length===0&&this.stop()},start:function(){this.tick()},stop:function(){cancelAnimationFrame(this.timer)},tick:function(){var b=this;setTimeout(function(){b.timer=requestAnimationFrame(function(){b.tick()});var c=b.animations,d;for(var e=0,f=c.length;e0){this.isRunning=!0;var b=this.list[0],c=this;b.type==="delay"?setTimeout(function(){c.advance()},b.duration):a.runAnimation(b,function(){c.advance()})}},advance:function(){this.list.shift(),this.isRunning=!1,this.run()},clear:function(b){if(this.isRunning){var c=this.list[0];c.cancelled=!0,b&&(a.setEndValues(c),c.options.callback.call(c.obj)),this.isRunning=!1,a.mainTimer.remove(c)}this.list.length=0}});return this.get(b,d)},get:function(a,b){return a.animationQueues[b]}},easing:{"ease-in":function(a){return this.cubicBezier(.42,0,1,1,a)},"ease-out":function(a){return this.cubicBezier(0,0,.58,1,a)},"ease-in-out":function(a){return this.cubicBezier(.42,0,.58,1,a)},linear:function(a){return a},"ease-in-quad":function(a,b,c,d){return c*(a/=d)*a+b},"ease-out-quad":function(a,b,c,d){return-c*(a/=d)*(a-2)+b},"ease-in-out-quad":function(a,b,c,d){if((a/=d/2)<1)return c/2*a*a+b;return-c/2*(--a*(a-2)-1)+b},"ease-in-cubic":function(a,b,c,d){return c*(a/=d)*a*a+b},"ease-out-cubic":function(a,b,c,d){return c*((a=a/d-1)*a*a+1)+b},"ease-in-out-cubic":function(a,b,c,d){if((a/=d/2)<1)return c/2*a*a*a+b;return c/2*((a-=2)*a*a+2)+b},"ease-in-quart":function(a,b,c,d){return c*(a/=d)*a*a*a+b},"ease-out-quart":function(a,b,c,d){return-c*((a=a/d-1)*a*a*a-1)+b},"ease-in-out-quart":function(a,b,c,d){if((a/=d/2)<1)return c/2*a*a*a*a+b;return-c/2*((a-=2)*a*a*a-2)+b},"ease-in-quint":function(a,b,c,d){return c*(a/=d)*a*a*a*a+b},"ease-out-quint":function(a,b,c,d){return c*((a=a/d-1)*a*a*a*a+1)+b},"ease-in-out-quint":function(a,b,c,d){if((a/=d/2)<1)return c/2*a*a*a*a*a+b;return c/2*((a-=2)*a*a*a*a+2)+b},"ease-in-sine":function(a,b,c,d){return-c*Math.cos(a/d*(Math.PI/2))+c+b},"ease-out-sine":function(a,b,c,d){return c*Math.sin(a/d*(Math.PI/2))+b},"ease-in-out-sine":function(a,b,c,d){return-c/2*(Math.cos(Math.PI*a/d)-1)+b},"ease-in-expo":function(a,b,c,d){return a==0?b:c*Math.pow(2,10*(a/d-1))+b},"ease-out-expo":function(a,b,c,d){return a==d?b+c:c*(-Math.pow(2,-10*a/d)+1)+b},"ease-in-out-expo":function(a,b,c,d){if(a==0)return b;if(a==d)return b+c;if((a/=d/2)<1)return c/2*Math.pow(2,10*(a-1))+b;return c/2*(-Math.pow(2,-10*--a)+2)+b},"ease-in-circ":function(a,b,c,d){return-c*(Math.sqrt(1-(a/=d)*a)-1)+b},"ease-out-circ":function(a,b,c,d){return c*Math.sqrt(1-(a=a/d-1)*a)+b},"ease-in-out-circ":function(a,b,c,d){if((a/=d/2)<1)return-c/2*(Math.sqrt(1-a*a)-1)+b;return c/2*(Math.sqrt(1-(a-=2)*a)+1)+b},"ease-in-elastic":function(a,b,c,d,e,f){e=e||0;if(a==0)return b;if((a/=d)==1)return b+c;f||(f=d*.3);if(e1?1:r<0?0:r;w=Math.abs(n*r*r*r+o*r*r+p*r*q);return w}}};return a};d.registerModule("animation",o);var p=function(){var a=function(a,b,c,d,e){var f=e.style.getStroke(a.stroke);f[b]=c,a.stroke=e.style.getStroke(f,"string")};return{id:0,shapeType:"rectangular",type:"",origin:{x:0,y:0},events:{},children:[],added:!1,opacity:1,rotation:0,composition:"source-over",scalingX:1,scalingY:1,pointerEvents:!0,animationQueues:{},_:{x:0,y:0,abs_x:0,abs_y:0,rotation:0,width:0,height:0,drawn:!1,stroke:"",strokeColor:"",strokeWidth:0,strokePosition:"center",cap:"butt",join:"miter",miterLimit:10,fill:"",shadow:{offsetX:0,offsetY:0,blur:0,color:"transparent"}},set strokeColor(b){a(this,"color",b,"strokeColor",this.core)},set strokeWidth(b){a(this,"width",b,"strokeWidth",this.core)},set strokePosition(b){a(this,"pos",b,"strokePosition",this.core)},set stroke(a){typeof a!="string"&&(a=this.core.style.getStroke(a,"string"));var b=this.core.style.getStroke(a);if(~b.color.indexOf("image(")){var c=/image\((.*?)(,(\s|)(repeat|repeat-x|repeat-y|no-repeat)|)\)/.exec(b.color),d=c[1],e=c[4]||"repeat",f=new Image,g=this;f.src=d,this._.strokepattern_loading=!0,this._.strokepattern_redraw=!1,f.onload=function(){g._.strokeColor=g.core.canvas.createPattern(this,e),g._.strokepattern_loading=!1,g._.strokepattern_redraw&&(g._.strokepattern_redraw=!1,g.redraw())}}else this._.strokeColor=b.color;this._.strokeWidth=b.width,this._.strokePosition=b.pos,this._.stroke=a},set cap(a){var b=["butt","round","square"];this._.cap=~b.indexOf(a)?a:"butt"},set join(a){var b=["round","bevel","miter"];this._.join=~b.indexOf(a)?a:"miter"},set miterLimit(a){this._.miterLimit=isNaN(parseFloat(a))?10:parseFloat(a)},get stroke(){return this._.stroke},get strokeColor(){if(this._.strokepattern_loading){this._.strokepattern_redraw=!0;return""}if(~(this._.strokeColor+"").indexOf("CanvasPattern"))return this._.strokeColor;if(!~this._.strokeColor.indexOf("gradient"))return this._.strokeColor;var a=this.getOrigin();if(this.shapeType==="rectangular"){var b=this.strokePosition==="outside"?this.strokeWidth:this.strokePosition==="center"?this.strokeWidth/2:0;return this.core.style.getGradient(this._.strokeColor,this.abs_x-a.x-b,this.abs_y-a.y-b,this.width+b*2,this.height+b*2)}if(this.shapeType==="radial"){var c=this.radius+this.strokeWidth/2;a.x+=this.radius,a.y+=this.radius;return this.core.style.getGradient(this._.strokeColor,this.abs_x-a.x-this.radius,this.abs_y-a.y-this.radius,c*2,c*2)}},get strokeWidth(){return this._.strokeWidth},get strokePosition(){return this._.strokePosition},get cap(){return this._.cap},get join(){return this._.join},get miterLimit(){return this._.miterLimit},set fill(a){if(~a.indexOf("image(")){var b=/image\((.*?)(,(\s|)(repeat|repeat-x|repeat-y|no-repeat)|)\)/.exec(a),c=b[1],d=b[4]||"repeat",e=new Image,f=this;e.src=c,this._.pattern_loading=!0,this._.pattern_redraw=!1,e.onload=function(){f._.fill=f.core.canvas.createPattern(this,d),f._.pattern_loading=!1,f._.pattern_redraw&&(f._.pattern_redraw=!1,f.redraw())}}else this._.fill=a},get fill(){if(this._.pattern_loading){this._.pattern_redraw=!0;return""}if(~(this._.fill+"").indexOf("CanvasPattern"))return this._.fill;if(!~this._.fill.indexOf("gradient"))return this._.fill;var a=this.getOrigin();if(this.shapeType==="rectangular")return this.core.style.getGradient(this._.fill,this.abs_x-a.x,this.abs_y-a.y,this.width,this.height);if(this.shapeType==="radial")return this.core.style.getGradient(this._.fill,this.abs_x-a.x-this.radius,this.abs_y-a.y-this.radius,this.radius*2,this.radius*2)},set shadow(a){typeof a!="string"&&(a=this.core.style.getShadow(a,"string"));var b=this.core.style.getShadow(a);this._.shadow=b},set shadowOffsetX(a){isNaN(parseFloat(a))||(this._.shadow.offsetX=parseFloat(a))},set shadowOffsetY(a){isNaN(parseFloat(a))||(this._.shadow.offsetY=parseFloat(a))},set shadowBlur(a){isNaN(parseFloat(a))||(this._.shadow.blur=parseFloat(a))},set shadowColor(a){this.core.style.isColor(a)&&(this._.shadow.color=a)},get shadow(){return this._.shadow},get shadowOffsetX(){return this._.shadow.offsetX},get shadowOffsetY(){return this._.shadow.offsetY},get shadowBlur(){return this._.shadow.blur},get shadowColor(){return this._.shadow.color},set x(a){this._.x=a,this._.abs_x=a+(this.parent!==c&&this.parent!==this.core?this.parent.abs_x:0);var b=this.children,d=b.length,e;for(e=0;e-1?e-=b.abs_x:i.indexOf(k)>-1&&(e-=b.abs_y)),d[k]=e}}},j(this,f),f.fill=this._.fill,l=this.core.style.getStroke(this.stroke),f.strokeColor=l.color,e=d.extend(e,f,a),e.id=++this.core.lastObjectID,typeof e.init=="function"&&e.init(),n=this.children;if(n.length>0)for(m=0;m0&&(a.lineWidth=this.strokeWidth,a.strokeStyle=this.strokeColor,this.strokePosition==="outside"?a.strokeRect(c-this.strokeWidth/2,d-this.strokeWidth/2,this.width+this.strokeWidth,this.height+this.strokeWidth):this.strokePosition==="center"?a.strokeRect(c,d,this.width,this.height):this.strokePosition==="inside"&&a.strokeRect(c+this.strokeWidth/2,d+this.strokeWidth/2,this.width-this.strokeWidth,this.height-this.strokeWidth)),a.closePath();return this}},a)};d.registerDisplayObject("rectangle",r);var s=function(a,b){return d.extend({core:b,_:d.extend({},b.displayObject._,{hasBeenDrawn:!1}),shapeType:"rectangular",loaded:!1,firstDrawn:!1,tile:!1,tile_width:0,tile_height:0,tile_spacing_x:0,tile_spacing_y:0,init:function(){var a=this,b;this.image!==c&&(this.img=new Image,this.img.onload=function(){a.loaded=!0,a.width!==0?a.height===0&&(a.height=a.width/(this.width/this.height)):a.width=this.width,a.height!==0?a.width===0&&(a.width=a.height/(this.height/this.width)):a.height=this.height,a.tile_width=a.tile_width===0?a.width:a.tile_width,a.tile_height=a.tile_height===0?a.height:a.tile_height,a._.hasBeenDrawn&&a.core.redraw()},this.img.src=this.image.src||this.image||"")},draw:function(){var a=this.core.canvas,b=this,d=this.getOrigin(),e=this.abs_x-d.x,f=this.abs_y-d.y,g,h;if(this.loaded&&this.core.draw.objects[this.zIndex]!==c&&this.img.width>0&&this.img.height>0){g=this.width===0?this.img.width:this.width,h=this.height===0?this.img.height:this.height;if(this.tile){var i=Math.ceil(g/this.tile_width),j=Math.ceil(h/this.tile_height),k,l;a.save(),a.beginPath(),a.moveTo(e,f),a.lineTo(e+g,f),a.lineTo(e+g,f+h),a.lineTo(e,f+h),a.lineTo(e,f),a.clip();for(l=0;l0&&(a.lineWidth=this.strokeWidth,a.strokeStyle=this.strokeColor,a.strokeRect(e,f,g,h)),this.firstDrawn===!1&&(this.firstDrawn=!0,clearTimeout(this.loadtimer))}else clearTimeout(this.loadtimer),this.loadtimer=setTimeout(function(){b.draw()},100);this._.hasBeenDrawn=!0;return this}},a)};d.registerDisplayObject("image",s,"init");var t=[],u=function(a,c){var e=function(a,b,c,d,e){var f=e.style.getFont(a.font);f[b]=c,a._.font=e.style.getFont(f,"string"),d==="lineHeight"?(a._.lineHeight=isNaN(parseInt(c,10))?1:parseInt(c,10),a._.lineHeightUnit=typeof c=="string"?c.indexOf("px")>-1?"px":"relative":"relative"):a._[d]=c};return d.extend({core:c,shapeType:"rectangular",align:"start",baseline:"top",_:d.extend({},c.displayObject._,{hasBeenDrawn:!1,font:"normal normal normal 16px/1 sans-serif",style:"normal",variant:"normal",weight:"normal",size:16,lineHeight:1,family:"sans-serif",text:"",width:0,height:0,lines:[]}),set font(a){typeof a!="string"&&(a=this.core.style.getFont(a,"string"));var b=this.core.style.getFont(a);a=this.core.style.getFont(b,"string"),this._.style=b.style,this._.variant=b.variant,this._.weight=b.weight,this._.size=b.size,this._.lineHeight=b.lineHeight,this._.lineHeightUnit=b.lineHeightUnit,this._.family=b.family,this._.font=a,this.initWebFont(),this.setDimensions()},set style(a){e(this,"style",a,"style",this.core),this.initWebFont(),this.setDimensions()},set variant(a){e(this,"variant",a,"variant",this.core),this.initWebFont(),this.setDimensions()},set weight(a){e(this,"weight",a,"weight",this.core),this.initWebFont(),this.setDimensions()},set size(a){e(this,"size",a,"size",this.core),this.setDimensions()},set lineHeight(a){e(this,"lineHeight",a,"lineHeight",this.core),this.setDimensions()},set family(a){e(this,"family",a,"family",this.core),this.initWebFont(),this.setDimensions()},set text(a){this._.text=a,this.setDimensions()},set width(a){return},set height(a){return},get font(){return this._.font},get style(){return this._.style},get variant(){return this._.variant},get weight(){return this._.weight},get size(){return this._.size},get lineHeight(){return this._.lineHeight+(this._.lineHeightUnit==="px"?"px":0)},get family(){return this._.family},get text(){return this._.text},get width(){return this._.width},get height(){return this._.height},init:function(){this._.initialized=!0,this.initWebFont(),this.setDimensions()},setDimensions:function(){if(this._.initialized){var a,b,c,d,e,f,g,h,i;a=this.core.canvas,a.fillStyle=this.fill,a.font=this.font,b=(this.text+"").split("\n"),c=b.length,e=0,f=0,i=[];for(g=0;ge?h.width:e,this._.lineHeightUnit==="px"?d=this._.lineHeight:d=this.size*this._.lineHeight,f+=d,i.push({text:b[g],width:h.width,height:d});this._.width=e,this._.height=f,this._.lines=i}},initWebFont:function(){var a=this.style+" "+this.variant+" "+this.weight+" 0px "+this.family;if(!(t.indexOf(a)>-1)){t.push(a);var c=this,d=this.core,e;e=b.createElement("span"),e.style.font=a,b.body.appendChild(e),setTimeout(function(){b.body.removeChild(e),c._.hasBeenDrawn&&d.redraw()},1e3)}},getAlignOffset:function(){var a={start:this.core.canvasElement.dir==="rtl"?-this.width:0,end:this.core.canvasElement.dir==="rtl"?0:-this.width,left:0,center:-this.width/2,right:-this.width};return a[this.align]||0},getBaselineOffset:function(){var a={top:this.size*.82,hanging:this.size*.65,middle:this.size*.31,alphabetic:0,ideographic:this.size*-0.05,bottom:this.size*-0.22};return a[this.baseline]||0},draw:function(){var a,b,c,d,e,f,g,h,i,j,k;a=this.core.canvas,b=this._.lines,c=this.getAlignOffset(),d=this.getBaselineOffset(),e=this._.lineHeightUnit==="px"?this._.lineHeight/this.size:this._.lineHeight,f=this.baseline!=="top"?this.size*(e-1)/2:0,g=this.getOrigin(),h=this.abs_x-g.x-c,i=this.abs_y-g.y+d-f,a.beginPath(),a.font=this.font,a.textAlign=this.align,a.textBaseline="alphabetic";if(this.strokeWidth>0){a.lineWidth=this.strokeWidth,a.strokeStyle=this.strokeColor;for(j=0,k=b.length;j0&&this.start!==this.end&&(a.beginPath(),this.pieSection&&a.moveTo(c,d),a.arc(c,d,this.radius,this.start*Math.PI/180,this.end*Math.PI/180,this.direction==="anticlockwise"),this.fill!==""&&(a.fillStyle=this.fill,a.fill()),this.strokeWidth>0&&(a.lineWidth=this.strokeWidth,a.strokeStyle=this.strokeColor,a.stroke()),a.closePath());return this}},a)};d.registerDisplayObject("arc",v);var w=function(a,b){return d.extend({core:b,shapeType:"radial",_:d.extend({},b.displayObject._,{radius_x:0,radius_y:0}),set radius(a){this._.radius_x=a,this._.radius_y=a},set radius_x(a){this._.radius_x=a},set radius_y(a){this._.radius_y=a},get radius(){return this._.radius_x},get radius_x(){return this._.radius_x},get radius_y(){return this._.radius_y},draw:function(){var a=this.core.canvas,b=this.getOrigin(),c=this.abs_x-b.x,d=this.abs_y-b.y;a.beginPath();if(this.radius_x===this.radius_y)a.arc(c,d,this.radius_x,0,Math.PI*2,!1);else{var e=.276142374915397,f={x:this.radius_x*2*e,y:this.radius_y*2*e};a.moveTo(c-this.radius_x,d),a.bezierCurveTo(c-this.radius_x,d-f.y,c-f.x,d-this.radius_y,c,d-this.radius_y),a.bezierCurveTo(c+f.x,d-this.radius_y,c+this.radius_x,d-f.y,c+this.radius_x,d),a.bezierCurveTo(c+this.radius_x,d+f.y,c+f.x,d+this.radius_y,c,d+this.radius_y),a.bezierCurveTo(c-f.x,d+this.radius_y,c-this.radius_x,d+f.y,c-this.radius_x,d)}this.fill!==""&&(a.fillStyle=this.fill,a.fill()),this.strokeWidth>0&&(a.lineWidth=this.strokeWidth,a.strokeStyle=this.strokeColor,a.stroke()),a.closePath();return this}},a)};d.registerDisplayObject("ellipse",w);var x=function(a,b){return d.extend({core:b,shapeType:"radial",sides:3,_:d.extend({},b.displayObject._,{radius:0,side:0}),set radius(a){this._.radius=a,this._.side=2*this._.radius*Math.sin(Math.PI/this.sides)},set side(a){this._.side=a,this._.radius=this._.side/2/Math.sin(Math.PI/this.sides)},get radius(){return this._.radius},get side(){return this._.side},draw:function(){var a=this.core.canvas,b=this.getOrigin(),c=this.abs_x-b.x,d=this.abs_y-b.y,e={x:0,y:0},f=this.sides,g=this.radius,h,i,j;a.beginPath();for(j=0;j<=f;j++)h=c+g*Math.cos(j*2*Math.PI/f),i=d+g*Math.sin(j*2*Math.PI/f),j===0?(a.moveTo(h,i),e={x:h,y:i}):j==f?a.lineTo(e.x,e.y):a.lineTo(h,i);a.closePath(),this.fill!==""&&(a.fillStyle=this.fill,a.fill()),this.strokeWidth>0&&(a.lineWidth=this.strokeWidth,a.strokeStyle=this.strokeColor,a.stroke());return this}},a)};d.registerDisplayObject("polygon",x);var y=function(a,b){return d.extend({core:b,shapeType:"radial",_:d.extend({},b.displayObject._,{start_x:0,start_y:0,end_x:0,end_y:0,x:0,y:0,abs_x:0,abs_y:0}),children:[],set start(a){this._.start_x=a.x+(this.parent&&!this.parent.isCore?this.parent._.abs_x:0),this._.start_y=a.y+(this.parent&&!this.parent.isCore?this.parent._.abs_y:0),this.setPosition()},set end(a){this._.end_x=a.x+(this.parent&&!this.parent.isCore?this.parent._.abs_x:0),this._.end_y=a.y+(this.parent&&!this.parent.isCore?this.parent._.abs_y:0),this.setPosition()},get start(){var a={x:0,y:0};this.parent&&!this.parent.isCore&&(a.x=this.parent._.abs_x,a.y=this.parent._.abs_y);var b=this;return{get x(){return b._.start_x-a.x},get y(){return b._.start_y-a.y},set x(a){b._.start_x=a+(b.parent&&!b.parent.isCore?b.parent._.abs_x:0),b.setPosition()},set y(a){b._.start_y=a+(b.parent&&!b.parent.isCore?b.parent._.abs_y:0),b.setPosition()}}},get end(){var a={x:0,y:0};this.parent&&!this.parent.isCore&&(a.x=this.parent._.abs_x,a.y=this.parent._.abs_y);var b=this;return{get x(){return b._.end_x-a.x},get y(){return b._.end_y-a.y},set x(a){b._.end_x=a+(b.parent&&!b.parent.isCore?b.parent._.abs_x:0),b.setPosition()},set y(a){b._.end_y=a+(b.parent&&!b.parent.isCore?b.parent._.abs_y:0),b.setPosition()}}},set x(a){var b,c,d,e,f;b=this._.end_x-this._.start_x,c=this.parent&&!this.parent.isCore?this.parent._.abs_x:0,this._.x=a,this._.abs_x=a+c,this._.start_x=a-b/2+c,this._.end_x=a+b/2+c,d=this.children,e=d.length;for(f=0;f0?e=a.numFrames:(e=c/d,a.numFrames=e),a.frames=[];for(f=0;f0){if(this.frame>this.frames.length)return this;g=this.frames[this.frame-1],frame_width=g.w!==c?g.w:this.width,frame_height=g.h!==c?g.h:this.height,b.drawImage(this.img,g.x,g.y,frame_width,frame_height,e,f,frame_width,frame_height),this.strokeWidth>0&&(b.lineWidth=this.strokeWidth,b.strokeStyle=this.strokeColor,b.strokeRect(e,f,frame_width,frame_height)),this.running===!1&&this.active&&(setTimeout(function(){a.loop?a.frame=a.frame===a.frames.length?1:a.frame+1:a.frame=a.frame===a.frames.length?a.frame:a.frame+1,a.running=!1,a.core.timeline.running||a.core.draw.redraw()},g.d),this.running=!0)}this.firstDrawn===!1&&(this.firstDrawn=!0,clearTimeout(this.loadtimer))}else clearTimeout(this.loadtimer),this.loadtimer=setTimeout(function(){a.draw()},100);return this},start:function(){this.startAnimation();return this},startAnimation:function(){this.active=!0,this.core.redraw();return this},stopAnimation:function(){this.active=!1;return this}},a)};d.registerDisplayObject("sprite",z,"init")})(window,document),function(){"use strict";var a=Object.prototype,b=a.__defineGetter__,c=a.__defineSetter__,d=a.__lookupGetter__,e=a.__lookupSetter__,f=a.hasOwnProperty;b&&c&&d&&e&&(Object.defineProperty||(Object.defineProperty=function(a,g,h){if(arguments.length<3)throw new TypeError("Arguments not optional");g+="";if(f.call(h,"value")){!d.call(a,g)&&!e.call(a,g)&&(a[g]=h.value);if(f.call(h,"get")||f.call(h,"set"))throw new TypeError("Cannot specify an accessor and a value")}h.get&&b.call(a,g,h.get),h.set&&c.call(a,g,h.set);return a}),Object.getOwnPropertyDescriptor||(Object.getOwnPropertyDescriptor=function(a,b){if(arguments.length<2)throw new TypeError("Arguments not optional.");b+="";var c={configurable:!0,enumerable:!0,writable:!0},g=d.call(a,b),h=e.call(a,b);if(!f.call(a,b))return c;if(!g&&!h){c.value=a[b];return c}delete c.writable,c.get=c.set=undefined,g&&(c.get=g),h&&(c.set=h);return c}),Object.defineProperties||(Object.defineProperties=function(a,b){for(var c in b)f.call(b,c)&&Object.defineProperty(a,c,b[c])}))}()