Cube('pandav:/com/rasterProgressBar/1.0.0/Bar.jsx',['pandav:/npm/react/16.13.1'],function(a,b,c){function d(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function e(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,g(c.key),c)}function f(a,b,c){return b&&e(a.prototype,b),c&&e(a,c),Object.defineProperty(a,'prototype',{writable:!1}),a}function g(a){var b=h(a,'string');return'symbol'===q(b)?b:b+''}function h(a,b){if('object'!==q(a)||null===a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||'default');if('object'!==q(d))return d;throw new TypeError('@@toPrimitive must return a primitive value.')}return('string'===b?String:Number)(a)}function i(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function');a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),Object.defineProperty(a,'prototype',{writable:!1}),b&&j(a,b)}function j(a,b){return j=Object.setPrototypeOf?Object.setPrototypeOf.bind():function c(a,b){return a.__proto__=b,a},j(a,b)}function k(a){var b=n();return function c(){var d,e=p(a);if(b){var f=p(this).constructor;d=Reflect.construct(e,arguments,f)}else d=e.apply(this,arguments);return l(this,d)}}function l(a,b){if(b&&('object'===q(b)||'function'==typeof b))return b;if(void 0!==b)throw new TypeError('Derived constructors may only return object or undefined');return m(a)}function m(a){if(void 0===a)throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');return a}function n(){if('undefined'==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if('function'==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}function p(a){return p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function b(a){return a.__proto__||Object.getPrototypeOf(a)},p(a)}function q(a){"@babel/helpers - typeof";return q='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&'function'==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?'symbol':typeof a},q(a)}function r(a){for(var b=arguments,c=function c(){var e=null==b[d]?{}:b[d],f=Object.keys(e);'function'==typeof Object.getOwnPropertySymbols&&(f=f.concat(Object.getOwnPropertySymbols(e).filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),f.forEach(function(b){z(a,b,e[b])})},d=1;d<arguments.length;d++)c();return a}function s(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:'dom';if(a){var c=a.fontFamily,d=a.fontSize,e=a.italic,f=a.bold,g=a.letterSpacing,h=a.lineheight,i={fontFamily:c,fontSize:d&&d+'px',fontStyle:e?'italic':'normal',fontWeight:f?'bold':'normal',letterSpacing:g&&g+'px',lineheight:h&&h+'px'};return'svg'==b?i.fill=a.color:i.color=a.color,i}return{}}function t(a,b){if(!a.text)return null;var c=a.customStyle?a.textStyle:b;return y.createElement('div',{style:r(r({display:'inline-block'},s(c),{},{transform:'translate('.concat(a.offset.x,'px,').concat(a.offset.y,'px)')}))},a.text)}function u(a,b,c){return a>c&&(a=c),a<b&&(a=b),a}function v(a,b,c){var d=Math.sin,e=Math.cos;return[(a[0]-b[0])*e(c)-(a[1]-b[1])*d(c)+b[0],(a[0]-b[0])*d(c)+(a[1]-b[1])*e(c)+b[1]]}function w(a){if('object'==q(a)){var b;if(Array.isArray(a)){b=[];for(var c=0;c<a.length;c++)b.push(w(a[c]))}else{b={};for(var d,e=0,f=Object.keys(a);e<f.length;e++)d=f[e],b[d]=w(a[d])}return b}return a}function x(a,b){var c=Math.PI;if('linear'==a.type){var d=a.angle,e=a.stops,f=a.opacity,g=[0,0],h=[1,0];d&&(g=v(g,[.5,0],d/c),h=v(h,[.5,0],d/c));var i=w(e);return i.sort(function(a,b){return a.offset-b.offset}),{fill:'url(#'.concat(b,')'),def:y.createElement('linearGradient',{id:b,x1:g[0],y1:g[1],x2:h[0],y2:h[1]},i.map(function(a){return y.createElement('stop',{key:a.offset,offset:a.offset/100,stopColor:a.color,stopOpacity:f})}))}}return{fill:a}}var y=c('pandav:/npm/react/16.13.1'),z=function d(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a},A=function(a){function b(){return d(this,b),c.apply(this,arguments)}i(b,a);var c=k(b);return f(b,[{key:'render',value:function a(){var b=this.props.context,c=b.config,d=c.indicator,e=d;b.valueStatus&&(e=Object.assign({},d,b.valueStatus.indicator));var f=d.bg,g=f.img,h=f.offset,i=this.props.ratio*b.props.width;return y.createElement(y.Fragment,null,y.createElement('div',{style:{position:'absolute',left:i+h.x,top:h.y,width:g.width,height:g.height,transform:'translate(-50%,-50%)',background:'url('.concat(g.src,') no-repeat 50% 50% / 100% 100%')}}),y.createElement('div',{style:{position:'absolute',left:i+e.offset.x,top:e.offset.y,transform:'translate(-50%,-50%)',whiteSpace:'nowrap'}},y.createElement('span',{style:r({},s(e.textStyle))},b.data.cur),t(e.suffix,e.textStyle)))}}]),b}(y.Component),B=function(a){function b(a){return d(this,b),c.call(this,a)}i(b,a);var c=k(b);return f(b,[{key:'render',value:function a(){var b=this.props.context,c=b.config.indicator.label,d=c.textStyle,e=c.offset,f=c.show,g=c.suffix;if(!f)return null;var h=[{value:b.data.min,t:0},{value:b.data.max,t:1}];return y.createElement('div',{style:s(d)},h.map(function(a){var c=e.y+b.props.height,f=e.x=1*a.t*b.props.width;return y.createElement('div',{key:a.t,style:{transform:'translate(-50%)',position:'absolute',top:c,left:f,whiteSpace:'nowrap'}},a.value,t(g,d))}))}}]),b}(y.Component),C=function(){function a(b){d(this,a),this._value=b,this.target=null,this._curCount=0,this._totalCount=0,this._deltaValue=0,this._enabled=!1,this._updateCallback=null}return f(a,[{key:'value',get:function a(){return this._value}},{key:'setValue',value:function b(a){a!==this._value&&(this._enabled&&0<this._totalCount?(this.target=a,this._curCount=0,this._deltaValue=(a-this._value)/this._totalCount):(this._value=a,this._updateCallback&&this._updateCallback(this._value)))}},{key:'setEnable',value:function b(a){a!=this._enabled&&(a||this.stop(),this._enabled=a)}},{key:'enable',get:function a(){return this._enabled}},{key:'setDuration',value:function b(a){this._totalCount=a/(1e3/60)}},{key:'stop',value:function a(){this._value=this.target,this._deltaValue=0,this._curCount=0,this.target=null}},{key:'setUpdateCallback',value:function b(a){this._updateCallback=a}},{key:'update',value:function a(){null!=this.target&&(this._curCount<this._totalCount?(this._value+=this._deltaValue,this._curCount++):this.stop(),this._updateCallback&&this._updateCallback(this._value))}}]),a}(),D=function(a){function b(a){var e;return d(this,b),e=c.call(this,a),e.aniRatio=new C(0),e.state={ratio:0},e.aniRatio.setUpdateCallback(function(a){return e.setState({ratio:a})}),e}i(b,a);var c=k(b);return f(b,[{key:'refresh',value:function b(a){this.data=this.reduceData(a);var c=this.config.chart,d=c.enableAnimation,e=c.animationDuration;this.aniRatio.setValue(this.data.ratio),this.aniRatio.setEnable(d),this.aniRatio.setDuration(e),this.valueStatus=this.getStatus()}},{key:'getStatus',value:function a(){for(var b,c=this.data.value||this.data.ratio,d=this.config.valueRange.list,e=0;e<d.length;e++)if(b=d[e],c>=b.range.min&&c<=b.range.max)return b;return null}},{key:'renderContent',value:function a(){var b=this.props,c=b.width,d=b.height;return y.createElement(y.Fragment,null,y.createElement('svg',{width:c,height:d},this.renderProgress()),y.createElement(A,{context:this,ratio:this.state.ratio}),y.createElement(B,{context:this}))}},{key:'renderClipPath',value:function b(a){var c=this.props,d=c.width,e=c.height,f=this.config.raster,g=f.segment,h=f.interval,j=f.borderRadius,k=d/g;k=(d+k*h)/g;for(var l=[],m=1;m<=g;m++){var n=(m-1)*k,o=(1-h)*k;l.push(y.createElement('rect',{key:n,x:n,y:'0',rx:j,ry:j,width:o,height:e}))}return y.createElement('clipPath',{id:a},l)}},{key:'reduceData',value:function b(a){var c,d,e,f,g,h=this.config,i=h.chart,j=i.valueType,k=i.extremum,l=h.indicator.decimals;try{var m=a.data[0],n=+m.value;'\u771F\u5B9E\u503C'==j?(d=null==m.max?+k.max:+m.max,c=null==m.min?+k.min:+m.min,e=u((n-c)/(d-c),0,1),f=n.toFixed(l)+'%',g=n):(d='100%',c='0%',e=u(n,0,1),f=(100*n).toFixed(l)+'%')}catch(a){d='100%',c='0%',e=0,f=0 .toFixed(l)+'%',g=0}return{min:c,max:d,ratio:e,cur:f,value:g}}},{key:'renderProgress',value:function a(){var b=Math.max,c=this.props,d=c.width,e=c.height,f=this.config.raster,g=f.foreColor,h=f.bgColor,i='clipPath'+this.props.id,j=this.valueStatus?Object.assign(this.valueStatus.foreColor,g):g,k=x(j,'foreGradient'+this.props.id);return y.createElement(y.Fragment,null,y.createElement('defs',null,this.renderClipPath(i),k.def),y.createElement('rect',{width:d,height:e,fill:h,clipPath:'url(#'.concat(i,')')}),y.createElement('rect',{width:b(d*this.state.ratio,0),height:e,fill:k.fill,clipPath:'url(#'.concat(i,')')}))}},{key:'update',value:function a(){this.aniRatio.update()}}]),b}(y.Component),E=function(a){function b(){return d(this,b),c.apply(this,arguments)}i(b,a);var c=k(b);return f(b,[{key:'_refresh',value:function b(a){this.config=a.config,this.refresh(a)}},{key:'render',value:function a(){return this.renderContent()}},{key:'componentWillMount',value:function a(){this._refresh(this.props)}},{key:'componentWillReceiveProps',value:function b(a){this._refresh(a)}}]),b}(D);return a.exports=E,a.exports});