/*
    *
    * Wijmo Library 5.20173.409
    * http://wijmo.com/
    *
    * Copyright(c) GrapeCity, Inc.  All rights reserved.
    *
    * Licensed under the GrapeCity Commercial License.
    * sales@wijmo.com
    * wijmo.com/products/wijmo-5/license/
    *
    */
var __extends=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define(["require","exports","wijmo/wijmo","wijmo/wijmo.gauge"],function(t,e,i,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),window.wijmo=window.wijmo||{},window.wijmo.gauge=n;var s;!function(t){t[t.None=0]="None",t[t.Value=1]="Value",t[t.MinMax=2]="MinMax",t[t.All=3]="All"}(s=e.ShowText||(e.ShowText={}));var r=function(t){function e(n,r){var a=t.call(this,n,null,!0)||this;a._ranges=new i.ObservableArray,a._rngElements=[],a._format="n0",a._showRanges=!0,a._shadow=!0,a._animated=!0,a._readOnly=!0,a._step=1,a._showText=s.None,a._showTicks=!1,a._thickness=.8,a._initialized=!1,a.valueChanged=new i.Event,a._getPercent=function(t){var e=this.max>this.min?(t-this.min)/(this.max-this.min):0;return Math.max(0,Math.min(1,e))},e._ctr++;var o=a.hostElement;i.setAttribute(o,"role","slider",!0);var h=a.getTemplate();return a.applyTemplate("wj-control wj-gauge",h,{_dSvg:"dsvg",_svg:"svg",_filter:"filter",_gFace:"gface",_gRanges:"granges",_gPointer:"gpointer",_gCover:"gcover",_pFace:"pface",_pPointer:"ppointer",_cValue:"cvalue",_tValue:"value",_tMin:"min",_tMax:"max",_pTicks:"pticks"}),a._filterID="wj-gauge-filter-"+e._ctr.toString(36),a._filter.setAttribute("id",a._filterID),a.face=new c,a.pointer=new c,a._ranges.collectionChanged.addHandler(function(){for(var t=a._ranges,e=0;e<t.length;e++)if(!i.tryCast(t[e],c))throw"ranges array must contain Range objects.";a._rangesDirty=!0,a.invalidate()}),a.addEventListener(o,"keydown",a._keydown.bind(a)),a.addEventListener(o,"click",function(t){0==t.button&&(a.focus(),a._applyMouseValue(t))}),a.addEventListener(o,"mousedown",function(t){0==t.button&&(a.focus(),a._dragging=!0,a._applyMouseValue(t))}),a.addEventListener(o,"mousemove",function(t){a._dragging&&a.containsFocus()&&a._applyMouseValue(t,!0)}),a.addEventListener(o,"mouseup",function(t){a._dragging=!1}),a.addEventListener(o,"mouseleave",function(t){t.target==o&&(a._dragging=!1)}),"ontouchstart"in window&&(a.addEventListener(o,"touchstart",function(t){a.focus(),!t.defaultPrevented&&a._applyMouseValue(t,!0)&&t.preventDefault()}),a.addEventListener(o,"touchmove",function(t){!t.defaultPrevented&&a._applyMouseValue(t,!0)&&t.preventDefault()})),a.addEventListener(o,"wheel",function(t){if(!t.defaultPrevented&&!a.isReadOnly&&a.containsFocus()&&null!=a.value&&a.hitTest(t)){var e=i.clamp(-t.deltaY,-1,1);a.value=i.clamp(a.value+(a.step||1)*e,a.min,a.max),t.preventDefault()}}),a.initialize(r),a.invalidate(),a}return __extends(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this._pointer.max},set:function(t){t!=this.value&&(this._pointer.max=i.asNumber(t,!0),this._updateAria())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"min",{get:function(){return this._face.min},set:function(t){t!=this.min&&(this._face.min=i.asNumber(t),this._updateAria())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"max",{get:function(){return this._face.max},set:function(t){t!=this.max&&(this._face.max=i.asNumber(t),this._updateAria())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"origin",{get:function(){return this._origin},set:function(t){t!=this._origin&&(this._origin=i.asNumber(t,!0),this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isReadOnly",{get:function(){return this._readOnly},set:function(t){this._readOnly=i.asBoolean(t),this._setAttribute(this._svg,"cursor",this._readOnly?null:"pointer"),i.toggleClass(this.hostElement,"wj-state-readonly",this.isReadOnly)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"step",{get:function(){return this._step},set:function(t){t!=this._step&&(this._step=i.asNumber(t,!0),this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"format",{get:function(){return this._format},set:function(t){t!=this._format&&(this._format=i.asString(t),this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"getText",{get:function(){return this._getText},set:function(t){t!=this._getText&&(this._getText=i.asFunction(t),this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"thickness",{get:function(){return this._thickness},set:function(t){t!=this._thickness&&(this._thickness=i.clamp(i.asNumber(t,!1),0,1),this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"face",{get:function(){return this._face},set:function(t){t!=this._face&&(this._face&&this._face.propertyChanged.removeHandler(this._rangeChanged),this._face=i.asType(t,c),this._face&&this._face.propertyChanged.addHandler(this._rangeChanged,this),this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pointer",{get:function(){return this._pointer},set:function(t){if(t!=this._pointer){var e=null;this._pointer&&(e=this.value,this._pointer.propertyChanged.removeHandler(this._rangeChanged)),this._pointer=i.asType(t,c),this._pointer&&(e&&(this.value=e),this._pointer.propertyChanged.addHandler(this._rangeChanged,this)),this.invalidate()}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"showText",{get:function(){return this._showText},set:function(t){t!=this._showText&&(this._showText=i.asEnum(t,s),this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"showTicks",{get:function(){return this._showTicks},set:function(t){t!=this._showTicks&&(this._showTicks=i.asBoolean(t),this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tickSpacing",{get:function(){return this._tickSpacing},set:function(t){t!=this._tickSpacing&&(this._tickSpacing=i.asNumber(t,!0),this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"thumbSize",{get:function(){return this._thumbSize},set:function(t){t!=this._thumbSize&&(this._thumbSize=i.asNumber(t,!0,!0),this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"showRanges",{get:function(){return this._showRanges},set:function(t){t!=this._showRanges&&(this._showRanges=i.asBoolean(t),this._animColor=null,this._rangesDirty=!0,this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasShadow",{get:function(){return this._shadow},set:function(t){t!=this._shadow&&(this._shadow=i.asBoolean(t),this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isAnimated",{get:function(){return this._animated},set:function(t){this._animated=i.asBoolean(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ranges",{get:function(){return this._ranges},enumerable:!0,configurable:!0}),e.prototype.onValueChanged=function(t){this.valueChanged.raise(this,t)},e.prototype.refresh=function(e){if(void 0===e&&(e=!0),t.prototype.refresh.call(this,e),this._rangesDirty){this._rangesDirty=!1;for(var i=this._gRanges,n=0;n<this._rngElements.length;n++)this._rngElements[n].rng.propertyChanged.removeHandler(this._rangeChanged);for(;i.lastChild;)i.removeChild(i.lastChild);if(this._rngElements=[],this._showRanges)for(n=0;n<this.ranges.length;n++){var r=this.ranges[n];r.propertyChanged.addHandler(this._rangeChanged,this),this._rngElements.push({rng:r,el:this._createElement("path",i)})}}this._showElement(this._tValue,0!=(this.showText&s.Value)),this._showElement(this._tMin,0!=(this.showText&s.MinMax)),this._showElement(this._tMax,0!=(this.showText&s.MinMax)),this._showElement(this._cValue,0!=(this.showText&s.Value)||this._thumbSize>0),this._updateText();var a=this._getFilterUrl();this._setAttribute(this._pFace,"filter",a),this._setAttribute(this._pPointer,"filter",a),this._updateRange(this._face),this._updateRange(this._pointer),this._updateTicks();for(n=0;n<this.ranges.length;n++)this._updateRange(this.ranges[n]);this._initialized=!0},e.prototype.hitTest=function(t,e){i.isNumber(t)&&i.isNumber(e)?t=new i.Point(t,e):t instanceof i.Point||(t=i.mouseToPage(t)),t=i.asType(t,i.Point);var n=i.Rect.fromBoundingRect(this._dSvg.getBoundingClientRect());return t.x-=n.left+pageXOffset,t.y-=n.top+pageYOffset,this._getValueFromPoint(t)},e._getBBox=function(t){try{return t.getBBox()}catch(t){return{x:0,y:0,width:0,height:0}}},e.prototype._getFilterUrl=function(){return this.hasShadow?"url(#"+this._filterID+")":null},e.prototype._getRangeElement=function(t){if(t==this._face)return this._pFace;if(t==this._pointer)return this._pPointer;for(var e=0;e<this._rngElements.length;e++){var i=this._rngElements[e];if(i.rng==t)return i.el}return null},e.prototype._rangeChanged=function(t,e){var n=this;if(t==this._pointer&&"max"==e.propertyName&&(this.onValueChanged(),this._updateText()),t!=this._face)if(t==this._pointer&&"max"==e.propertyName&&(this._animInterval&&clearInterval(this._animInterval),this.isAnimated&&!this.isUpdating&&this._initialized)){var s=this._getPointerColor(e.oldValue),r=this._getPointerColor(e.newValue),a=s?new i.Color(s):null,o=r?new i.Color(r):null;this._animInterval=i.animate(function(s){n._animColor=a&&o?i.Color.interpolate(a,o,s).toString():null,n._updateRange(t,e.oldValue+s*(e.newValue-e.oldValue)),s>=1&&(n._animColor=null,n._animInterval=null,n._updateRange(t),n._updateText())})}else this._updateRange(t);else this.invalidate()},e.prototype._createElement=function(t,i,n){var s=document.createElementNS(e._SVGNS,t);return n&&s.setAttribute("class",n),i.appendChild(s),s},e.prototype._centerText=function(t,n,s){if("none"!=t.getAttribute("display")){var r=i.Globalize.format(n,this.format);if(i.isFunction(this.getText)){var a=t==this._tValue?"value":t==this._tMin?"min":t==this._tMax?"max":null;i.assert(null!=a,"unknown element"),r=this.getText(this,a,n,r)}t.textContent=r;var o=i.Rect.fromBoundingRect(e._getBBox(t)),h=s.x-o.width/2,u=s.y+o.height/4;t.setAttribute("x",this._fix(h)),t.setAttribute("y",this._fix(u))}},e.prototype._copy=function(t,e){if("ranges"==t){for(var n=i.asArray(e),s=0;s<n.length;s++){var r=new c;i.copy(r,n[s]),this.ranges.push(r)}return!0}return"pointer"==t&&(i.copy(this.pointer,e),!0)},e.prototype._showElement=function(t,e){this._setAttribute(t,"display",e?"":"none")},e.prototype._setAttribute=function(t,e,i){i?t.setAttribute(e,i):t.removeAttribute(e)},e.prototype._updateRange=function(t,e){void 0===e&&(e=t.max),t==this._pointer&&(t.min=null!=this.origin?this.origin:this.min<0&&this.max>0?0:this.min);var i=this._getRangeElement(t);if(i){this._updateRangeElement(i,t,e);var n=t.color;t==this._pointer&&(n=this._animColor?this._animColor:this._getPointerColor(t.max)),this._setAttribute(i,"style",n?"fill:"+n:null)}},e.prototype._getPointerColor=function(t){if(!this._showRanges){for(var e,i=0;i<this._ranges.length;i++){var n=this._ranges[i];if(t>=n.min&&t<=n.max){e=n;break}}if(e)return e.color}return this._pointer.color},e.prototype._keydown=function(t){if(!this._readOnly&&this._step){var e=!0;switch(this._getKey(t.keyCode)){case i.Key.Left:case i.Key.Down:this.value=i.clamp(this.value-this.step,this.min,this.max);break;case i.Key.Right:case i.Key.Up:this.value=i.clamp(this.value+this.step,this.min,this.max);break;case i.Key.Home:this.value=this.min;break;case i.Key.End:this.value=this.max;break;default:e=!1}e&&t.preventDefault()}},e.prototype._getKey=function(t){return t},e.prototype._applyMouseValue=function(t,e){if(!this.isReadOnly&&this.containsFocus()){var n=this.hitTest(t);if(null!=n){var s=this._animated;return e&&(this._animated=!1),null!=this._step&&(n=Math.round(n/this._step)*this._step),this.value=i.clamp(n,this.min,this.max),this._animated=s,!0}}return!1},e.prototype._updateRangeElement=function(t,e,n){i.assert(!1,"Gauge is an abstract class.")},e.prototype._updateText=function(){i.assert(!1,"Gauge is an abstract class.")},e.prototype._updateTicks=function(){i.assert(!1,"Gauge is an abstract class.")},e.prototype._getValueFromPoint=function(t){return null},e.prototype._fix=function(t){return i.isNumber(t)?parseFloat(t.toFixed(4)).toString():this._fix(t.x)+" "+this._fix(t.y)},e.prototype._updateAria=function(){var t=this.hostElement;t&&(i.setAttribute(t,"aria-valuemin",this.min),i.setAttribute(t,"aria-valuemax",this.max),i.setAttribute(t,"aria-valuenow",this.value))},e._SVGNS="http://www.w3.org/2000/svg",e._ctr=0,e.controlTemplate='<div wj-part="dsvg" style="width:100%;height:100%"><svg wj-part="svg" width="100%" height="100%" style="overflow:visible"><defs><filter wj-part="filter"><feOffset dx="3" dy="3"></feOffset><feGaussianBlur result="offset-blur" stdDeviation="5"></feGaussianBlur><feComposite operator="out" in="SourceGraphic" in2="offset-blur" result="inverse"></feComposite><feFlood flood-color="black" flood-opacity="0.2" result="color"></feFlood><feComposite operator="in" in="color" in2="inverse" result="shadow"></feComposite><feComposite operator="over" in="shadow" in2="SourceGraphic"></feComposite></filter></defs><g wj-part="gface" class="wj-face" style="cursor:inherit"><path wj-part="pface"/></g><g wj-part="granges" class="wj-ranges" style="cursor:inherit"/><g wj-part="gpointer" class="wj-pointer" style="cursor:inherit"><path wj-part="ppointer"/></g><g wj-part="gcover" class="wj-cover" style="cursor:inherit"><path wj-part="pticks" class="wj-ticks"/><circle wj-part="cvalue" class="wj-pointer wj-thumb"/><text wj-part="value" class="wj-value"/><text wj-part="min" class="wj-min" aria-hidden="true"/><text wj-part="max" class="wj-max" aria-hidden="true"/></g></svg></div>',e}(i.Control);e.Gauge=r;var a;!function(t){t[t.Right=0]="Right",t[t.Left=1]="Left",t[t.Up=2]="Up",t[t.Down=3]="Down"}(a=e.GaugeDirection||(e.GaugeDirection={}));var o=function(t){function e(e,n){var s=t.call(this,e,null)||this;return s._direction=a.Right,i.addClass(s.hostElement,"wj-lineargauge"),s.initialize(n),s}return __extends(e,t),Object.defineProperty(e.prototype,"direction",{get:function(){return this._direction},set:function(t){t!=this._direction&&(this._direction=i.asEnum(t,a),this.invalidate())},enumerable:!0,configurable:!0}),e.prototype._updateRangeElement=function(t,e,n){var o=this._getRangeRect(e,n);this._updateSegment(t,o);var h=e==this._pointer&&0!=(this.showText&s.Value),u=h||e==this._pointer&&this.thumbSize>0,c=o.left+o.width/2,l=o.top+o.height/2;switch(this._getDirection()){case a.Right:c=o.right;break;case a.Left:c=o.left;break;case a.Up:l=o.top;break;case a.Down:l=o.bottom}if(h&&this._centerText(this._tValue,n,new i.Point(c,l)),h||u){o=i.Rect.fromBoundingRect(r._getBBox(this._tValue));var g=this._animColor?this._animColor:this._getPointerColor(e.max),_=null!=this.thumbSize?this.thumbSize/2:.8*Math.max(o.width,o.height),p=this._cValue;this._setAttribute(p,"cx",this._fix(c)),this._setAttribute(p,"cy",this._fix(l)),this._setAttribute(p,"style",g?"fill:"+g:null),this._setAttribute(p,"r",this._fix(_))}},e.prototype._updateText=function(){var t=this._getRangeRect(this._face);switch(this._getDirection()){case a.Right:this._setText(this._tMin,this.min,t,"left"),this._setText(this._tMax,this.max,t,"right");break;case a.Left:this._setText(this._tMin,this.min,t,"right"),this._setText(this._tMax,this.max,t,"left");break;case a.Up:this._setText(this._tMin,this.min,t,"bottom"),this._setText(this._tMax,this.max,t,"top");break;case a.Down:this._setText(this._tMin,this.min,t,"top"),this._setText(this._tMax,this.max,t,"bottom")}},e.prototype._updateTicks=function(){var t=this.tickSpacing&&this.tickSpacing>0?this.tickSpacing:this.step,e="";if(this.showTicks&&t>0)for(var i=this._getRangeRect(this._face),n=void 0,s=this.min+t;s<this.max;s+=t)switch(this._getDirection()){case a.Right:e+="M "+(n=this._fix(i.left+i.width*this._getPercent(s)))+" "+this._fix(i.top)+" L "+n+" "+this._fix(i.bottom)+" ";break;case a.Left:e+="M "+(n=this._fix(i.right-i.width*this._getPercent(s)))+" "+i.top.toFixed(2)+" L "+n+" "+i.bottom.toFixed(2)+" ";break;case a.Up:n=(i.bottom-i.height*this._getPercent(s)).toFixed(2),e+="M "+this._fix(i.left)+" "+n+" L "+this._fix(i.right)+" "+n+" ";break;case a.Down:n=(i.top+i.height*this._getPercent(s)).toFixed(2),e+="M "+i.left.toFixed(2)+" "+n+" L "+i.right.toFixed(2)+" "+n+" "}this._pTicks.setAttribute("d",e)},e.prototype._updateSegment=function(t,e){var n={p1:this._fix(new i.Point(e.left,e.top)),p2:this._fix(new i.Point(e.right,e.top)),p3:this._fix(new i.Point(e.right,e.bottom)),p4:this._fix(new i.Point(e.left,e.bottom))},s=i.format("M {p1} L {p2} L {p3} L {p4} Z",n);t.setAttribute("d",s)},e.prototype._setText=function(t,e,n,s){if("none"!=t.getAttribute("display")){var a=i.Globalize.format(e,this.format);if(i.isFunction(this.getText)){var o=t==this._tValue?"value":t==this._tMin?"min":t==this._tMax?"max":null;i.assert(null!=o,"unknown element"),a=this.getText(this,o,e,a)}t.textContent=a;var h=i.Rect.fromBoundingRect(r._getBBox(t)),u=new i.Point(n.left+n.width/2-h.width/2,n.top+n.height/2+h.height/2);switch(s){case"top":u.y=n.top-4;break;case"left":u.x=n.left-4-h.width;break;case"right":u.x=n.right+4;break;case"bottom":u.y=n.bottom+4+h.height}t.setAttribute("x",this._fix(u.x)),t.setAttribute("y",this._fix(u.y))}},e.prototype._getRangeRect=function(t,e){void 0===e&&(e=t.max);var n=new i.Rect(0,0,this.hostElement.clientWidth,this.hostElement.clientHeight),r=this.thumbSize?Math.ceil(this.thumbSize/2):0;if(this.showText!=s.None){var o=parseInt(getComputedStyle(this.hostElement).fontSize);isNaN(o)||(r=Math.max(r,3*o))}switch(this._getDirection()){case a.Right:case a.Left:n=n.inflate(-r,-n.height*(1-this.thickness*t.thickness)/2);break;case a.Up:case a.Down:n=n.inflate(-n.width*(1-this.thickness*t.thickness)/2,-r)}var h=t==this._face,u=h?0:this._getPercent(t.min),c=h?1:this._getPercent(e);switch(this._getDirection()){case a.Right:n.left+=n.width*u,n.width*=c-u;break;case a.Left:n.left=n.right-n.width*c,n.width=n.width*(c-u);break;case a.Down:n.top+=n.height*u,n.height*=c-u;break;case a.Up:n.top=n.bottom-n.height*c,n.height=n.height*(c-u)}return n},e.prototype._getValueFromPoint=function(t){var e=this._getRangeRect(this._face),i=0;switch(this._getDirection()){case a.Right:i=e.width>0?(t.x-e.left)/e.width:0;break;case a.Left:i=e.width>0?(e.right-t.x)/e.width:0;break;case a.Up:i=e.height>0?(e.bottom-t.y)/e.height:0;break;case a.Down:i=e.height>0?(t.y-e.top)/e.height:0}return this.min+i*(this.max-this.min)},e.prototype._getDirection=function(){var t=this._direction;if(this.rightToLeft)switch(t){case a.Left:t=a.Right;break;case a.Right:t=a.Left}return t},e.prototype._getKey=function(t){switch(this._getDirection()){case a.Left:switch(t){case i.Key.Left:t=i.Key.Right;break;case i.Key.Right:t=i.Key.Left}break;case a.Down:switch(t){case i.Key.Up:t=i.Key.Down;break;case i.Key.Down:t=i.Key.Up}}return t},e}(r);e.LinearGauge=o;var h=function(t){function e(e,n){var r=t.call(this,e,null)||this;return r._startAngle=0,r._sweepAngle=180,r._autoScale=!0,i.addClass(r.hostElement,"wj-radialgauge"),r._thickness=.4,r.showText=s.All,r.initialize(n),r}return __extends(e,t),Object.defineProperty(e.prototype,"startAngle",{get:function(){return this._startAngle},set:function(t){t!=this._startAngle&&(this._startAngle=i.clamp(i.asNumber(t,!1),-360,360),this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"sweepAngle",{get:function(){return this._sweepAngle},set:function(t){t!=this._sweepAngle&&(this._sweepAngle=i.clamp(i.asNumber(t,!1),-360,360),this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"autoScale",{get:function(){return this._autoScale},set:function(t){t!=this._autoScale&&(this._autoScale=i.asBoolean(t),this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"clientSize",{get:function(){var t=this._rcSvg;return t?new i.Size(t.width,t.height):null},enumerable:!0,configurable:!0}),e.prototype.refresh=function(e){if(void 0===e&&(e=!0),this._setAttribute(this._svg,"viewBox",null),this._rcSvg=i.Rect.fromBoundingRect(this._dSvg.getBoundingClientRect()),t.prototype.refresh.call(this,e),this._ctmInv=null,this._ptSvg=null,this._autoScale){this._setAttribute(this._svg,"viewBox","");var n=i.Rect.fromBoundingRect(r._getBBox(this._pFace));0!=(this.showText&s.Value)&&(n=i.Rect.union(n,i.Rect.fromBoundingRect(r._getBBox(this._tValue)))),0!=(this.showText&s.MinMax)&&(n=i.Rect.union(n,i.Rect.fromBoundingRect(r._getBBox(this._tMin))),n=i.Rect.union(n,i.Rect.fromBoundingRect(r._getBBox(this._tMax))));var a=[this._fix(n.left),this._fix(n.top),this._fix(n.width),this._fix(n.height)].join(" ");this._setAttribute(this._svg,"viewBox",a);var o=this._pFace.getCTM();this._ctmInv=o?o.inverse():null,this._ptSvg=this._svg.createSVGPoint()}},e.prototype._updateRangeElement=function(t,e,n){if(this._rcSvg){var s=this._rcSvg,r=new i.Point(s.width/2,s.height/2),a=Math.min(s.width,s.height)/2,o=a*this.thickness,h=o*e.thickness,u=a-(o-h)/2,c=u-h,l=this.startAngle+180,g=this.sweepAngle,_=e==this._face,p=_?0:this._getPercent(e.min),f=l+g*p,d=g*((_?1:this._getPercent(n))-p);if(this._updateSegment(t,r,u,c,f,d),e==this._pointer&&this.thumbSize>0){var m=this._animColor?this._animColor:this._getPointerColor(e.max),b=this._getPoint(r,l+g*this._getPercent(n),(u+c)/2),v=this._cValue;this._setAttribute(v,"cx",this._fix(b.x)),this._setAttribute(v,"cy",this._fix(b.y)),this._setAttribute(v,"style",m?"fill:"+m:null),this._setAttribute(v,"r",this._fix(this.thumbSize/2))}}},e.prototype._updateText=function(){if(this._rcSvg){var t=this._rcSvg,e=new i.Point(t.width/2,t.height/2),n=Math.min(t.width,t.height)/2,r=Math.max(0,n*(1-this.thickness)),a=this.startAngle+180,o=this.sweepAngle;this._showElement(this._cValue,this.thumbSize>0);var h=0!=(this.showText&s.MinMax)&&Math.abs(o)<=300;this._showElement(this._tMin,h),this._showElement(this._tMax,h),this._centerText(this._tValue,this.value,e);var u=10*(this.sweepAngle<0?-1:1);this._centerText(this._tMin,this.min,this._getPoint(e,a-u,(n+r)/2)),this._centerText(this._tMax,this.max,this._getPoint(e,a+o+u,(n+r)/2))}},e.prototype._updateTicks=function(){var t=this.tickSpacing&&this.tickSpacing>0?this.tickSpacing:this.step,e="";if(this.showTicks&&t>0)for(var n=this._rcSvg,s=new i.Point(n.width/2,n.height/2),r=Math.min(n.width,n.height)/2,a=r*this.thickness,o=a*this._face.thickness,h=r-(a-o)/2,u=h-o,c=this.min+t;c<this.max;c+=t){var l=this.startAngle+180+this.sweepAngle*this._getPercent(c);e+="M "+this._fix(this._getPoint(s,l,u))+" L "+this._fix(this._getPoint(s,l,h))+" "}this._pTicks.setAttribute("d",e)},e.prototype._updateSegment=function(t,e,n,s,r,a){a=Math.min(Math.max(a,-359.99),359.99);var o=this._getPoint(e,r,s),h=this._getPoint(e,r,n),u=this._getPoint(e,r+a,n),c=this._getPoint(e,r+a,s),l={large:Math.abs(a)>180?1:0,cw:a>0?1:0,ccw:a>0?0:1,or:this._fix(n),ir:this._fix(s),p1:this._fix(o),p2:this._fix(h),p3:this._fix(u),p4:this._fix(c)},g=i.format("M {p1} L {p2} A {or} {or} 0 {large} {cw} {p3} L {p4} A {ir} {ir} 0 {large} {ccw} {p1} Z",l);t.setAttribute("d",g)},e.prototype._getPoint=function(t,e,n){return e=e*Math.PI/180,new i.Point(t.x+n*Math.cos(e),t.y+n*Math.sin(e))},e.prototype._getValueFromPoint=function(t){if(this.autoScale&&this._ctmInv&&(this._ptSvg.x=t.x,this._ptSvg.y=t.y,this._ptSvg=this._ptSvg.matrixTransform(this._ctmInv),t.x=this._ptSvg.x,t.y=this._ptSvg.y),!this._rcSvg)return null;var e=this._rcSvg,n=new i.Point(e.width/2,e.height/2),s=Math.min(e.width,e.height)/2,r=s*(1-this.thickness),a=t.x-n.x,o=t.y-n.y,h=o*o+a*a;if(h>s*s+16||h<r*r-16)return null;var u=180*(Math.PI-Math.atan2(-o,a))/Math.PI,c=this.startAngle,l=this.sweepAngle;if(l>0){for(;u<c;)u+=360;for(;u>c+l;)u-=360}else{for(;u<c+l;)u+=360;for(;u>c;)u-=360}var g=Math.abs(u-c)/Math.abs(l);return this.min+g*(this.max-this.min)},e}(r);e.RadialGauge=h;var u=function(t){function e(e,n){var s=t.call(this,e,null)||this;return i.addClass(s.hostElement,"wj-bulletgraph"),s._pointer.thickness=.35,s._rngTarget=new c("target"),s._rngTarget.thickness=.8,s._rngTarget.color="black",s._rngGood=new c("good"),s._rngGood.color="rgba(0,0,0,.15)",s._rngBad=new c("bad"),s._rngBad.color="rgba(0,0,0,.3)",s.ranges.push(s._rngBad),s.ranges.push(s._rngGood),s.ranges.push(s._rngTarget),s.initialize(n),s}return __extends(e,t),Object.defineProperty(e.prototype,"target",{get:function(){return this._rngTarget.max},set:function(t){this._rngTarget.max=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"good",{get:function(){return this._rngGood.max},set:function(t){this._rngGood.max=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bad",{get:function(){return this._rngBad.max},set:function(t){this._rngBad.max=t},enumerable:!0,configurable:!0}),e.prototype._getRangeRect=function(e,i){void 0===i&&(i=e.max);var n=t.prototype._getRangeRect.call(this,e,i);if(e==this._rngTarget)switch(this.direction){case a.Right:n.left=n.right-1,n.width=3;break;case a.Left:n.width=3;break;case a.Up:n.height=3;break;case a.Down:n.top=n.bottom-1,n.height=3}return n},e}(o);e.BulletGraph=u;var c=function(){function t(t){this._min=0,this._max=100,this._thickness=1,this.propertyChanged=new i.Event,this._name=t}return Object.defineProperty(t.prototype,"min",{get:function(){return this._min},set:function(t){this._setProp("_min",i.asNumber(t,!0))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"max",{get:function(){return this._max},set:function(t){this._setProp("_max",i.asNumber(t,!0))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"color",{get:function(){return this._color},set:function(t){this._setProp("_color",i.asString(t))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._setProp("_thickness",i.clamp(i.asNumber(t),0,1))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this._name},set:function(t){this._setProp("_name",i.asString(t))},enumerable:!0,configurable:!0}),t.prototype.onPropertyChanged=function(t){this.propertyChanged.raise(this,t)},t.prototype._setProp=function(t,e){var n=this[t];if(e!=n){this[t]=e;var s=new i.PropertyChangedEventArgs(t.substr(1),n,e);this.onPropertyChanged(s)}},t._ctr=0,t}();e.Range=c});