/*! For license information please see dll.ProportionsInput.js.LICENSE.txt */
(window.webpackJsonp_name_dll=window.webpackJsonp_name_dll||[]).push([[103],{3535:function(e,t,n){"use strict";n.r(t);var r=n(14),s=n.n(r),a=n(12),i=n.n(a),u=n(10),l=n.n(u),o=n(15),c=n.n(o),p=n(16),h=n.n(p),d=n(8),v=n.n(d),f=n(0),g=n.n(f),m=n(1),y=n.n(m),k=n(46),b=n(204),E=n(813),D=n(39),P=n.n(D);function R(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=v()(e);if(t){var s=v()(this).constructor;n=Reflect.construct(r,arguments,s)}else n=r.apply(this,arguments);return h()(this,n)}}function w(e){for(var t=0,n=0;n<e.length;n++)t+=e[n];return t}function x(e,t,n){for(var r=[],s=w(e),a=t+1,i=0;i<a;i++)if(i<a-1){var u={x:n[i],y:e[i]};r.push(u)}else{var l={x:" ",y:100-w(e)};100!==s&&r.push(l)}return r}var C=function(e){c()(n,e);var t=R(n);function n(e){var r;s()(this,n),(r=t.call(this,e)).legends=r.checkLegends();var a=null;return a=e.values?e.values:function(e){for(var t=new Array(e),n=100/e,r=0;r<e;r++)t[r]=n;return t}(e.nElements),r.state={values:a,propValues:e.values,visualData:x(a,e.nElements,e.legends),colors:r.setColors()},r.checkPercentage.bind(l()(r)),r}return i()(n,[{key:"componentDidUpdate",value:function(e){e.legends!==this.props.legends&&(this.legends=this.checkLegends())}},{key:"setColors",value:function(){var e=this.props.nElements,t=this.props.colors.slice(0,e);return t.push("transparent"),t}},{key:"checkLegends",value:function(){var e=[],t=this.props.nElements;if(P()(this.props.legends))return this.props.legends;for(var n=0;n<t;n++)e.push("EL "+n);return e}},{key:"checkPercentage",value:function(e,t){var n=this.state.values.slice();n[e]=t,this.props.onChange(n),this.setState({values:n,visualData:this.pieData(n)})}},{key:"getNumber",value:function(e){var t=this,n=100-w(this.state.values),r=this.state.values[e]+n;return r=Number(r.toFixed(this.props.precision)),g.a.createElement("div",{style:{float:"left",width:"120px",textAlign:"center"},key:e},g.a.createElement(b.default,{key:e,legend:this.legends[e],onChange:function(n){return t.checkPercentage(e,n)},min:0,max:r,step:this.props.step,disabled:this.props.disabled,defaultValue:this.state.values[e]}))}},{key:"renderInputs",value:function(){for(var e=[],t=this.props.nElements,n=0;n<t;n++)e.push(this.getNumber(n));return e}},{key:"renderPie",value:function(){return g.a.createElement(E.VictoryPie,{colorScale:this.state.colors,data:this.state.visualData,height:this.props.height,innerRadius:this.props.innerRadius})}},{key:"render",value:function(){var e={marginLeft:this.props.margin};return g.a.createElement("div",{className:"input"},this.renderPie(),g.a.createElement("div",{style:e},this.renderInputs()))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return e.values!==t.propValues?{values:e.values,propValues:e.values,visualData:x(e.values,e.nElements,e.legends)}:null}}]),n}(k.default);C.defaultProps={nElements:6,legends:null,precision:1,step:.1,disabled:!1,colors:["tomato","orange","gold","darkcyan","salmon","lightgreen","gainsboro","lightpurple","darkkhaki","darkseagreen"],height:200,innerRadius:75,onChange:function(){}},C.propTypes={disabled:y.a.bool,height:y.a.number,innerRadius:y.a.number,legends:y.a.array,margin:y.a.string,nElements:y.a.number,onChange:y.a.func,precision:y.a.number,step:y.a.number},t.default=C}}]);