!function(e){"use strict";function t(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(t||(t="undefined"==typeof window?global:window),void 0!==t[e])return t[e];for(var i=["webkit","moz","ms","o"],r=0,o=i.length,n=e.charAt(0).toUpperCase()+e.substr(1);r1&&(d=1),1!==d&&(u=r(d),isFinite(u)&&!isNaN(u)&&(d=u)),t&&t(d),s0){for(a=e.toFixed(i).toString().split("."),n=r-a[0].length;o1?(r=~i.indexOf("."),~i.indexOf("-")?"-"+[t.majorTicksInt+t.majorTicksDec+2+(r?1:0)-i.length].join("0")+i.replace("-",""):[t.majorTicksInt+t.majorTicksDec+1+(r?1:0)-i.length].join("0")+i):i}function h(e){return e*Math.PI/180}function f(e,t){return{x:-e*Math.sin(t),y:e*Math.cos(t)}}function v(e,t,i,r){var o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,a=e.createLinearGradient(o?0:n,o?n:0,o?0:r,o?r:0);return a.addColorStop(0,t),a.addColorStop(1,i),a}function m(e,t){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2])return e.restore(),!0;e.save();var i=t.borderShadowWidth;return i&&(e.shadowBlur=i,e.shadowColor=t.colorBorderShadow),!0}function p(e,t){t.needleShadow&&(e.shadowOffsetX=2,e.shadowOffsetY=2,e.shadowBlur=10,e.shadowColor=t.colorNeedleShadowDown)}function g(e,t,i){return e["font"+t+"Style"]+" "+e["font"+t+"Weight"]+" "+e["font"+t+"Size"]*i+"px "+e["font"+t]}function w(e){e.shadowOffsetX=null,e.shadowOffsetY=null,e.shadowBlur=null,e.shadowColor="",e.strokeStyle=null,e.lineWidth=0,e.save()}function b(e,t,i,r){t.valueTextShadow&&(e.shadowOffsetX=i,e.shadowOffsetY=i,e.shadowBlur=r,e.shadowColor=t.colorValueTextShadow)}function y(e,t,i,r,o,n){if(t.valueBox){w(e);var a=t.valueDec?1+t.valueDec:0,l="9".repeat(Math.max.apply(null,[String(parseInt(i)).length+a].concat(t.majorTicks.map(function(e){return String(parseInt(e,10)).length+a})))),s=t.valueText||u(i,t),c=n/200,h=n/100,f=.4*h,v=1.2*h;e.font=g(t,"Value",c),b(e,t,f,v);var m=e.measureText(t.valueText?s:"-"+u(Number(l),t)).width;w(e);var p=parseFloat(t.fontValueSize)*c+f+v,y=h*parseFloat(t.valueBoxStroke),x=2*n-2*y,k=m+10*h,T=1.1*p+f+v,S=h*t.valueBoxBorderRadius,O=(parseFloat(t.valueBoxWidth)||0)/100*x;O>k&&(k=O),k>x&&(k=x);var A=r-k/2,C=o-T/2,V=o-5.75*h;if(e.beginPath(),S?d(e,A,C,k,T,S):e.rect(A,C,k,T),y){var N=e.createRadialGradient(r,V,10*h,r,V,20*h);N.addColorStop(0,t.colorValueBoxRect),N.addColorStop(1,t.colorValueBoxRectEnd),e.strokeStyle=N,e.lineWidth=y,e.stroke()}t.colorValueBoxShadow&&(e.shadowBlur=1.2*h,e.shadowColor=t.colorValueBoxShadow),t.colorValueBoxBackground&&(e.fillStyle=t.colorValueBoxBackground,e.fill()),e.closePath(),e.restore(),b(e,t,f,v),e.fillStyle=t.colorValueText,e.textAlign="center",e.textBaseline="alphabetic",e.fillText(s,A+k/2,o+T/2-p/3),e.restore()}}function x(e){var t=e.value,i=e.minValue,r=e.maxValue,o=.01*(r-i);return{normal:tr?r:t,indented:tr?r+o:t}}function k(e,t,i,r,o){i.beginPath(),i.arc(0,0,J(e),0,2*Q,!0),i.lineWidth=t,i.strokeStyle=o?K.linearGradient(i,r,o,e):r,i.stroke(),i.closePath()}function T(e,t){var i=X.pixelRatio;return e.maxRadius||(e.maxRadius=e.max-t.borderShadowWidth-t.borderOuterWidth*i-t.borderMiddleWidth*i-t.borderInnerWidth*i+(t.borderOuterWidth?.5:0)+(t.borderMiddleWidth?.5:0)+(t.borderInnerWidth?.5:0)),e.maxRadius}function S(e,t){var i=X.pixelRatio,r=t.borderShadowWidth*i,o=e.max-r-t.borderOuterWidth*i/2,n=o-t.borderOuterWidth*i/2-t.borderMiddleWidth*i/2+.5,a=n-t.borderMiddleWidth*i/2-t.borderInnerWidth*i/2+.5,l=T(e,t),s=void 0,d=!1;e.save(),t.borderOuterWidth&&(d=K.drawShadow(e,t,d),k(o,t.borderOuterWidth*i,e,t.colorBorderOuter,t.colorBorderOuterEnd)),t.borderMiddleWidth&&(d=K.drawShadow(e,t,d),k(n,t.borderMiddleWidth*i,e,t.colorBorderMiddle,t.colorBorderMiddleEnd)),t.borderInnerWidth&&(d=K.drawShadow(e,t,d),k(a,t.borderInnerWidth*i,e,t.colorBorderInner,t.colorBorderInnerEnd)),K.drawShadow(e,t,d),e.beginPath(),e.arc(0,0,J(l),0,2*Q,!0),t.colorPlateEnd?(s=e.createRadialGradient(0,0,l/2,0,0,l),s.addColorStop(0,t.colorPlate),s.addColorStop(1,t.colorPlateEnd)):s=t.colorPlate,e.fillStyle=s,e.fill(),e.closePath(),e.restore()}function O(e,t){var i=e.max*(parseFloat(t.highlightsWidth)||0)/100;if(i){var r=J(C(e,t)-i/2),o=0,n=t.highlights.length,a=(t.maxValue-t.minValue)/t.ticksAngle;for(e.save();o>>0;if(0===o)return-1;var n=+t||0;if(Math.abs(n)===1/0&&(n=0),n>=o)return-1;for(i=Math.max(n>=0?n:o-Math.abs(n),0);i>>0,r=arguments[1],o=r>>0,n=o<0?Math.max(i+o,0):Math.min(o,i),a=arguments[2],l=void 0===a?i:a>>0,s=l<0?Math.max(i+l,0):Math.min(l,i);n1?r-1:0),n=1;n1?t-1:0),r=1;r=(7-4*t)/11)return-Math.pow((11-6*t-11*e)/4,2)+Math.pow(i,2)},elastic:function(e){return 1-L.delastic(1-e)},delastic:function(e){return Math.pow(2,10*(e-1))*Math.cos(20*Math.PI*1.5/3*e)}},U=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"linear",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:250,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){};if(r(this,e),this.duration=i,this.rule=t,this.draw=o,this.end=n,"function"!=typeof this.draw)throw new TypeError("Invalid animation draw callback:",o);if("function"!=typeof this.end)throw new TypeError("Invalid animation end callback:",n)}return z(e,[{key:"animate",value:function(e,t){var i=this;this.frame&&this.cancel();var r=window.performance&&window.performance.now?window.performance.now():o("animationStartTime")||Date.now();e=e||this.draw,t=t||this.end,this.draw=e,this.end=t,this.frame=G(function(o){return n(o,e,r,L[i.rule]||i.rule,i.duration,t,i)})}},{key:"cancel",value:function(){if(this.frame){(o("cancelAnimationFrame")||function(e){})(this.frame),this.frame=null}}},{key:"destroy",value:function(){this.cancel(),this.draw=null,this.end=null}}]),e}();U.rules=L;var q=function(){function t(i,o,n){r(this,t),this.options=i,this.element=o.toLowerCase(),this.type=t.toDashed(n),this.Type=e[n],this.mutationsObserved=!1,this.isObservable=!!window.MutationObserver,window.GAUGES_NO_AUTO_INIT||t.domReady(this.traverse.bind(this))}return z(t,[{key:"isValidNode",value:function(e){return!(!e.tagName||e.tagName.toLowerCase()!==this.element||e.getAttribute("data-type")!==this.type)}},{key:"traverse",value:function(){for(var e=document.getElementsByTagName(this.element),t=0,i=e.length;t1&&void 0!==arguments[1])||arguments[1],i=e.split(/-/),r=0,o=i.length,n="";r1&&void 0!==arguments[1]?arguments[1]:0;return e=parseFloat(e),!isNaN(e)&&isFinite(e)||(e=parseFloat(t)||0),e}},{key:"version",get:function(){return H}}]),n}(F);void 0!==e&&(e.BaseGauge=Z,e.gauges=(window.document||{}).gauges=$);var K={roundRect:d,padValue:u,formatMajorTickNumber:c,radians:h,radialPoint:f,linearGradient:v,drawNeedleShadow:p,drawValueBox:y,verifyError:l,prepareTicks:s,drawShadow:m,font:g,normalizedValue:x},Q=Math.PI,ee=Q/2,te=Object.assign({},Y,{ticksAngle:270,startAngle:45,colorNeedleCircleOuter:"#f0f0f0",colorNeedleCircleOuterEnd:"#ccc",colorNeedleCircleInner:"#e8e8e8",colorNeedleCircleInnerEnd:"#f5f5f5",needleCircleSize:10,needleCircleInner:!0,needleCircleOuter:!0,needleStart:20,animationTarget:"needle",useMinPath:!1,barWidth:0}),ie=function(e){function o(e){return r(this,o),e=Object.assign({},te,e||{}),t(this,(o.__proto__||Object.getPrototypeOf(o)).call(this,o.configure(e)))}return i(o,e),z(o,[{key:"draw",value:function(){try{var e=this.canvas,t=[-e.drawX,-e.drawY,e.drawWidth,e.drawHeight],i=t[0],r=t[1],n=t[2],a=t[3],l=this.options;if("needle"===l.animationTarget){if(!e.elementClone.initialized){var s=e.contextClone;s.clearRect(i,r,n,a),s.save(),this.emit("beforePlate"),S(s,l),this.emit("beforeHighlights"),O(s,l),this.emit("beforeMinorTicks"),A(s,l),this.emit("beforeMajorTicks"),V(s,l),this.emit("beforeNumbers"),j(s,l),this.emit("beforeTitle"),M(s,l),this.emit("beforeUnits"),B(s,l),e.elementClone.initialized=!0}this.canvas.commit(),e.context.clearRect(i,r,n,a),e.context.save(),e.context.drawImage(e.elementClone,i,r,n,a),e.context.save(),this.emit("beforeProgressBar"),E(e.context,l),this.emit("beforeValueBox"),_(e.context,l,R(this)),this.emit("beforeNeedle"),W(e.context,l)}else{var d=-K.radians((l.value-l.minValue)/(l.maxValue-l.minValue)*l.ticksAngle);if(e.context.clearRect(i,r,n,a),e.context.save(),this.emit("beforePlate"),S(e.context,l),e.context.rotate(d),this.emit("beforeHighlights"),O(e.context,l),this.emit("beforeMinorTicks"),A(e.context,l),this.emit("beforeMajorTicks"),V(e.context,l),this.emit("beforeNumbers"),j(e.context,l),this.emit("beforeProgressBar"),E(e.context,l),e.context.rotate(-d),e.context.save(),!e.elementClone.initialized){var u=e.contextClone;u.clearRect(i,r,n,a),u.save(),this.emit("beforeTitle"),M(u,l),this.emit("beforeUnits"),B(u,l),this.emit("beforeNeedle"),W(u,l),e.elementClone.initialized=!0}e.context.drawImage(e.elementClone,i,r,n,a)}this.emit("beforeValueBox"),_(e.context,l,R(this)),I(o.prototype.__proto__||Object.getPrototypeOf(o.prototype),"draw",this).call(this)}catch(e){K.verifyError(e)}return this}},{key:"value",set:function(e){e=Z.ensureValue(e,this.options.minValue),this.options.animation&&360===this.options.ticksAngle&&this.options.useMinPath&&(this._value=e,e=this.options.value+((e-this.options.value)%360+540)%360-180),D(o.prototype.__proto__||Object.getPrototypeOf(o.prototype),"value",e,this)},get:function(){return I(o.prototype.__proto__||Object.getPrototypeOf(o.prototype),"value",this)}}],[{key:"configure",value:function(e){return e.barWidth>50&&(e.barWidth=50),isNaN(e.startAngle)&&(e.startAngle=45),isNaN(e.ticksAngle)&&(e.ticksAngle=270),e.ticksAngle>360&&(e.ticksAngle=360),e.ticksAngle<0&&(e.ticksAngle=0),e.startAngle<0&&(e.startAngle=0),e.startAngle>360&&(e.startAngle=360),e}}]),o}(Z);void 0!==e&&(e.RadialGauge=ie),Z.initialize("RadialGauge",te),"undefined"!=typeof module&&Object.assign(e,{Collection:a,GenericOptions:Y,Animation:U,BaseGauge:Z,drawings:K,SmartCanvas:X,DomObserver:q,vendorize:o})}("undefined"!=typeof module?module.exports:window);