// 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 d(){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,z=p,f=z-w,w+=f*b.damp)}var h,l="baseMin, baseMax, targetMin, targetMax, damp, factor, targetRound";if(h=zob(t.ProportionDamp,arguments,l))return h;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,b=this,z=0,w=0;c=e,w=n;var v=setInterval(d,20);this.immediate=function(t){b.convert(t),d(),w=p,s&&(w=Math.round(w))},this.convert=function(t){return c=t,s?Math.round(w):w},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,d=s.beginFill(o).command;if(!zot(n)){var h=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,d.style=o)},Object.defineProperty(r,"color",{get:function(){return o},set:function(t){r.setFill(t)}}),this.setStroke=function(t){h&&!zot(t)&&(n=t,h.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 d=this.shape=new createjs.Shape;this.addChild(d);var h=d.graphics,l=h.beginFill(n).command;if(!zot(i)){var c=h.beginStroke(i).command;zot(r)&&(r=1);var u=h.setStrokeStyle(r).command}a>0?h.rr(0,0,e,o,a):h.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 d,h="width, height, fill, stroke, strokeSize, corner";return(d=zob(t.Rectangle,arguments,h))?d:(s.prototype=new createjs.Container,s.prototype.constructor=t.Rectangle,new s)},t.Triangle=function(e,o,n,i,r,a,s,d){function h(){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(d)&&(d=0),this.mouseChildren=!1;var h=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 b,z=180*Math.acos((Math.pow(bb,2)+Math.pow(cc,2)-Math.pow(aa,2))/(2*bb*cc))/Math.PI,w=180*Math.asin(bb*Math.sin(z*Math.PI/180)/aa)/Math.PI,v=180-z-w;b=n==aa?z:n==bb?w:v;var y=Math.cos(b*Math.PI/180)*o,m=Math.sin(b*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+d),this.setFill=function(t){zot(t)||(i=t,g.style=i)},Object.defineProperty(h,"color",{get:function(){return i},set:function(t){h.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,d)}}var l,c="a, b, c, fill, stroke, strokeSize, center, adjust";return(l=zob(t.Triangle,arguments,c))?l:(h.prototype=new createjs.Container,h.prototype.constructor=t.Triangle,new h)},t.Label=function(o,n,i,r,a,s,d){function h(){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=null),zot(d)&&(d=16);var h=this;this.mouseChildren=!1;var l=this.label=new createjs.Text(String(o),n+"px "+i,r);l.textBaseline="alphabetic",l.textAlign="left",s&&d>0&&(l.shadow=new createjs.Shadow(s,3,3,d)),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(h,"text",{get:function(){var t=" "==l.text?"":l.text;return t},set:function(t){zot(t)&&(t=" "),l.text=t,h.setBounds(0,0,l.getBounds().width,l.getBounds().height)}}),Object.defineProperty(h,"color",{get:function(){return r},set:function(e){r=e,l.color=r,!t.OPTIMIZE&&h.getStage()&&h.getStage().update()}}),Object.defineProperty(h,"rollColor",{get:function(){return a},set:function(t){a=t}}),this._enabled=!0,Object.defineProperty(h,"enabled",{get:function(){return h._enabled},set:function(o){e(h,o),l.color=r,h.mouseChildren=!1,!t.OPTIMIZE&&h.getStage()&&h.getStage().update()}}),this.showRollColor=function(t){zot(t)&&(t=!0),t?l.color=a:l.color=r,h.getStage()&&h.getStage().update()},this.on("mouseover",function(t){h.showRollColor()}),this.on("mouseout",function(t){h.showRollColor(!1)}),this.clone=function(){return new t.Label(h.text,n,i,r,a,s,d)},this.dispose=function(){h.removeAllEventListeners()}}var l,c="text, size, font, color, rollColor, shadowColor, shadowBlur";return(l=zob(t.Label,arguments,c))?l:(h.prototype=new createjs.Container,h.prototype.constructor=t.Label,new h)},t.Button=function(o,n,i,r,a,s,d,h,l,c,u){function g(){function g(t){f.on("mouseout",p),b.color=a,f.label.showRollColor(),f.getStage()&&f.getStage().update()}function p(t){f.off("mouseout",p),b.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(d)&&(d=1),zot(h)&&(h=20),zot(l)&&(l="rgba(0,0,0,.3)"),zot(c)&&(c=16),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 b=new t.Rectangle(o,n,r,s,d,h);if(this.addChild(b),this.backing=b,u>0){var z=new createjs.Shape;z.graphics.f("#000").r(-u,-u,o+2*u,n+2*u),this.hitArea=z}c>0&&(b.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,b.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(b),f.removeChild(buttonLabel),b=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){d=!d,h.setChecked(d),h.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 d=zot(i)?!1:i;zot(r)&&(r="black"),zot(a)&&(a=10),this.setBounds(-a,-a,o+2*a,o+2*a);var h=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,b="#000";f.f(b).p("AnQAdICBiaIEEDZIF8nfICfB4In/KPg");var z=95;p.setBounds(-z/2,-z/2,z,z);var w=o/(z+66);p.scaleX=p.scaleY=w,p.alpha=.9,p.x=o/2,p.y=o/2,d&&this.addChild(p),this.on("mousedown"==t.ACTIONEVENT?"mousedown":"click",s),Object.defineProperty(h,"checked",{get:function(){return d},set:function(t){h.checked!=t&&h.dispatchEvent("change"),h.setChecked(t)}}),Object.defineProperty(p,"color",{get:function(){return b},set:function(e){d&&h.removeChild(p),p=new createjs.Shape,f=p.graphics,b=e,f.f(b).p("AnQAdICBiaIEEDZIF8nfICfB4In/KPg"),p.scaleX=p.scaleY=w,p.alpha=.9,p.x=o/2,p.y=o/2,d&&h.addChild(p),!t.OPTIMIZE&&h.getStage()&&h.getStage().update()}}),Object.defineProperty(h,"check",{get:function(){return p},set:function(t){zog("ZIM CheckBox - check is read only")}}),this._enabled=!0,Object.defineProperty(h,"enabled",{get:function(){return h._enabled},set:function(t){e(h,t)}}),this.setChecked=function(e){zot(e)&&(e=!0),d=e,d?h.addChild(p):h.removeChild(p),!t.OPTIMIZE&&h.getStage()&&h.getStage().update()},this.dispose=function(){h.removeAllEventListeners()}}var d,h="size, label, startChecked, color, margin";return(d=zob(t.CheckBox,arguments,h))?d:(s.prototype=new createjs.Container,s.prototype.constructor=t.CheckBox,new s)},t.RadioButtons=function(o,n,i,r,a,s,d){function h(){function h(t){var e=p.getChildIndex(t.target);d&&u.selectedIndex==e||(u.setSelected(e),u.dispatchEvent("change"))}function l(){for(var e,s=!1,d=n.length-1;d>=0;d--)e=n[d],e.selected&&e.selected===!0&&(s?e.selected="false":(s=!0,u.id=e.id));p.removeAllChildren();for(var h,l=0,d=0;d=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;d&&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:(h.prototype=new createjs.Container,h.prototype.constructor=t.RadioButtons,new h)},t.Pane=function(e,o,n,i,r,a,s,d,h,l,c,u,g){function p(){function p(){e.removeChild(w),s&&(isNaN(w.resetX)||(w.x=w.resetX),isNaN(w.resetY)||(w.y=w.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(d)&&(d=!0),zot(h)&&(h=20),zot(l)&&(l=.14),zot(c)&&(c="rgba(0,0,0,.3)"),zot(u)&&(u=20),zot(g)&&(g=!0);var b=this.backing=new createjs.Shape,z=b.graphics;z.beginFill("black"),z.drawRect(-5e3,-5e3,1e4,1e4),this.setBounds(-o/2,-n/2,o,n),b.alpha=l;var w=this;b.on("mousedown"==t.ACTIONEVENT?"mousedown":"click",function(t){p(),e.getStage().update(),w.dispatchEvent("close"),t.stopImmediatePropagation()}),b.on("mousedown",function(t){t.stopImmediatePropagation()}),d&&this.addChild(b);var v=this.display=new createjs.Shape;if(v.setBounds(0,0,o,n),v.regX=o/2,v.regY=n/2,z=v.graphics,z.beginFill(r),z.drawRoundRect(0,0,o,n,h),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(w.resetX)&&(w.resetX=w.x),isNaN(w.resetY)&&(w.resetY=w.y),y=t.stageX-w.x,m=t.stageY-w.y,v.cursor="move"}),v.on("pressmove",function(t){var o=f(t.stageX-y,t.stageY-m);w.x=o.x,w.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(w,"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(w.resetX)&&(w.x=e.getBounds().width/2,w.y=e.getBounds().height/2),e.addChild(w),e.getStage()&&e.getStage().update()},this.dispose=function(){v.removeAllEventListeners(),w.removeChild(v),v=null}}var f,b="container, width, height, label, color, drag, resets, modal, corner, backingAlpha, shadowColor, shadowBlur, center";return(f=zob(t.Pane,arguments,b))?f:(p.prototype=new createjs.Container,p.prototype.constructor=t.Pane,new p)},t.Waiter=function(e,o,n,i,r,a,s){function d(){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="#444"),zot(s)&&(s=14);var t=40,d=3,h=.6*t/2,l=(t-2*h)/2,c=d*(2*h+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),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 b,z=0;d>z;z++)b=new createjs.Shape,b.graphics.f(i).dc(0,0,h),b.x=(z-(d-1)/2)*(2*h+l),f.addChild(b),b.cache(-h,-h,2*h,2*h),b.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),z.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",B.alpha=1,j.setFill(i),B.cursor="pointer",u||(0==f&&(y.alpha=.8,x.setFill("#aaa"),y.cursor="default"),f==o.length-1&&(B.alpha=.8,j.setFill("#aaa"),B.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(d)&&(d=!0),zot(h)&&(h=16),zot(l)&&(l="rgba(0,0,0,.3)"),zot(c)&&(c=14),zot(u)&&(u=!1);var f,b="mousedown"==t.ACTIONEVENT?"mousedown":"click",z=this,w=100,v=w/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*w,1.5*w),m.regX=1.5*w/2,m.regY=1.5*w/2+v/2,y.hitArea=m;var x=new t.Triangle(w,.8*w,.8*w,i);c>0&&(y.shadow=new createjs.Shadow(l,3,3,c)),y.addChild(x),y.cursor="pointer",y.on(b,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,w),null!=r&&C.graphics.s(r).ss(1.5),C.graphics.f(i).rr(0,0,n,w,h),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 B=this.arrowNext=new createjs.Container;this.addChild(B);var S=new createjs.Shape;S.graphics.f("rgba(255,255,255,.01)").r(0,0,1.5*w,1.5*w),S.regX=1.5*w/2,S.regY=1.5*w/2+v/2,B.hitArea=S;var j=new t.Triangle(w,.8*w,.8*w,i);c>0&&(B.shadow=new createjs.Shadow(l,3,3,c)),B.addChild(j),B.cursor="pointer",B.on(b,function(t){g(1)}),C.on(b,function(t){g(1)}),s?(B.rotation=180,B.x=n/2,B.y=C.y+C.getBounds().height+B.getBounds().height/2+v):(B.rotation=90,B.x=C.x+C.getBounds().width+B.getBounds().height/2+v,B.y=B.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!=z.currentIndex&&(p(f),z.dispatchEvent("change"))}}),Object.defineProperty(this,"currentValue",{get:function(){return o[f]},set:function(t){o.indexOf(t)>-1&&(f=o.indexOf(t)),f!=z.currentIndex&&(p(f),z.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(z,"enabled",{get:function(){return z._enabled},set:function(o){e(z,o),o?p(z.currentIndex):(y.alpha=.8,x.setFill("#aaa"),y.cursor="default",B.alpha=.8,j.setFill("#aaa"),B.cursor="default",a.mouseChildren=!1,a.mouseEnabled=!1),!t.OPTIMIZE&&a.getStage()&&a.getStage().update()}}),d&&(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(){z.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,d,h,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(d)&&(d="#666"),zot(h)&&(h=!1),zot(l)&&(l=!1),zot(r)){var g=30,p=40;h&&(g=50,p=40),r=new t.Button(g,p,"","#fff","#ddd","#666",1,0,null,null,30)}var f=this,b=o;this.button=r;var z,w,v,y,m;if(l&&0!=i){y=this.ticks=new createjs.Shape,this.addChild(y),m=y.graphics,m.ss(1).s(d);var x=(n-o)/i,C=a/x}if(h){if(l&&0!=i){for(var B=0;x>=B;B++)m.mt(0,C*B).lt(20,C*B);y.x=10}z=this.bar=new t.Rectangle(s,a,d),this.addChild(z),t.centerReg(r),this.addChild(r),v=z.getBounds(),w=new createjs.Rectangle(v.width/2,v.y,0,v.height)}else{if(l&&0!=i){for(var B=0;x>=B;B++)m.mt(C*B,0).lt(C*B,-20);y.y=-10}z=this.bar=new t.Rectangle(a,s,d),this.addChild(z),t.centerReg(r),this.addChild(r),v=z.getBounds(),w=new createjs.Rectangle(v.x,v.height/2,v.width,0)}r.x=w.x,r.y=w.y;var S,j,k=0;r.on("mousedown",function(t){var e=f.globalToLocal(t.stageX,t.stageY);S=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-S,i.y-j,w);h?(r.x=s.x,b=c(s.y/a*(n-o)),r.y=b*a/(n-o),b+=o,r.y!=k&&f.dispatchEvent("change"),k=r.y):(b=c(s.x/a*(n-o)),r.x=b*a/(n-o),b+=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 b},set:function(e){o>e&&(e=o),e>n&&(e=n),b=e=c(e),h?(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,d,h,l,c,u){function g(){function g(e){var o=i[w];h&&(y[w].color=zot(o.offColor)?s:o.offColor,y[w].enabled=!0),w=e,o=i[w],y[w].color=zot(o.color)?r:o.color,h&&(y[w].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(h)&&(h=!0),zot(d)&&(d=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,b,b,z,w=0,v=[],y=[],m=i.length,x=(o-d*(m-1))/m,C=0,B=0,S=0;So-d*(m-1))for(S=0;SC)if(B>0)for(z=(C-B*x)/B,S=0;Si.length-1?0:e),t.preventDefault()}}),Object.defineProperty(this,"selected",{get:function(){return y[w]},set:function(t){zon&&zog("selected is read only - try selectedIndex")}}),Object.defineProperty(this,"selectedIndex",{get:function(){return w},set:function(t){g(Math.min(Math.max(t,0),i.length-1))}}),Object.defineProperty(this,"tabs",{get:function(){return w},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[w].color)&&(y[w].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;e0?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.yb&&g.y>u.y?g.y=u.y-u.getBounds().height+p.gapFix:u.y>b&&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))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(d)&&(d=!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,b;if(r?g.x=u.getBounds().width:g.y=u.getBounds().height,d){var z=createjs.Ticker.on("tick",h);createjs.Ticker.setFPS(s)}this.dispose=function(){zon&&zog("bye from Scroller"),d&&createjs.Ticker.off("tick",z)}}},t}(zim||{});