import e,{Component as t}from"react";import{classNames as n}from"primereact/utils";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;nthis.maxRadians)n=this.mapRange(e,this.minRadians,this.maxRadians,this.props.min,this.props.max);else{if(!(e0&&this.props.max>0?this.props.min:0,this.props.min,this.props.max,this.minRadians,this.maxRadians)}},{key:"valueRadians",value:function(){return this.mapRange(this.props.value,this.props.min,this.props.max,this.minRadians,this.maxRadians)}},{key:"minX",value:function(){return this.midX+Math.cos(this.minRadians)*this.radius}},{key:"minY",value:function(){return this.midY-Math.sin(this.minRadians)*this.radius}},{key:"maxX",value:function(){return this.midX+Math.cos(this.maxRadians)*this.radius}},{key:"maxY",value:function(){return this.midY-Math.sin(this.maxRadians)*this.radius}},{key:"zeroX",value:function(){return this.midX+Math.cos(this.zeroRadians())*this.radius}},{key:"zeroY",value:function(){return this.midY-Math.sin(this.zeroRadians())*this.radius}},{key:"valueX",value:function(){return this.midX+Math.cos(this.valueRadians())*this.radius}},{key:"valueY",value:function(){return this.midY-Math.sin(this.valueRadians())*this.radius}},{key:"largeArc",value:function(){return Math.abs(this.zeroRadians()-this.valueRadians())this.zeroRadians()?0:1}},{key:"valueToDisplay",value:function(){return this.props.valueTemplate.replace("{value}",this.props.value.toString())}},{key:"render",value:function(){var t=this,i=n("p-knob p-component",{"p-disabled":this.props.disabled},this.props.className),o=this.props.showValue&&e.createElement("text",{x:50,y:57,textAnchor:"middle",fill:this.props.textColor,className:"p-knob-text",name:this.props.name},this.valueToDisplay());return e.createElement("div",{id:this.props.id,className:i,style:this.props.style,ref:function(e){return t.element=e}},e.createElement("svg",{viewBox:"0 0 100 100",width:this.props.size,height:this.props.size,onClick:this.onClick,onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchStart:this.onTouchStart,onTouchEnd:this.onTouchEnd},e.createElement("path",{d:this.rangePath(),strokeWidth:this.props.strokeWidth,stroke:this.props.rangeColor,className:"p-knob-range"}),e.createElement("path",{d:this.valuePath(),strokeWidth:this.props.strokeWidth,stroke:this.props.valueColor,className:"p-knob-value"}),o))}}])&&o(d.prototype,v),f&&o(d,f),Object.defineProperty(d,"prototype",{writable:!1}),y}();v={id:null,style:null,className:null,value:null,size:100,disabled:!1,readOnly:!1,showValue:!0,step:1,min:0,max:100,strokeWidth:14,name:null,valueColor:"var(--primary-color, Black)",rangeColor:"var(--surface-d, LightGray)",textColor:"var(--text-color-secondary, Black)",valueTemplate:"{value}",onChange:null},(d="defaultProps")in(c=f)?Object.defineProperty(c,d,{value:v,enumerable:!0,configurable:!0,writable:!0}):c[d]=v;export{f as Knob};