// ProgressBar.js 1.1.0 // https://kimmobrunfeldt.github.io/progressbar.js // License: MIT (function(f){if("object"===typeof exports&&"undefined"!==typeof module){module.exports=f()}else if("function"===typeof define&&define.amd){define([],f)}else{var g;if("undefined"!==typeof window){g=window}else if("undefined"!==typeof global){g=global}else if("undefined"!==typeof self){g=self}else{g=this}g.ProgressBar=f()}})(function(){var define,module,exports;return function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;il?l:n,p=a-(l-h);h>=l?(c(f,e,p),t.stop(!0)):(t._applyFilter("beforeTween"),h(t/=.5)?.5*Math.pow(t,2):-.5*((t-=2)*t-2)},a=function(t){return Math.pow(t,3)},c=function(t){return Math.pow(t-1,3)+1},f=function(t){return 1>(t/=.5)?.5*Math.pow(t,3):.5*(Math.pow(t-2,3)+2)},s=function(t){return Math.pow(t,4)},l=function(t){return-(Math.pow(t-1,4)-1)},h=function(t){return 1>(t/=.5)?.5*Math.pow(t,4):-.5*((t-=2)*Math.pow(t,3)-2)},p=function(t){return Math.pow(t,5)},d=function(t){return Math.pow(t-1,5)+1},v=function(t){return 1>(t/=.5)?.5*Math.pow(t,5):.5*(Math.pow(t-2,5)+2)},y=function(t){return 1-Math.cos(t*(Math.PI/2))},_=function(t){return Math.sin(t*(Math.PI/2))},m=function(t){return-.5*(Math.cos(Math.PI*t)-1)},g=function(t){return 0===t?0:Math.pow(2,10*(t-1))},w=function(t){return 1===t?1:1-Math.pow(2,-10*t)},b=function(t){return 0===t?0:1===t?1:1>(t/=.5)?.5*Math.pow(2,10*(t-1)):.5*(2-Math.pow(2,-10*--t))},S=function(t){return-(Math.sqrt(1-t*t)-1)},O=function(t){return Math.sqrt(1-Math.pow(t-1,2))},M=function(t){return 1>(t/=.5)?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},k=function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},j=function(t){var n=1.70158;return t*t*((n+1)*t-n)},P=function(t){var n=1.70158;return(t-=1)*t*((n+1)*t+n)+1},x=function(t){var n=1.70158;return 1>(t/=.5)?.5*(t*t*((1+(n*=1.525))*t-n)):.5*((t-=2)*t*((1+(n*=1.525))*t+n)+2)},T=function(t){return-1*Math.pow(4,-8*t)*Math.sin((6*t-1)*(2*Math.PI)/2)+1},F=function(t){var n=1.70158;return 1>(t/=.5)?.5*(t*t*((1+(n*=1.525))*t-n)):.5*((t-=2)*t*((1+(n*=1.525))*t+n)+2)},A=function(t){var n=1.70158;return t*t*((n+1)*t-n)},E=function(t){var n=1.70158;return(t-=1)*t*((n+1)*t+n)+1},I=function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},C=function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?2-(7.5625*(t-=1.5/2.75)*t+.75):t<2.5/2.75?2-(7.5625*(t-=2.25/2.75)*t+.9375):2-(7.5625*(t-=2.625/2.75)*t+.984375)},q=function(t){return 1>(t/=.5)?.5*Math.pow(t,4):-.5*((t-=2)*Math.pow(t,3)-2)},Q=function(t){return Math.pow(t,4)},D=function(t){return Math.pow(t,.25)}},function(t,n){var e;e=function(){return this}();try{e=e||new Function("return this")()}catch(t){"object"==typeof window&&(e=window)}t.exports=e},function(t,n,e){"use strict";e.r(n);var r={};e.r(r),e.d(r,"doesApply",function(){return x}),e.d(r,"tweenCreated",function(){return T}),e.d(r,"beforeTween",function(){return F}),e.d(r,"afterTween",function(){return A});var i,u,o=e(0),a=/(\d|-|\.)/,c=/([^\-0-9.]+)/g,f=/[0-9.-]+/g,s=(i=f.source,u=/,\s*/.source,new RegExp("rgb\\(".concat(i).concat(u).concat(i).concat(u).concat(i,"\\)"),"g")),l=/^.*\(/,h=/#([0-9]|[a-f]){3,6}/gi,p=function(t,n){return t.map(function(t,e){return"_".concat(n,"_").concat(e)})};function d(t){return parseInt(t,16)}var v=function(t){return"rgb(".concat((n=t,3===(n=n.replace(/#/,"")).length&&(n=(n=n.split(""))[0]+n[0]+n[1]+n[1]+n[2]+n[2]),[d(n.substr(0,2)),d(n.substr(2,2)),d(n.substr(4,2))]).join(","),")");var n},y=function(t,n,e){var r=n.match(t),i=n.replace(t,"VAL");return r&&r.forEach(function(t){return i=i.replace("VAL",e(t))}),i},_=function(t){for(var n in t){var e=t[n];"string"==typeof e&&e.match(h)&&(t[n]=y(h,e,v))}},m=function(t){var n=t.match(f).map(Math.floor),e=t.match(l)[0];return"".concat(e).concat(n.join(","),")")},g=function(t){return t.match(f)},w=function(t){var n,e,r={};for(var i in t){var u=t[i];"string"==typeof u&&(r[i]={formatString:(n=u,e=void 0,e=n.match(c),e?(1===e.length||n.charAt(0).match(a))&&e.unshift(""):e=["",""],e.join("VAL")),chunkNames:p(g(u),i)})}return r},b=function(t,n){var e=function(e){g(t[e]).forEach(function(r,i){return t[n[e].chunkNames[i]]=+r}),delete t[e]};for(var r in n)e(r)},S=function(t,n){var e={};return n.forEach(function(n){e[n]=t[n],delete t[n]}),e},O=function(t,n){return n.map(function(n){return t[n]})},M=function(t,n){return n.forEach(function(n){return t=t.replace("VAL",+n.toFixed(4))}),t},k=function(t,n){for(var e in n){var r=n[e],i=r.chunkNames,u=r.formatString,o=M(u,O(S(t,i),i));t[e]=y(s,o,m)}},j=function(t,n){var e=function(e){var r=n[e].chunkNames,i=t[e];if("string"==typeof i){var u=i.split(" "),o=u[u.length-1];r.forEach(function(n,e){return t[n]=u[e]||o})}else r.forEach(function(n){return t[n]=i});delete t[e]};for(var r in n)e(r)},P=function(t,n){for(var e in n){var r=n[e].chunkNames,i=t[r[0]];t[e]="string"==typeof i?r.map(function(n){var e=t[n];return delete t[n],e}).join(" "):i}},x=function(t){var n=t._currentState;return Object.keys(n).some(function(t){return"string"==typeof n[t]})};function T(t){var n=t._currentState;[n,t._originalState,t._targetState].forEach(_),t._tokenData=w(n)}function F(t){var n=t._currentState,e=t._originalState,r=t._targetState,i=t._easing,u=t._tokenData;j(i,u),[n,e,r].forEach(function(t){return b(t,u)})}function A(t){var n=t._currentState,e=t._originalState,r=t._targetState,i=t._easing,u=t._tokenData;[n,e,r].forEach(function(t){return k(t,u)}),P(i,u)}function E(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}var I=new o.a,C=o.a.filters,q=function(t,n,e,r){var i=4s;s++){if(u=h(i)-t,p(u)p(f=(3*o*(l=i)+2*a)*l+c))break;i-=u/f}if((i=t)<(e=0))return e;if(i>(r=1))return r;for(;eu?e=i:r=i,i=.5*(r-e)+e}return i}(t,n),((f*e+s)*e+l)*e;var e}(t,function(t){return 1/(200*t)}(u))}var L=function(t,n,e,r,i){var u=function(t,n,e,r){return function(i){return z(i,t,n,e,r,1)}}(n,e,r,i);return u.displayName=t,u.x1=n,u.y1=e,u.x2=r,u.y2=i,o.a.formulas[t]=u},V=function(t){return delete o.a.formulas[t]};e.d(n,"processTweens",function(){return o.c}),e.d(n,"Tweenable",function(){return o.a}),e.d(n,"tween",function(){return o.d}),e.d(n,"interpolate",function(){return q}),e.d(n,"Scene",function(){return N}),e.d(n,"setBezierFunction",function(){return L}),e.d(n,"unsetBezierFunction",function(){return V}),o.a.filters.token=r}])})},{}],2:[function(require,module,exports){// Circle shaped progress bar var Shape=require("./shape"),utils=require("./utils"),Circle=function Circle(container,options){// Use two arcs to form a circle // See this answer http://stackoverflow.com/a/10477334/1446092 this._pathTemplate="M 50,50 m 0,-{radius}"+" a {radius},{radius} 0 1 1 0,{2radius}"+" a {radius},{radius} 0 1 1 0,-{2radius}";this.containerAspectRatio=1;Shape.apply(this,arguments)};Circle.prototype=new Shape;Circle.prototype.constructor=Circle;Circle.prototype._pathString=function _pathString(opts){var widthOfWider=opts.strokeWidth;if(opts.trailWidth&&opts.trailWidth>opts.strokeWidth){widthOfWider=opts.trailWidth}var r=50-widthOfWider/2;return utils.render(this._pathTemplate,{radius:r,"2radius":2*r})};Circle.prototype._trailString=function _trailString(opts){return this._pathString(opts)};module.exports=Circle},{"./shape":7,"./utils":9}],3:[function(require,module,exports){// Line shaped progress bar var Shape=require("./shape"),utils=require("./utils"),Line=function Line(container,options){this._pathTemplate="M 0,{center} L 100,{center}";Shape.apply(this,arguments)};Line.prototype=new Shape;Line.prototype.constructor=Line;Line.prototype._initializeSvg=function _initializeSvg(svg,opts){svg.setAttribute("viewBox","0 0 100 "+opts.strokeWidth);svg.setAttribute("preserveAspectRatio","none")};Line.prototype._pathString=function _pathString(opts){return utils.render(this._pathTemplate,{center:opts.strokeWidth/2})};Line.prototype._trailString=function _trailString(opts){return this._pathString(opts)};module.exports=Line},{"./shape":7,"./utils":9}],4:[function(require,module,exports){module.exports={// Higher level API, different shaped progress bars Line:require("./line"),Circle:require("./circle"),SemiCircle:require("./semicircle"),Square:require("./square"),// Lower level API to use any SVG path Path:require("./path"),// Base-class for creating new custom shapes // to be in line with the API of built-in shapes // Undocumented. Shape:require("./shape"),// Internal utils, undocumented. utils:require("./utils")}},{"./circle":2,"./line":3,"./path":5,"./semicircle":6,"./shape":7,"./square":8,"./utils":9}],5:[function(require,module,exports){// Lower level API to animate any kind of svg path var shifty=require("shifty"),utils=require("./utils"),Tweenable=shifty.Tweenable,EASING_ALIASES={easeIn:"easeInCubic",easeOut:"easeOutCubic",easeInOut:"easeInOutCubic"},Path=function Path(path,opts){// Throw a better error if not initialized with `new` keyword if(!(this instanceof Path)){throw new Error("Constructor was called without new keyword")}// Default parameters for animation opts=utils.extend({delay:0,duration:800,easing:"linear",from:{},to:{},step:function(){}},opts);var element;if(utils.isString(path)){element=document.querySelector(path)}else{element=path}// Reveal .path as public attribute this.path=element;this._opts=opts;this._tweenable=null;// Set up the starting positions var length=this.path.getTotalLength();this.path.style.strokeDasharray=length+" "+length;this.set(0)};Path.prototype.value=function value(){var offset=this._getComputedDashOffset(),length=this.path.getTotalLength(),progress=1-offset/length;// Round number to prevent returning very small number like 1e-30, which // is practically 0 return parseFloat(progress.toFixed(6),10)};Path.prototype.set=function set(progress){this.stop();this.path.style.strokeDashoffset=this._progressToOffset(progress);var step=this._opts.step;if(utils.isFunction(step)){var easing=this._easing(this._opts.easing),values=this._calculateTo(progress,easing),reference=this._opts.shape||this;step(values,reference,this._opts.attachment)}};Path.prototype.stop=function stop(){this._stopTween();this.path.style.strokeDashoffset=this._getComputedDashOffset()};// Method introduced here: // http://jakearchibald.com/2013/animated-line-drawing-svg/ Path.prototype.animate=function animate(progress,opts,cb){opts=opts||{};if(utils.isFunction(opts)){cb=opts;opts={}}var passedOpts=utils.extend({},opts),defaultOpts=utils.extend({},this._opts);// Copy default opts to new object so defaults are not modified opts=utils.extend(defaultOpts,opts);var shiftyEasing=this._easing(opts.easing),values=this._resolveFromAndTo(progress,shiftyEasing,passedOpts);this.stop();// Trigger a layout so styles are calculated & the browser // picks up the starting position before animating this.path.getBoundingClientRect();var offset=this._getComputedDashOffset(),newOffset=this._progressToOffset(progress),self=this;this._tweenable=new Tweenable;this._tweenable.tween({from:utils.extend({offset:offset},values.from),to:utils.extend({offset:newOffset},values.to),duration:opts.duration,delay:opts.delay,easing:shiftyEasing,step:function(state){self.path.style.strokeDashoffset=state.offset;var reference=opts.shape||self;opts.step(state,reference,opts.attachment)}}).then(function(state){if(utils.isFunction(cb)){cb()}})};Path.prototype._getComputedDashOffset=function _getComputedDashOffset(){var computedStyle=window.getComputedStyle(this.path,null);return parseFloat(computedStyle.getPropertyValue("stroke-dashoffset"),10)};Path.prototype._progressToOffset=function _progressToOffset(progress){var length=this.path.getTotalLength();return length-progress*length};// Resolves from and to values for animation. Path.prototype._resolveFromAndTo=function _resolveFromAndTo(progress,easing,opts){if(opts.from&&opts.to){return{from:opts.from,to:opts.to}}return{from:this._calculateFrom(easing),to:this._calculateTo(progress,easing)}};// Calculate `from` values from options passed at initialization Path.prototype._calculateFrom=function _calculateFrom(easing){return shifty.interpolate(this._opts.from,this._opts.to,this.value(),easing)};// Calculate `to` values from options passed at initialization Path.prototype._calculateTo=function _calculateTo(progress,easing){return shifty.interpolate(this._opts.from,this._opts.to,progress,easing)};Path.prototype._stopTween=function _stopTween(){if(null!==this._tweenable){this._tweenable.stop();this._tweenable=null}};Path.prototype._easing=function _easing(easing){if(EASING_ALIASES.hasOwnProperty(easing)){return EASING_ALIASES[easing]}return easing};module.exports=Path},{"./utils":9,shifty:1}],6:[function(require,module,exports){// Semi-SemiCircle shaped progress bar var Shape=require("./shape"),Circle=require("./circle"),utils=require("./utils"),SemiCircle=function SemiCircle(container,options){// Use one arc to form a SemiCircle // See this answer http://stackoverflow.com/a/10477334/1446092 this._pathTemplate="M 50,50 m -{radius},0"+" a {radius},{radius} 0 1 1 {2radius},0";this.containerAspectRatio=2;Shape.apply(this,arguments)};SemiCircle.prototype=new Shape;SemiCircle.prototype.constructor=SemiCircle;SemiCircle.prototype._initializeSvg=function _initializeSvg(svg,opts){svg.setAttribute("viewBox","0 0 100 50")};SemiCircle.prototype._initializeTextContainer=function _initializeTextContainer(opts,container,textContainer){if(opts.text.style){// Reset top style textContainer.style.top="auto";textContainer.style.bottom="0";if(opts.text.alignToBottom){utils.setStyle(textContainer,"transform","translate(-50%, 0)")}else{utils.setStyle(textContainer,"transform","translate(-50%, 50%)")}}};// Share functionality with Circle, just have different path SemiCircle.prototype._pathString=Circle.prototype._pathString;SemiCircle.prototype._trailString=Circle.prototype._trailString;module.exports=SemiCircle},{"./circle":2,"./shape":7,"./utils":9}],7:[function(require,module,exports){// Base object for different progress bar shapes var Path=require("./path"),utils=require("./utils"),DESTROYED_ERROR="Object is destroyed",Shape=function Shape(container,opts){// Throw a better error if progress bars are not initialized with `new` // keyword if(!(this instanceof Shape)){throw new Error("Constructor was called without new keyword")}// Prevent calling constructor without parameters so inheritance // works correctly. To understand, this is how Shape is inherited: // // Line.prototype = new Shape(); // // We just want to set the prototype for Line. if(0===arguments.length){return}// Default parameters for progress bar creation this._opts=utils.extend({color:"#555",strokeWidth:1,trailColor:null,trailWidth:null,fill:null,text:{style:{color:null,position:"absolute",left:"50%",top:"50%",padding:0,margin:0,transform:{prefix:!0,value:"translate(-50%, -50%)"}},autoStyleContainer:!0,alignToBottom:!0,value:null,className:"progressbar-text"},svgStyle:{display:"block",width:"100%"},warnings:!1},opts,!0);// Use recursive extend // If user specifies e.g. svgStyle or text style, the whole object // should replace the defaults to make working with styles easier if(utils.isObject(opts)&&opts.svgStyle!==void 0){this._opts.svgStyle=opts.svgStyle}if(utils.isObject(opts)&&utils.isObject(opts.text)&&opts.text.style!==void 0){this._opts.text.style=opts.text.style}var svgView=this._createSvgView(this._opts),element;if(utils.isString(container)){element=document.querySelector(container)}else{element=container}if(!element){throw new Error("Container does not exist: "+container)}this._container=element;this._container.appendChild(svgView.svg);if(this._opts.warnings){this._warnContainerAspectRatio(this._container)}if(this._opts.svgStyle){utils.setStyles(svgView.svg,this._opts.svgStyle)}// Expose public attributes before Path initialization this.svg=svgView.svg;this.path=svgView.path;this.trail=svgView.trail;this.text=null;var newOpts=utils.extend({attachment:void 0,shape:this},this._opts);this._progressPath=new Path(svgView.path,newOpts);if(utils.isObject(this._opts.text)&&null!==this._opts.text.value){this.setText(this._opts.text.value)}};Shape.prototype.animate=function animate(progress,opts,cb){if(null===this._progressPath){throw new Error(DESTROYED_ERROR)}this._progressPath.animate(progress,opts,cb)};Shape.prototype.stop=function stop(){if(null===this._progressPath){throw new Error(DESTROYED_ERROR)}// Don't crash if stop is called inside step function if(this._progressPath===void 0){return}this._progressPath.stop()};Shape.prototype.pause=function pause(){if(null===this._progressPath){throw new Error(DESTROYED_ERROR)}if(this._progressPath===void 0){return}if(!this._progressPath._tweenable){// It seems that we can't pause this return}this._progressPath._tweenable.pause()};Shape.prototype.resume=function resume(){if(null===this._progressPath){throw new Error(DESTROYED_ERROR)}if(this._progressPath===void 0){return}if(!this._progressPath._tweenable){// It seems that we can't resume this return}this._progressPath._tweenable.resume()};Shape.prototype.destroy=function destroy(){if(null===this._progressPath){throw new Error(DESTROYED_ERROR)}this.stop();this.svg.parentNode.removeChild(this.svg);this.svg=null;this.path=null;this.trail=null;this._progressPath=null;if(null!==this.text){this.text.parentNode.removeChild(this.text);this.text=null}};Shape.prototype.set=function set(progress){if(null===this._progressPath){throw new Error(DESTROYED_ERROR)}this._progressPath.set(progress)};Shape.prototype.value=function value(){if(null===this._progressPath){throw new Error(DESTROYED_ERROR)}if(this._progressPath===void 0){return 0}return this._progressPath.value()};Shape.prototype.setText=function setText(newText){if(null===this._progressPath){throw new Error(DESTROYED_ERROR)}if(null===this.text){// Create new text node this.text=this._createTextContainer(this._opts,this._container);this._container.appendChild(this.text)}// Remove previous text and add new if(utils.isObject(newText)){utils.removeChildren(this.text);this.text.appendChild(newText)}else{this.text.innerHTML=newText}};Shape.prototype._createSvgView=function _createSvgView(opts){var svg=document.createElementNS("http://www.w3.org/2000/svg","svg");this._initializeSvg(svg,opts);var trailPath=null;// Each option listed in the if condition are 'triggers' for creating // the trail path if(opts.trailColor||opts.trailWidth){trailPath=this._createTrail(opts);svg.appendChild(trailPath)}var path=this._createPath(opts);svg.appendChild(path);return{svg:svg,path:path,trail:trailPath}};Shape.prototype._initializeSvg=function _initializeSvg(svg,opts){svg.setAttribute("viewBox","0 0 100 100")};Shape.prototype._createPath=function _createPath(opts){var pathString=this._pathString(opts);return this._createPathElement(pathString,opts)};Shape.prototype._createTrail=function _createTrail(opts){// Create path string with original passed options var pathString=this._trailString(opts),newOpts=utils.extend({},opts);// Prevent modifying original // Defaults for parameters which modify trail path if(!newOpts.trailColor){newOpts.trailColor="#eee"}if(!newOpts.trailWidth){newOpts.trailWidth=newOpts.strokeWidth}newOpts.color=newOpts.trailColor;newOpts.strokeWidth=newOpts.trailWidth;// When trail path is set, fill must be set for it instead of the // actual path to prevent trail stroke from clipping newOpts.fill=null;return this._createPathElement(pathString,newOpts)};Shape.prototype._createPathElement=function _createPathElement(pathString,opts){var path=document.createElementNS("http://www.w3.org/2000/svg","path");path.setAttribute("d",pathString);path.setAttribute("stroke",opts.color);path.setAttribute("stroke-width",opts.strokeWidth);if(opts.fill){path.setAttribute("fill",opts.fill)}else{path.setAttribute("fill-opacity","0")}return path};Shape.prototype._createTextContainer=function _createTextContainer(opts,container){var textContainer=document.createElement("div");textContainer.className=opts.text.className;var textStyle=opts.text.style;if(textStyle){if(opts.text.autoStyleContainer){container.style.position="relative"}utils.setStyles(textContainer,textStyle);// Default text color to progress bar's color if(!textStyle.color){textContainer.style.color=opts.color}}this._initializeTextContainer(opts,container,textContainer);return textContainer};// Give custom shapes possibility to modify text element Shape.prototype._initializeTextContainer=function(opts,container,element){// By default, no-op // Custom shapes should respect API options, such as text.style };Shape.prototype._pathString=function _pathString(opts){throw new Error("Override this function for each progress bar")};Shape.prototype._trailString=function _trailString(opts){throw new Error("Override this function for each progress bar")};Shape.prototype._warnContainerAspectRatio=function _warnContainerAspectRatio(container){if(!this.containerAspectRatio){return}var computedStyle=window.getComputedStyle(container,null),width=parseFloat(computedStyle.getPropertyValue("width"),10),height=parseFloat(computedStyle.getPropertyValue("height"),10);if(!utils.floatEquals(this.containerAspectRatio,width/height)){console.warn("Incorrect aspect ratio of container","#"+container.id,"detected:",computedStyle.getPropertyValue("width")+"(width)","/",computedStyle.getPropertyValue("height")+"(height)","=",width/height);console.warn("Aspect ratio of should be",this.containerAspectRatio)}};module.exports=Shape},{"./path":5,"./utils":9}],8:[function(require,module,exports){// Square shaped progress bar // Note: Square is not core part of API anymore. It's left here // for reference. square is not included to the progressbar // build anymore var Shape=require("./shape"),utils=require("./utils"),Square=function Square(container,options){this._pathTemplate="M 0,{halfOfStrokeWidth}"+" L {width},{halfOfStrokeWidth}"+" L {width},{width}"+" L {halfOfStrokeWidth},{width}"+" L {halfOfStrokeWidth},{strokeWidth}";this._trailTemplate="M {startMargin},{halfOfStrokeWidth}"+" L {width},{halfOfStrokeWidth}"+" L {width},{width}"+" L {halfOfStrokeWidth},{width}"+" L {halfOfStrokeWidth},{halfOfStrokeWidth}";Shape.apply(this,arguments)};Square.prototype=new Shape;Square.prototype.constructor=Square;Square.prototype._pathString=function _pathString(opts){var w=100-opts.strokeWidth/2;return utils.render(this._pathTemplate,{width:w,strokeWidth:opts.strokeWidth,halfOfStrokeWidth:opts.strokeWidth/2})};Square.prototype._trailString=function _trailString(opts){var w=100-opts.strokeWidth/2;return utils.render(this._trailTemplate,{width:w,strokeWidth:opts.strokeWidth,halfOfStrokeWidth:opts.strokeWidth/2,startMargin:opts.strokeWidth/2-opts.trailWidth/2})};module.exports=Square},{"./shape":7,"./utils":9}],9:[function(require,module,exports){// Utility functions var PREFIXES="Webkit Moz O ms".split(" "),FLOAT_COMPARISON_EPSILON=.001;// Copy all attributes from source object to destination object. // destination object is mutated. function extend(destination,source,recursive){destination=destination||{};source=source||{};recursive=recursive||!1;for(var attrName in source){if(source.hasOwnProperty(attrName)){var destVal=destination[attrName],sourceVal=source[attrName];if(recursive&&isObject(destVal)&&isObject(sourceVal)){destination[attrName]=extend(destVal,sourceVal,recursive)}else{destination[attrName]=sourceVal}}}return destination}// Renders templates with given variables. Variables must be surrounded with // braces without any spaces, e.g. {variable} // All instances of variable placeholders will be replaced with given content // Example: // render('Hello, {message}!', {message: 'world'}) function render(template,vars){var rendered=template;for(var key in vars){if(vars.hasOwnProperty(key)){var val=vars[key],regExpString="\\{"+key+"\\}",regExp=new RegExp(regExpString,"g");rendered=rendered.replace(regExp,val)}}return rendered}function setStyle(element,style,value){// cache for performance for(var elStyle=element.style,i=0,prefix;i