// ZIM js Interactive Media modules by Dan Zen http://danzen.com (c) 2016
// zimbuild.js adds common building functions for digidos (interactive media) http://zimjs.com
// free to use - donations welcome of course! http://zimjs.com/donate
// classes in this module require createjs namespace to exist and in particular easel.js
// available at http://createjs.com
// (borrows zim.ProportionDamp from ZIM code)
if("undefined"==typeof zog)document.write(''),document.write('');else var zim=function(t){function e(t,e){e?(t.mouseChildren=!0,t.mouseEnabled=!0,t._enabled=!0):(t.mouseChildren=!1,t.mouseEnabled=!1,t._enabled=!1)}return zon&&zog("ZIM BUILD Module"),t.ProportionDamp=function(e,o,n,i,r,a,s){function h(){isNaN(c)||(c=Math.max(c,e),c=Math.min(c,o),u=(c-e)/(o-e),g=i-n,p=a>0?n+g*u:i-g*u,b=p,f=b-z,z+=f*w.damp)}var d,l="baseMin, baseMax, targetMin, targetMax, damp, factor, targetRound";if(d=zob(t.ProportionDamp,arguments,l))return d;zot(n)&&(n=0),zot(i)&&(i=1),zot(r)&&(r=.1),zot(a)&&(a=1),zot(s)&&(s=!1),this.damp=r;var c,u,g,p,f,w=this,b=0,z=0;c=e,z=n;var v=setInterval(h,20);this.immediate=function(t){w.convert(t),h(),z=p,s&&(z=Math.round(z))},this.convert=function(t){return c=t,s?Math.round(z):z},this.dispose=function(){clearInterval(v)}},t.OPTIMIZE=!1,t.ACTIONEVENT="mousedown",t.Circle=function(e,o,n,i){function r(){zot(e)&&(e=50),zot(o)&&(o="black");var r=this;this.mouseChildren=!1;var a=this.shape=new createjs.Shape;this.addChild(a);var s=a.graphics,h=s.beginFill(o).command;if(!zot(n)){var d=s.beginStroke(n).command;zot(i)&&(i=1);var l=s.setStrokeStyle(i).command}s.dc(0,0,e),this.width=2*e,this.height=2*e,this.setBounds(-e,-e,this.width,this.height),this.setFill=function(t){zot(t)||(o=t,h.style=o)},Object.defineProperty(r,"color",{get:function(){return o},set:function(t){r.setFill(t)}}),this.setStroke=function(t){d&&!zot(t)&&(n=t,d.style=n)},this.setStrokeSize=function(t){l&&!zot(t)&&(i=t,l.width=i)},this.clone=function(){return new t.Circle(e,o,n,i)}}var a,s="radius, fill, stroke, strokeSize";return(a=zob(t.Circle,arguments,s))?a:(r.prototype=new createjs.Container,r.prototype.constructor=t.Circle,new r)},t.Rectangle=function(e,o,n,i,r,a){function s(){zot(e)&&(e=100),zot(o)&&(o=100),zot(n)&&(n="black"),zot(a)&&(a=0);var s=this;this.mouseChildren=!1;var h=this.shape=new createjs.Shape;this.addChild(h);var d=h.graphics,l=d.beginFill(n).command;if(!zot(i)){var c=d.beginStroke(i).command;zot(r)&&(r=1);var u=d.setStrokeStyle(r).command}a>0?d.rr(0,0,e,o,a):d.r(0,0,e,o),this.width=e,this.height=o,this.setBounds(0,0,this.width,this.height),this.setFill=function(t){zot(t)||(n=t,l.style=n)},Object.defineProperty(s,"color",{get:function(){return n},set:function(t){s.setFill(t)}}),this.setStroke=function(t){c&&!zot(t)&&(i=t,c.style=i)},this.setStrokeSize=function(t){u&&!zot(t)&&(r=t,u.width=r)},this.clone=function(){return new t.Rectangle(e,o,n,i,r,a)}}var h,d="width, height, fill, stroke, strokeSize, corner";return(h=zob(t.Rectangle,arguments,d))?h:(s.prototype=new createjs.Container,s.prototype.constructor=t.Rectangle,new s)},t.Triangle=function(e,o,n,i,r,a,s,h){function d(){zot(e)&&(e=100),zot(o)&&(o=e),zot(n)&&(n=e),-1==n&&(n=Math.sqrt(Math.pow(e,2)+Math.pow(o,2))),zot(i)&&(i="black"),zot(s)&&(s=!0),zot(h)&&(h=0),this.mouseChildren=!1;var d=this,l=[e,o,n];if(l.sort(function(t,e){return e-t}),aa=l[0],bb=l[1],cc=l[2],aa>bb+cc)return void zog("zim build - Triangle(): invalid triangle lengths");var c=this.shape=new createjs.Shape;this.addChild(c);var u=c.graphics,g=u.beginFill(i).command;if(!zot(r)){var p=u.beginStroke(r).command;zot(a)&&(a=1);var f=u.setStrokeStyle(a).command}u.mt(0,0),u.lt(e,0);var w,b=180*Math.acos((Math.pow(bb,2)+Math.pow(cc,2)-Math.pow(aa,2))/(2*bb*cc))/Math.PI,z=180*Math.asin(bb*Math.sin(b*Math.PI/180)/aa)/Math.PI,v=180-b-z;w=n==aa?b:n==bb?z:v;var y=Math.cos(w*Math.PI/180)*o,m=Math.sin(w*Math.PI/180)*o;this.width=Math.max(e,e-y),this.height=m,this.setBounds(0,0,this.width,this.height),c.y=this.height,u.lt(e-y,0-m),u.cp(),s&&(this.regX=this.width/2,this.regY=this.height/2+h),this.setFill=function(t){zot(t)||(i=t,g.style=i)},Object.defineProperty(d,"color",{get:function(){return i},set:function(t){d.setFill(t)}}),this.setStroke=function(t){p&&!zot(t)&&(r=t,p.style=r)},this.setStrokeSize=function(t){f&&!zot(t)&&(a=t,f.width=a)},this.clone=function(){return new t.Triangle(e,o,n,i,r,a,s,h)}}var l,c="a, b, c, fill, stroke, strokeSize, center, adjust";return(l=zob(t.Triangle,arguments,c))?l:(d.prototype=new createjs.Container,d.prototype.constructor=t.Triangle,new d)},t.Label=function(o,n,i,r,a,s,h){function d(){zot(o)&&(o="LABEL"),""==o&&(o=" "),zot(n)&&(n=36),zot(i)&&(i="arial"),zot(r)&&(r="black"),zot(a)&&(a=r),zot(s)&&(s=-1),zot(h)&&(h=14);var d=this;this.mouseChildren=!1;var l=this.label=new createjs.Text(String(o),n+"px "+i,r);l.textBaseline="alphabetic",l.textAlign="left",-1!=s&&h>0&&(l.shadow=new createjs.Shadow(s,3,3,h)),this.addChild(l);var c=new createjs.Shape;c.graphics.f("black").r(0,0,this.getBounds().width,this.getBounds().height),this.hitArea=c,this.width=this.getBounds().width,this.height=this.getBounds().height,this.setBounds(0,0,this.width,this.height),l.y=n-n/6,Object.defineProperty(d,"text",{get:function(){var t=" "==l.text?"":l.text;return t},set:function(t){zot(t)&&(t=" "),l.text=t,d.setBounds(0,0,l.getBounds().width,l.getBounds().height)}}),Object.defineProperty(d,"color",{get:function(){return r},set:function(e){r=e,l.color=r,!t.OPTIMIZE&&d.getStage()&&d.getStage().update()}}),Object.defineProperty(d,"rollColor",{get:function(){return a},set:function(t){a=t}}),this._enabled=!0,Object.defineProperty(d,"enabled",{get:function(){return d._enabled},set:function(o){e(d,o),l.color=r,d.mouseChildren=!1,!t.OPTIMIZE&&d.getStage()&&d.getStage().update()}}),this.showRollColor=function(t){zot(t)&&(t=!0),t?l.color=a:l.color=r,d.getStage()&&d.getStage().update()},this.on("mouseover",function(t){d.showRollColor()}),this.on("mouseout",function(t){d.showRollColor(!1)}),this.clone=function(){return new t.Label(d.text,n,i,r,a,s,h)},this.dispose=function(){d.removeAllEventListeners()}}var l,c="text, size, font, color, rollColor, shadowColor, shadowBlur";return(l=zob(t.Label,arguments,c))?l:(d.prototype=new createjs.Container,d.prototype.constructor=t.Label,new d)},t.Button=function(o,n,i,r,a,s,h,d,l,c,u){function g(){function g(t){f.on("mouseout",p),w.color=a,f.label.showRollColor(),f.getStage()&&f.getStage().update()}function p(t){f.off("mouseout",p),w.color=r,f.label.showRollColor(!1),f.getStage()&&f.getStage().update()}zot(o)&&(o=200),zot(n)&&(n=60),zot(r)&&(r="#C60"),zot(a)&&(a="#F93"),zot(s)&&(s=null),zot(h)&&(h=1),zot(d)&&(d=20),zot(l)&&(l="rgba(0,0,0,.3)"),zot(c)&&(c=14),zot(u)&&(u=0),zot(i)&&(i="PRESS"),("string"==typeof i||"number"==typeof i)&&(i=new t.Label(i,36,"arial","white"));var f=this;this.mouseChildren=!1,this.cursor="pointer";var w=new t.Rectangle(o,n,r,s,h,d);if(this.addChild(w),this.backing=w,u>0){var b=new createjs.Shape;b.graphics.f("#000").r(-u,-u,o+2*u,n+2*u),this.hitArea=b}-1!=l&&c>0&&(w.shadow=new createjs.Shadow(l,3,3,c)),this.setBounds(0,0,o,n),this.width=o,this.height=n,i.x=(o-i.getBounds().width)/2+1,i.y=(n-i.getBounds().height)/2+2,this.addChild(i),this.label=i,Object.defineProperty(f,"text",{get:function(){var t=" "==i.text?"":i.text;return t},set:function(t){i.text=t,i.x=(o-i.getBounds().width)/2+1,i.y=(n-i.getBounds().height)/2+2}}),Object.defineProperty(f,"color",{get:function(){return r},set:function(e){r=e,w.color=r,!t.OPTIMIZE&&f.getStage()&&f.getStage().update()}}),Object.defineProperty(f,"rollColor",{get:function(){return a},set:function(t){a=t}}),this._enabled=!0,Object.defineProperty(f,"enabled",{get:function(){return f._enabled},set:function(o){e(f,o),f.mouseChildren=!1,i.color=i.color,!t.OPTIMIZE&&f.getStage()&&f.getStage().update()}}),this.on("mouseover",g),this.dispose=function(){f.removeAllEventListeners(),f.removeChild(w),f.removeChild(buttonLabel),w=null,buttonLabel=null}}var p,f="width, height, label, color, rollColor, borderColor, borderThickness, corner, shadowColor, shadowBlur, hitPadding";return(p=zob(t.Button,arguments,f))?p:(g.prototype=new createjs.Container,g.prototype.constructor=t.Button,new g)},t.CheckBox=function(o,n,i,r,a){function s(){function s(t){h=!h,d.setChecked(h),d.dispatchEvent("change")}zot(o)&&(o=60),zot(n)&&(n=null),("string"==typeof n||"number"==typeof n)&&(n=new t.Label(n,5*o/6,"arial",r));var h=zot(i)?!1:i;zot(r)&&(r="black"),zot(a)&&(a=10),this.setBounds(-a,-a,o+2*a,o+2*a);var d=this;this.cursor="pointer";var l=new createjs.Shape,c=l.graphics;c.f("rgba(255,255,255,.5)").r(0,0,o,o),c.s(r).ss(o/10).r(o/7,o/7,o-o/7*2,o-o/7*2),this.addChild(l);var u=o;n&&(this.addChild(n),n.x=1.3*o+a,n.y=o/8,this.label=n,this.setBounds(-a,-a,o+3*a+n.getBounds().width,Math.max(o+2*a,n.getBounds().height)),u=n.x+n.width);var g=new createjs.Shape;c=g.graphics,c.f("rgba(0,0,0,.01)").r(this.getBounds().x,this.getBounds().y,u+2*a,this.getBounds().height),this.hitArea=g;var p=new createjs.Shape,f=p.graphics,w="#000";f.f(w).p("AnQAdICBiaIEEDZIF8nfICfB4In/KPg");var b=95;p.setBounds(-b/2,-b/2,b,b);var z=o/(b+66);p.scaleX=p.scaleY=z,p.alpha=.9,p.x=o/2,p.y=o/2,h&&this.addChild(p),this.on("mousedown"==t.ACTIONEVENT?"mousedown":"click",s),Object.defineProperty(d,"checked",{get:function(){return h},set:function(t){d.checked!=t&&d.dispatchEvent("change"),d.setChecked(t)}}),Object.defineProperty(p,"color",{get:function(){return w},set:function(e){h&&d.removeChild(p),p=new createjs.Shape,f=p.graphics,w=e,f.f(w).p("AnQAdICBiaIEEDZIF8nfICfB4In/KPg"),p.scaleX=p.scaleY=z,p.alpha=.9,p.x=o/2,p.y=o/2,h&&d.addChild(p),!t.OPTIMIZE&&d.getStage()&&d.getStage().update()}}),Object.defineProperty(d,"check",{get:function(){return p},set:function(t){zog("ZIM CheckBox - check is read only")}}),this._enabled=!0,Object.defineProperty(d,"enabled",{get:function(){return d._enabled},set:function(t){e(d,t)}}),this.setChecked=function(e){zot(e)&&(e=!0),h=e,h?d.addChild(p):d.removeChild(p),!t.OPTIMIZE&&d.getStage()&&d.getStage().update()},this.dispose=function(){d.removeAllEventListeners()}}var h,d="size, label, startChecked, color, margin";return(h=zob(t.CheckBox,arguments,d))?h:(s.prototype=new createjs.Container,s.prototype.constructor=t.CheckBox,new s)},t.RadioButtons=function(o,n,i,r,a,s,h){function d(){function d(t){var e=p.getChildIndex(t.target);h&&u.selectedIndex==e||(u.setSelected(e),u.dispatchEvent("change"))}function l(){for(var e,s=!1,h=n.length-1;h>=0;h--)e=n[h],e.selected&&e.selected===!0&&(s?e.selected="false":(s=!0,u.id=e.id));p.removeAllChildren();for(var d,l=0,h=0;h=0){o=p.getChildAt(e);var i=-2;g&&(i=g.index),g=o.obj}-1==e||i==g.index?(g=null,u.id=null,u.label=null,u.text=""):(o.addChild(o.check),u.id=g.id,u.label=g.label,u.label&&(u.text=u.label.text)),!t.OPTIMIZE&&u.getStage()&&u.getStage().update()}},Object.defineProperty(u,"selected",{get:function(){return g},set:function(t){zog("ZIM RadioButton - selected is read only")}}),Object.defineProperty(u,"selectedIndex",{get:function(){return g?g.index:-1},set:function(t){var e=t;h&&u.selectedIndex==e||(u.setSelected(e),u.dispatchEvent("change"))}}),this._enabled=!0,Object.defineProperty(u,"enabled",{get:function(){return u._enabled},set:function(t){e(u,t)}}),this.dispose=function(){u.removeAllEventListeners()}}}var l,c="size, buttons, vertical, color, spacing, margin, always";return(l=zob(t.RadioButtons,arguments,c))?l:(d.prototype=new createjs.Container,d.prototype.constructor=t.RadioButtons,new d)},t.Pane=function(e,o,n,i,r,a,s,h,d,l,c,u,g){function p(){function p(){e.removeChild(z),s&&(isNaN(z.resetX)||(z.x=z.resetX),isNaN(z.resetY)||(z.y=z.resetY))}function f(t,i){return t=Math.max(o/2,Math.min(e.getBounds().width-o/2,t)),i=Math.max(n/2,Math.min(e.getBounds().height-n/2,i)),{x:t,y:i}}if(zot(e)||!e.getBounds)return void zog("zim build - Pane(): Please pass in a reference to a container with bounds set as first parameter");if(!e.getBounds())return void zog("zim build - Pane(): Please give the container bounds using setBounds()");if(zot(e.getStage))return void zog("zim build - Pane(): Please give the container that has a stage property");zot(o)&&(o=200),zot(n)&&(n=200),zot(i)&&(i=null),("string"==typeof i||"number"==typeof i)&&(i=new t.Label(i,40,"arial","black")),zot(r)&&(r="white"),zot(a)&&(a=!1),zot(s)&&(s=!0),zot(h)&&(h=!0),zot(d)&&(d=20),zot(l)&&(l=.14),zot(c)&&(c="rgba(0,0,0,.3)"),zot(u)&&(u=20),zot(g)&&(g=!0);var w=this.backing=new createjs.Shape,b=w.graphics;b.beginFill("black"),b.drawRect(-5e3,-5e3,1e4,1e4),this.setBounds(-o/2,-n/2,o,n),w.alpha=l;var z=this;w.on("mousedown"==t.ACTIONEVENT?"mousedown":"click",function(t){p(),e.getStage().update(),z.dispatchEvent("close"),t.stopImmediatePropagation()}),w.on("mousedown",function(t){t.stopImmediatePropagation()}),h&&this.addChild(w);var v=this.display=new createjs.Shape;if(v.setBounds(0,0,o,n),v.regX=o/2,v.regY=n/2,b=v.graphics,b.beginFill(r),b.drawRoundRect(0,0,o,n,d),-1!=c&&u>0&&(v.shadow=new createjs.Shadow(c,8,8,u)),v.on("click",function(t){t.stopImmediatePropagation()}),this.resetX,this.resetY,a){v.cursor="pointer";var y,m;v.on("mousedown",function(t){isNaN(z.resetX)&&(z.resetX=z.x),isNaN(z.resetY)&&(z.resetY=z.y),y=t.stageX-z.x,m=t.stageY-z.y,v.cursor="move"}),v.on("pressmove",function(t){var o=f(t.stageX-y,t.stageY-m);z.x=o.x,z.y=o.y,e.getStage().update()}),this.on("pressup",function(t){v.cursor="pointer",e.getStage().update()})}this.addChild(v),i&&(g&&(i.x=-i.getBounds().width/2,i.y=-i.getBounds().height/2),this.addChild(i),this.label=i,this.text=i.text),Object.defineProperty(z,"text",{get:function(){var t=" "==i.text?"":i.text;return t},set:function(t){i.text=t,g&&(i.x=-i.getBounds().width/2,i.y=-i.getBounds().height/2)}}),this.hide=function(){p(),t.OPTIMIZE||e.getStage().update()},this.show=function(){g&&isNaN(z.resetX)&&(z.x=e.getBounds().width/2,z.y=e.getBounds().height/2),e.addChild(z),e.getStage()&&e.getStage().update()},this.dispose=function(){v.removeAllEventListeners(),z.removeChild(v),v=null}}var f,w="container, width, height, label, color, drag, resets, modal, corner, backingAlpha, shadowColor, shadowBlur, center";return(f=zob(t.Pane,arguments,w))?f:(p.prototype=new createjs.Container,p.prototype.constructor=t.Pane,new p)},t.Waiter=function(e,o,n,i,r,a,s){function h(){if(zot(e)||!e.getBounds)return void zog("zim build - Waiter(): Please pass in a reference to a container with bounds set as first parameter");if(!e.getBounds())return void zog("zim build - Waiter(): Please give the container bounds using setBounds()");if(zot(e.getStage))return void zog("zim build - Waiter(): Please give the container that has a stage property");zot(o)&&(o=600),zot(n)&&(n="orange"),zot(i)&&(i="white"),zot(r)&&(r=16),zot(a)&&(a="rgba(0,0,0,.3)"),zot(s)&&(s=14);var t=40,h=3,d=.6*t/2,l=(t-2*d)/2,c=h*(2*d+l)+l;this.setBounds(-c/2,-t/2,c,t);var u=this,g=this.display=new createjs.Shape;this.addChild(g),g.setBounds(0,0,c,t),g.regX=c/2,g.regY=t/2;var p=g.graphics;p.f(n),p.rr(0,0,c,t,r),-1!=a&&s>0&&(g.shadow=new createjs.Shadow(a,3,3,s)),g.on("click",function(t){t.stopImmediatePropagation()});var f=new createjs.Container;this.addChild(f);for(var w,b=0;h>b;b++)w=new createjs.Shape,w.graphics.f(i).dc(0,0,d),w.x=(b-(h-1)/2)*(2*d+l),f.addChild(w),w.cache(-d,-d,2*d,2*d),w.alpha=0;e.getStage().update(),this.hide=function(){createjs.Tween.get(u,{override:!0}).to({alpha:0},300).call(function(){createjs.Ticker.off("tick",u.ticker),e.removeChild(u),e.getStage().update()})},this.show=function(){for(var t,n=0,i=0;io.length-1&&(e=0),0>e&&(e=o.length-1);else{if(e>o.length-1)return void(C.cursor="default");if(C.cursor="pointer",0>e)return}p(e),b.dispatchEvent("change")}function p(e){f=e,a.text=o[f],a.x=C.x+(C.getBounds().width-a.getBounds().width)/2,a.y=C.y+(C.getBounds().height-a.getBounds().height)/2,y.alpha=1,x.setFill(i),y.cursor="pointer",S.alpha=1,j.setFill(i),S.cursor="pointer",u||(0==f&&(y.alpha=.8,x.setFill("#aaa"),y.cursor="default"),f==o.length-1&&(S.alpha=.8,j.setFill("#aaa"),S.cursor="default")),!t.OPTIMIZE&&a.getStage()&&a.getStage().update()}zot(o)&&(o=[0,1,2,3,4,5,6,7,8,9]),zot(n)&&(n=200),zot(i)&&(i="white"),zot(r)&&(r=null),zot(a)&&(a=""),("string"==typeof a||"number"==typeof a)&&(a=new t.Label(a,64,"arial","#555")),zot(s)&&(s=!1),zot(h)&&(h=!0),zot(d)&&(d=16),zot(l)&&(l="rgba(0,0,0,.3)"),zot(c)&&(c=14),zot(u)&&(u=!1);var f,w="mousedown"==t.ACTIONEVENT?"mousedown":"click",b=this,z=100,v=z/4;a.mouseChildren=!1,a.mouseEnabled=!1;var y=this.arrowPrev=new createjs.Container;this.addChild(y);var m=new createjs.Shape;m.graphics.f("rgba(255,255,255,.11)").r(0,0,1.5*z,1.5*z),m.regX=1.5*z/2,m.regY=1.5*z/2+v/2,y.hitArea=m;var x=new t.Triangle(z,.8*z,.8*z,i);-1!=l&&c>0&&(y.shadow=new createjs.Shadow(l,3,3,c)),y.addChild(x),y.cursor="pointer",y.on(w,function(t){g(-1)}),s?(y.rotation=0,y.x=n/2,y.y=y.getBounds().height/2):(y.rotation=-90,y.x=y.getBounds().height/2,y.y=y.getBounds().width/2);var C=this.textBox=new createjs.Shape;C.cursor="pointer",this.addChild(C),C.setBounds(0,0,n,z),null!=r&&C.graphics.s(r).ss(1.5),C.graphics.f(i).rr(0,0,n,z,d),-1!=l&&c>0&&(C.shadow=new createjs.Shadow(l,3,3,c)),s?C.y=x.height+v:C.x=x.height+v,this.addChild(a),o.length>0&&(f=0,a.text=o[f]),a.x=C.x+(C.getBounds().width-a.getBounds().width)/2,a.y=C.y+(C.getBounds().height-a.getBounds().height)/2;var S=this.arrowNext=new createjs.Container;this.addChild(S);var B=new createjs.Shape;B.graphics.f("rgba(255,255,255,.01)").r(0,0,1.5*z,1.5*z),B.regX=1.5*z/2,B.regY=1.5*z/2+v/2,S.hitArea=B;var j=new t.Triangle(z,.8*z,.8*z,i);-1!=l&&c>0&&(S.shadow=new createjs.Shadow(l,3,3,c)),S.addChild(j),S.cursor="pointer",S.on(w,function(t){g(1)}),C.on(w,function(t){g(1)}),s?(S.rotation=180,S.x=n/2,S.y=C.y+C.getBounds().height+S.getBounds().height/2+v):(S.rotation=90,S.x=C.x+C.getBounds().width+S.getBounds().height/2+v,S.y=S.getBounds().width/2),p(f),Object.defineProperty(this,"currentIndex",{get:function(){return f},set:function(t){f=Math.min(o.length-1,Math.max(0,t)),f!=b.currentIndex&&(p(f),b.dispatchEvent("change"))}}),Object.defineProperty(this,"currentValue",{get:function(){return o[f]},set:function(t){o.indexOf(t)>-1&&(f=o.indexOf(t)),f!=b.currentIndex&&(p(f),b.dispatchEvent("change"))}}),Object.defineProperty(this,"loop",{get:function(){return u},set:function(t){u=t,p(f)}}),Object.defineProperty(this,"stepperArray",{get:function(){return o},set:function(t){o=t}}),this._enabled=!0,Object.defineProperty(b,"enabled",{get:function(){return b._enabled},set:function(o){e(b,o),o?p(b.currentIndex):(y.alpha=.8,x.setFill("#aaa"),y.cursor="default",S.alpha=.8,j.setFill("#aaa"),S.cursor="default",a.mouseChildren=!1,a.mouseEnabled=!1),!t.OPTIMIZE&&a.getStage()&&a.getStage().update()}}),h&&(this.keyDownEvent=function(t){if(t||(t=event),t.keyCode>=37&&t.keyCode<=40){38==t.keyCode||39==t.keyCode?g(1):(37==t.keyCode||40==t.keyCode)&&g(-1)}},window.addEventListener("keydown",this.keyDownEvent)),this.next=function(){g(1)},this.prev=function(){g(-1)},this.dispose=function(){b.removeAllEventListeners()}}var p,f="list, width, color, strokeColor, label, vertical, arrows, corner, shadowColor, shadowBlur, loop";return(p=zob(t.Stepper,arguments,f))?p:(g.prototype=new createjs.Container,g.prototype.constructor=t.Stepper,new g)},t.Slider=function(o,n,i,r,a,s,h,d,l){function c(){function c(t){return 0==i?t:Math.round(t/i)*i}function u(t,e,o){return t=Math.max(o.x,Math.min(o.width,t)),e=Math.max(o.y,Math.min(o.height,e)),{x:t,y:e}}if(zot(o)&&(o=0),zot(n)&&(n=10),n-o==0)return void zog("ZIM Slider range must not be 0");if(zot(i)&&(i=0),zot(a)&&(a=300),zot(s)&&(s=3),zot(h)&&(h="#666"),zot(d)&&(d=!1),zot(l)&&(l=!1),zot(r)){var g=30,p=40;d&&(g=50,p=40),r=new t.Button(g,p,"","#fff","#ddd","#666",1,0,null,null,30)}d?(this.width=r.width,this.height=a+r.height,this.setBounds(-r.width/2,-r.height/2,this.width,this.height)):(this.width=a+r.width,this.height=r.height,this.setBounds(-r.width/2,-r.height/2,this.width,this.height));var f=this,w=o;this.button=r;var b,z,v,y,m;if(l&&0!=i){y=this.ticks=new createjs.Shape,this.addChild(y),m=y.graphics,m.ss(1).s(h);var x=(n-o)/i,C=a/x}if(d){if(l&&0!=i){for(var S=0;x>=S;S++)m.mt(0,C*S).lt(20,C*S);y.x=10}b=this.bar=new t.Rectangle(s,a,h),this.addChild(b),t.centerReg(r),this.addChild(r),v=b.getBounds(),z=new createjs.Rectangle(v.width/2,v.y,0,v.height)}else{if(l&&0!=i){for(var S=0;x>=S;S++)m.mt(C*S,0).lt(C*S,-20);y.y=-10}b=this.bar=new t.Rectangle(a,s,h),this.addChild(b),t.centerReg(r),this.addChild(r),v=b.getBounds(),z=new createjs.Rectangle(v.x,v.height/2,v.width,0)}r.x=z.x,r.y=z.y;var B,j,k=0;r.on("mousedown",function(t){var e=f.globalToLocal(t.stageX,t.stageY);B=e.x-r.x,j=e.y-r.y}),r.on("pressmove",function(e){var i=f.globalToLocal(e.stageX,e.stageY),s=u(i.x-B,i.y-j,z);d?(r.x=s.x,w=c(s.y/a*(n-o)),r.y=w*a/(n-o),w+=o,r.y!=k&&f.dispatchEvent("change"),k=r.y):(w=c(s.x/a*(n-o)),r.x=w*a/(n-o),w+=o,r.y=s.y,r.x!=k&&f.dispatchEvent("change"),k=r.x),!t.OPTIMIZE&&f.getStage()&&f.getStage().update()}),Object.defineProperty(this,"currentValue",{get:function(){return w},set:function(e){o>e&&(e=o),e>n&&(e=n),w=e=c(e),d?(r.y=(e-o)/(n-o)*a,k=r.y):(r.x=(e-o)/(n-o)*a,k=r.x),!t.OPTIMIZE&&f.getStage()&&f.getStage().update()}}),Object.defineProperty(this,"min",{get:function(){return o},set:function(t){zon&&zog("min is read only")}}),Object.defineProperty(this,"max",{get:function(){return n},set:function(t){zon&&zog("max is read only")}}),Object.defineProperty(this,"step",{get:function(){return i},set:function(t){zon&&zog("step is read only")}}),this._enabled=!0,Object.defineProperty(f,"enabled",{get:function(){return f._enabled},set:function(t){e(f,t)}}),this.dispose=function(){r.removeAllEventListeners()}}var u,g="min, max, step, button, barLength, barWidth, barColor, vertical, useTicks";return(u=zob(t.Slider,arguments,g))?u:(c.prototype=new createjs.Container,c.prototype.constructor=t.Slider,new c)},t.Tabs=function(o,n,i,r,a,s,h,d,l,c,u){function g(){function g(e){var o=i[z];d&&(y[z].color=zot(o.offColor)?s:o.offColor,y[z].enabled=!0),z=e,o=i[z],y[z].color=zot(o.color)?r:o.color,d&&(y[z].enabled=!1),p.dispatchEvent("change"),!t.OPTIMIZE&&p.getStage()&&p.getStage().update()}zot(o)&&(o=240),zot(n)&&(n=60),(zot(i)||i.length<=0)&&(i=[{label:1},{label:2},{label:3},{label:4}]),zot(r)&&(r="#333"),zot(a)&&(a="#555"),zot(s)&&(s="#777"),zot(d)&&(d=!0),zot(h)&&(h=1),zot(l)&&(l=0),zot(c)&&(c=0),zot(u)&&(u=!0);var p=this;this.width=o,this.height=n,this.keyEnabled=u;for(var f,w,w,b,z=0,v=[],y=[],m=i.length,x=(o-h*(m-1))/m,C=0,S=0,B=0;Bo-h*(m-1))for(B=0;BC)if(S>0)for(b=(C-S*x)/S,B=0;Bi.length-1?0:e),t.preventDefault()}}),Object.defineProperty(this,"selected",{get:function(){return y[z]},set:function(t){zon&&zog("selected is read only - try selectedIndex")}}),Object.defineProperty(this,"selectedIndex",{get:function(){return z},set:function(t){g(Math.min(Math.max(t,0),i.length-1))}}),Object.defineProperty(this,"tabs",{get:function(){return z},set:function(t){g(Math.min(Math.max(t,0),i.length-1))}}),Object.defineProperty(this,"color",{get:function(){return r},set:function(e){r=e,zot(i[z].color)&&(y[z].color=r,!t.OPTIMIZE&&p.getStage()&&p.getStage().update())}}),Object.defineProperty(this,"rollColor",{get:function(){return a},set:function(t){a=t;for(var e=0;ek;k++){var o=v.graphics;E=Math.floor(k/n),I=k%n,N=I*(m+i),X=E*(m+i)+Y,C[k]=e[k],o.f(nt.color).r(N-1,X-1,m+2,m+2).f(e[k]).r(N,X,m,m)}!t.OPTIMIZE&&p.getStage()&&p.getStage().update()}F=L,b=z,p.dispatchEvent("change")}else p.dispatchEvent("close")}function g(t){return Math.round(t*Math.pow(10,2))/Math.pow(10,2)}zot(e)&&(e=500),zot(o)&&(x=!0),zot(n)&&(n=10),zot(i)&&(i=2),zot(a)&&(a=!0),zot(r)&&(r=!0),zot(h)&&(h=!0),zot(d)&&(d="rgba(0,0,0,.3)"),zot(l)&&(l=14);var p=this,f="#e472c4",w="#50c4b7",b=1,z=1,v=new createjs.Shape;this.addChild(v),v.x+=i,v.y+=i;var y,m,x=!1,C=[];if(zot(o)){x=!0;var S=6,B=S*S*S;S=Math.ceil(Math.pow(B,.5)),m=(e-i)/18-i;var j=Math.floor(Math.pow(S*S,1/3));y=[];for(var k=0;6>k;k++)for(var P=0;6>P;P++)for(var M=0;6>M;M++)y.push("#"+c(3*k)+c(3*P)+c(3*M));o=[];var E,I,O,T;for(k=0;k=18?1:0,O=E-6*j*3,T=I+6*j,o[18*T+O]=y[k];n=18,C=[w,f]}else m=(e-i)/n-i;var A=Math.ceil(o.length/n),L=String(o[o.length-1]);zot(s)||(L=String(s));var I,E,N,X,F=w,R=v.graphics,j=0;for(k=0;kk;k++)C.push("#"+c(k)+c(k)+c(k));for(k=0;k0&&(nt.shadow=new createjs.Shadow(d,8,8,l)),h){var it,rt;nt.on("mousedown",function(t){it=t.stageX-p.x,rt=t.stageY-p.y,nt.cursor="move"}),nt.on("pressmove",function(t){p.x=t.stageX-it,p.y=t.stageY-rt,p.getStage()&&p.getStage().update()}),nt.on("pressup",function(t){nt.cursor="default",p.getStage()&&p.getStage().update()})}var at=n*(m+i),st=A*(m+i);if(r)var ht=Z*(m+i),dt=V*(m+i);v.on("mousedown"==t.ACTIONEVENT?"mousedown":"click",function(){var e=t.hitTestGrid(v,at,st,n,A,p.getStage().mouseX,p.getStage().mouseY,0,0,i,i);zot(e)||(ot.color=L=o[e],H.text=String(o[e]).toUpperCase().substr(0,7),t.centerReg(H),p.getStage()&&p.getStage().update()),r&&(e=null,e=t.hitTestGrid(v,ht,dt,Z,V,p.getStage().mouseX,p.getStage().mouseY,0,st,i,i),zot(e)||(ot.color=L=C[e],H.text=C[e].toUpperCase(),t.centerReg(H),p.getStage()&&p.getStage().update()))}),Object.defineProperty(this,"selectedColor",{get:function(){return L},set:function(e){ot.color=L=e,H.text=o[index],t.centerReg(H),
p.getStage()&&p.getStage().update()}}),Object.defineProperty(this,"selectedAlpha",{get:function(){return a?g(G.currentValue):1},set:function(t){a&&(ot.alpha=G.currentValue=t,Q.text="Alpha: "+g(G.currentValue),p.getStage()&&p.getStage().update())}}),this.dispose=function(){G.dispose(),v.removeAllEventListeners(),nt.removeAllEventListeners(),$.removeAllEventListeners(),ot.removeAllEventListeners(),tt.removeAllEventListeners()}}var u,g="width, colors, cols, spacing, greyPicker, alphaPicker, startColor, drag, shadowColor, shadowBlur";return(u=zob(t.ColorPicker,arguments,g))?u:(c.prototype=new createjs.Container,c.prototype.constructor=t.ColorPicker,new c)},t.Parallax=function(e,o,n,i,r,a){function s(t){c.step()}var h,d="stage, damp, layers, auto, fps, ticker";if(h=zob(t.Parallax,arguments,d,this))return h;if(zon&&zog("zim build - Parallax"),zot(e)||!e.getBounds)return void zog("zim build - Parallax(): please pass in the stage with bounds as first parameter");if(!e.getBounds())return void zog("zim build - Parallax(): Please give the stage bounds using setBounds()");zot(i)&&(i=!0),zot(r)&&(r=30),zot(a)&&(a=!0);var l=e.getBounds().width,c=(e.getBounds().height,this);this.damp=zot(o)?.1:o,this.addLayer=function(e){if(!(zot(e.obj)||zot(e.prop)||zot(e.propChange))){var o={obj:e.obj,prop:e.prop};o[o.prop]=e.propChange,zot(e.input)&&(e.input="mouseX"),o.input=e.input;var n=zot(e.inMin)?0:e.inMin,i=zot(e.inMax)?l:e.inMax,r=zot(e.factor)?1:e.factor,a=zot(e.integer)?!1:e.integer;return o["p_"+o.prop]=new t.ProportionDamp(n,i,0,o[o.prop],c.damp,r,a),"scale"==o.prop?o["s_"+o.prop]=o.obj.scaleX:"frame"==o.prop?o["s_"+o.prop]=o.obj.currentFrame:o["s_"+o.prop]=o.obj[o.prop],u.push(o),u.length-1}},this.removeLayer=function(t){if(!zot(t)){var e=u[t];e["p_"+e.prop].dispose(),u.splice(t,1)}},this.immediate=function(t){for(var e,o=0;o0?g.x<0&&u.xf&&g.x>u.x?g.x=u.x-u.getBounds().width+p.gapFix:u.x>f&&u.x>g.x&&(u.x=g.x-g.getBounds().width+p.gapFix)):(u.y-=p.speed*p.direction,g.y-=p.speed*p.direction,p.direction*p.speed>0?g.y<0&&u.yw&&g.y>u.y?g.y=u.y-u.getBounds().height+p.gapFix:u.y>w&&u.y>g.y&&(u.y=g.y-g.getBounds().height+p.gapFix)),u.getStage().update())}}var l,c="backing1, backing2, speed, direction, horizontal, gapFix, fps, ticker";if(l=zob(t.Scroller,arguments,c,this))return l;var u=e,g=o;if(!zot(u)&&u.getBounds&&!zot(g)&&g.getBounds){zot(r)&&(r=!0);var p=this;if(zot(s)&&(s=30),zot(h)&&(h=!0),this.speed=zot(n)?1:n,this.direction=zot(i)?1:i,this.gapFix=zot(a)?0:a,!u.getBounds()||!g.getBounds())return void zog("zim build - Scroller(): please setBounds() on backing objects");if(!u.getStage())return void zog("zim build - Scroller(): please add backing objects to stage to start");var f,w;if(r?g.x=u.getBounds().width:g.y=u.getBounds().height,h){var b=createjs.Ticker.on("tick",d);createjs.Ticker.setFPS(s)}this.dispose=function(){zon&&zog("bye from Scroller"),h&&createjs.Ticker.off("tick",b)}}},t}(zim||{});