wml-custom-spectrum 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -0
- package/package.json +37 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("react"));else if("function"==typeof define&&define.amd)define(["react"],e);else{var r=e("object"==typeof exports?require("react"):t.react);for(var n in r)("object"==typeof exports?exports:t)[n]=r[n]}}("undefined"!=typeof self?self:this,function(t){return function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=1)}([function(e,r){e.exports=t},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(2);e.default=n.a},function(t,e,r){"use strict";var n=r(3);e.a=n.a},function(t,e,r){"use strict";function n(t){"@babel/helpers - typeof";return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=s(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,l=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){l=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(l)throw o}}}}function o(t){return c(t)||l(t)||s(t)||a()}function a(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function s(t,e){if(t){if("string"==typeof t)return u(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(t,e):void 0}}function l(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function c(t){if(Array.isArray(t))return u(t)}function u(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function d(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function h(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?d(Object(r),!0).forEach(function(e){S(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function f(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function p(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,I(n.key),n)}}function g(t,e,r){return e&&p(t.prototype,e),r&&p(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function v(t,e,r){return e=b(e),m(t,x()?Reflect.construct(e,r||[],b(t).constructor):e.apply(t,r))}function m(t,e){if(e&&("object"==n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return y(t)}function y(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function x(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(x=function(){return!!t})()}function b(t){return(b=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function w(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&A(t,e)}function A(t,e){return(A=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function S(t,e,r){return(e=I(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function I(t){var e=P(t,"string");return"symbol"==n(e)?e:e+""}function P(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e||"default");if("object"!=n(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}var k=r(0),R=r.n(k),O=r(4),E=r.n(O),L=r(6),M=function(t){function e(t){var r;return f(this,e),r=v(this,e,[t]),S(r,"onToolRef",function(t){r.ref=t}),S(r,"reflow",function(){var t=document.getElementById(r.id),e=t.getBoundingClientRect(),n=e.width,i=Math.floor(e.height),o=r.staticCanvasRef.current;o.setAttribute("width",n),o.setAttribute("height",i);var a=r.canvasRef.current;a.setAttribute("width",n),a.setAttribute("height",i),r.ref.setState({canvasWidth:n,canvasHeight:i}),r.updateXPlotLine(r.ref.state.xplotLines),r.updateRectAndTextsPosition(),r.updateYPlotLinePosition(),r.updateSymbolsPosition(),r.updateRenderLabelsPosition(),r.worker.postMessage({type:"resize",width:n,height:i})}),S(r,"init",function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.padding,n=void 0===e?r.padding:e,i=t.yTickInterval,o=void 0===i?r.yTickInterval:i,a=t.xTickInterval,s=void 0===a?r.xTickInterval:a,l=t.min,c=void 0===l?r.min:l,u=t.max,d=void 0===u?r.max:u,f=t.xAxis,p=t.yAxis,g=t.series,v=t.tooltip,m=void 0===v?{}:v;if(!window.OffscreenCanvas)return void console.error("OffscreenCanvas is not supported in this browser");r.min=c,r.max=d,r.tooltip=m,m.style&&r.ref.setState({tooltipStyle:m.style}),r.padding=h(h({},r.padding),n);var y=r.staticCanvasRef.current,x=document.getElementById(r.id),b=x.getBoundingClientRect(),w=b.width,A=Math.floor(b.height);y.setAttribute("width",w),y.setAttribute("height",A);var S=y.transferControlToOffscreen(),I=r.canvasRef.current;I.setAttribute("width",w),I.setAttribute("height",A);var P=I.transferControlToOffscreen();if(g&&g.length>0)g.forEach(function(t){r.seriesMap.set(t.id,t),r.seriesOrder.push(t.id)});else{var k=h({},r.defaultSeriesObj);r.seriesMap.set(k.id,k),r.seriesOrder.push(k.id)}r.ref.setState({padding:r.padding,canvasWidth:w,canvasHeight:A}),r.xAxis=r.serializeFunctions(h(h({},r.xAxis),f)),r.yAxis=r.serializeFunctions(h(h({},r.yAxis),p)),r.xAxis.crosshair&&r.ref.setState({crosshairStyle:h(h({},r.ref.state.crosshairStyle),r.xAxis.crosshair)}),r.worker.postMessage({type:"init",canvas:P,staticCanvas:S,width:w,height:A,padding:n,yTickInterval:o,xTickInterval:s,min:c,max:d,xAxis:r.xAxis,yAxis:r.yAxis,series:Array.from(r.seriesMap.values())},[P,S])}),S(r,"loadXData",function(t){r.xData=t,r.cacheXData=t,r.showXminIndex=0,r.showXmaxIndex=r.cacheXData.length-1,r.worker.postMessage({type:"updateXData",xData:t})}),S(r,"clearCharts",function(){r.worker.postMessage({type:"clear"})}),S(r,"setExtremes",function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0],arguments.length>1&&void 0!==arguments[1]&&arguments[1]}),S(r,"updateYTickPositions",function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];t.length<2||(r.min=t[0],r.max=t[t.length-1],r.worker.postMessage({type:"updateYTickPositions",yTickPositions:t}))}),S(r,"handDblClick",function(t){var e=t.offsetX,n=t.offsetY;if(!(!r.xData||0===r.xData.length||e-r.padding.left<0||e>r.canvasRef.current.width-r.padding.right||n-r.padding.top<0||n>r.canvasRef.current.height-r.padding.bottom)){var i=r.findNearestDataPoint(e);if(i){var a=i.xValue,s=i.xIndex,l=[];r.seriesMap.forEach(function(t){var e=t.id,n=t.data,i=t.name,a=t.color,c=t.visible;if(n&&n.length>s){var u=o(n).slice(r.showXminIndex,r.showXmaxIndex+1)[s];l.push({id:e,name:i,color:a,visible:c,yValue:u})}}),"function"==typeof r.props.onDbClick&&r.props.onDbClick({xValue:a,index:s,points:l})}}}),S(r,"addPlotLine",function(t){var e=t.zIndex,n=void 0===e?2:e,i=t.color,o=void 0===i?"#000000":i,a=t.width,s=void 0===a?1:a,l=t.value,c=t.id;if(void 0===c)return void console.error("请传入唯一ID");if(0===r.cacheXData.length)return void console.error("请先传入X轴数据");var u=r.ref.state.plotLines.slice();u.push({zIndex:n,color:o,width:s,value:l,id:c}),r.updatePlotLine(u)}),S(r,"removePlotLine",function(t){r.ref.setState({plotLines:r.ref.state.plotLines.filter(function(e){return e.id!==t})})}),S(r,"updatePlotLine",function(t){r.promise=r.promise.then(function(){return new Promise(function(e){var n,o=[],a=i(t);try{for(a.s();!(n=a.n()).done;){var s=n.value,l=JSON.parse(JSON.stringify(s));l.left=l.value<r.showXminIndex||l.value>r.showXmaxIndex?-99999:"".concat((l.value-r.showXminIndex)/(r.showXmaxIndex-r.showXminIndex)*100,"%"),o.push(l)}}catch(t){a.e(t)}finally{a.f()}r.ref.setState({plotLines:o},function(){e()})})})}),S(r,"updateSeries",function(t){Array.isArray(t)&&(r.seriesMap.clear(),r.seriesOrder=[],t.forEach(function(t,e){var n=t.id,i=void 0===n?"series-".concat(e):n,o=t.data,a=t.color,s=t.opacity,l=void 0===s?1:s,c=t.zIndex,u=void 0===c?e:c,d=t.visible,h=void 0===d||d,f=t.name,p=void 0===f?"Series ".concat(e+1):f,g=t.lineWidth,v=void 0===g?2:g,m={id:i,data:o,color:a||r.getDefaultColor(e),opacity:l,zIndex:u,visible:h,name:p,lineWidth:v};r.seriesMap.set(i,m),r.seriesOrder.push(i)}),r.worker.postMessage({type:"loadSeriesData",seriesData:Array.from(r.seriesMap.values())}))}),S(r,"addSeries",function(t){var e=t.id,n=t.data,i=t.color,o=t.opacity,a=void 0===o?1:o,s=t.zIndex,l=t.visible,c=void 0===l||l,u=t.name,d=void 0===u?e:u,h=t.lineWidth,f=void 0===h?2:h;if(e){var p={id:e,data:n,color:i||r.getDefaultColor(r.seriesMap.size),opacity:a,zIndex:void 0!==s?s:r.seriesMap.size,visible:c,name:d,lineWidth:f};r.seriesMap.set(e,p),r.seriesOrder.push(e),r.worker.postMessage({type:"addSeries",series:p})}}),S(r,"removeSeries",function(t){r.seriesMap.delete(t),r.seriesOrder=r.seriesOrder.filter(function(e){return e!==t}),r.worker.postMessage({type:"removeSeries",id:t})}),S(r,"getNewTooltipContent",function(){var t=r.nearestPoint,e=t.xIndex,n=t.xValue,i=[],a="";return r.seriesMap.forEach(function(t){var n=t.data,a=t.name,s=t.color,l=t.visible,c=t.enableMouseTracking;if(l&&c&&n&&n.length>e){var u=o(n).slice(r.showXminIndex,r.showXmaxIndex+1)[e];"number"==typeof u&&i.push({name:a,yValue:u,color:s})}}),i.length>0&&(r.tooltip&&"function"==typeof r.tooltip.formatter?a=r.tooltip.formatter({points:i,xValue:n}):(a+="".concat(n,"<br/>"),i.forEach(function(t){a+="".concat(t.name,": ").concat(t.yValue,"<br/>")}))),a}),S(r,"updateSeriesData",function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.seriesOrder[0],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=r.seriesMap.get(e);if(i&&(i.data=t,r.seriesMap.set(e,i),r.worker.postMessage({type:"updateSeriesData",seriesDataObj:{id:e,data:t,render:n}}),r.ref.state.tooltipVisible&&r.nearestPoint)){var o=Date.now(),a=o-r.lastTooltipUpdateTime;a>=50?(r.lastTooltipUpdateTime=o,r.tooltipUpdateTimer&&(clearTimeout(r.tooltipUpdateTimer),r.tooltipUpdateTimer=null),requestAnimationFrame(function(){r.ref.setState({tooltipContent:r.getNewTooltipContent()})})):r.tooltipUpdateTimer||(r.tooltipUpdateTimer=setTimeout(function(){r.lastTooltipUpdateTime=Date.now(),clearTimeout(r.tooltipUpdateTimer),r.tooltipUpdateTimer=null,requestAnimationFrame(function(){r.ref.setState({tooltipContent:r.getNewTooltipContent()})})},50-a))}}),S(r,"setSeriesVisibility",function(t,e){var n=r.seriesMap.get(t);n&&(n.visible=e,r.seriesMap.set(t,n),r.worker.postMessage({type:"setSeriesVisibility",visibleObj:{id:t,visible:e}}))}),S(r,"setSeriesStyle",function(t,e){var n=r.seriesMap.get(t);n&&(Object.assign(n,e),r.seriesMap.set(t,n),r.worker.postMessage({type:"setSeriesStyle",id:t,style:e}))}),S(r,"getDefaultColor",function(t){var e=["#7cb5ec","#434348","#90ed7d","#f7a35c","#8085e9","#f15c80","#e4d354","#2b908f"];return e[t%e.length]}),S(r,"getIndexFromX",function(t){var e=r.canvasRef.current.width-r.padding.left-r.padding.right,n=(t-r.padding.left)/e,i=Math.round(n*(r.xData.length-1));return Math.max(0,Math.min(i,r.xData.length-1))}),S(r,"findNearestDataPoint",function(t){var e=r,n=e.xData,i=e.seriesMap;if(!n.length||!i.size)return null;var o=r.getIndexFromX(t),a=n[o],s=r.canvasRef.current.width-r.padding.left-r.padding.right,l=o/(r.xData.length-1);return{xValue:a,pixelX:r.padding.left+l*s,xIndex:o}}),S(r,"handleMouseMove",function(t){var e=t.target.getBoundingClientRect(),n=t.clientX-e.left,i=t.clientY-e.top;if(r.isDragging){var o=n;n-r.padding.left<0&&(o=r.padding.left),n>r.canvasRef.current.width-r.padding.right&&(o=r.canvasRef.current.width-r.padding.right),r.ref.setState({tempRect:h(h({},r.ref.state.tempRect),{},{end:o})})}else{if(n-r.padding.left<0||n>r.canvasRef.current.width-r.padding.right||i-r.padding.top<0||i>r.canvasRef.current.height-r.padding.bottom)return void r.handleMouseLeave();var a=r.findNearestDataPoint(n);if(a){var s=a.pixelX;r.nearestPoint=a;var l=n+10,c=i,u=r.canvasRef.current.width,d=r.canvasRef.current.height;requestAnimationFrame(function(){r.ref.setState({tooltipContent:r.getNewTooltipContent(),verticalLinePosition:s},function(){setTimeout(function(){var t=r.ref.tooltipRef.current;if(t){var e=t.getBoundingClientRect(),n=e.width,i=e.height;l+n>u&&(l=u-n-r.padding.right),c+i>d-r.padding.bottom&&(c=d-i-r.padding.bottom),c<r.padding.top&&(c=r.padding.top),r.ref.setState({tooltipPosition:{x:l,y:c},tooltipVisible:!0})}},0)})})}else r.ref.setState({tooltipVisible:!1})}}),S(r,"handleMouseLeave",function(){r.tooltipUpdateTimer&&(clearTimeout(r.tooltipUpdateTimer),r.tooltipUpdateTimer=null),r.lastTooltipUpdateTime=0,r.ref.setState({tooltipVisible:!1,tooltipPosition:{x:-999,y:-999},verticalLinePosition:-999})}),S(r,"handleMouseDown",function(t){var e=t.target.getBoundingClientRect(),n=t.clientX-e.left;n-r.padding.left<0&&(n=r.padding.left),n>r.canvasRef.current.width-r.padding.right&&(n=r.canvasRef.current.width-r.padding.right),r.isDragging=!0,r.dragStartX=n,r.ref.setState({tempRect:{start:n,end:n}})}),S(r,"handleMouseUp",function(t){if(r.isDragging){var e=t.target.getBoundingClientRect(),n=t.clientX-e.left;r.isDragging=!1,r.dragEndX=n,r.ref.setState({tempRect:null}),r.handleZoom()}}),S(r,"handleZoom",function(){var t=r,e=t.dragStartX,n=t.dragEndX;if(null!==e&&null!==n&&e!==n){if(e>n){if("function"==typeof r.props.customExtremes)return void r.props.customExtremes(0,r.cacheXData.length-1,!0);r.showXminIndex=0,r.showXmaxIndex=r.cacheXData.length-1,r.xData=o(r.cacheXData),r.worker.postMessage({type:"zoom",startIndex:r.showXminIndex,endIndex:r.showXmaxIndex})}else{var i=r.showXminIndex+r.getDataIndexFromX(e),a=r.showXminIndex+r.getDataIndexFromX(n);if(i=Math.max(0,Math.min(i,r.cacheXData.length-1)),a=Math.max(0,Math.min(a,r.cacheXData.length-1)),i===a)return;if("function"==typeof r.props.customExtremes)return void r.props.customExtremes(i,a);r.showXminIndex=i,r.showXmaxIndex=a,r.xData=r.cacheXData.slice(i,a+1),r.worker.postMessage({type:"zoom",startIndex:i,endIndex:a})}r.updateXPlotLine(r.ref.state.xplotLines),r.updateRectAndTextsPosition(),r.updateYPlotLinePosition(),r.updateSymbolsPosition(),r.updateRenderLabelsPosition(),"function"==typeof r.props.syncExtremes&&r.props.syncExtremes({min:r.showXminIndex,max:r.showXmaxIndex,type:"setExtremes"})}}),S(r,"getDataIndexFromX",function(t){var e=r.canvasRef.current.width-r.padding.left-r.padding.right,n=(t-r.padding.left)/e;return Math.round(n*(r.xData.length-1))}),S(r,"redraw",function(){r.worker.postMessage({type:"redraw"})}),S(r,"updateStyle",function(t){var e=t.xAxis,n=t.yAxis;e&&(e.crosshair&&r.ref.setState({crosshairStyle:h(h({},r.ref.state.crosshairStyle),e.crosshair)}),r.xAxis=r.deepMerge(r.xAxis,e)),n&&(r.yAxis=r.deepMerge(r.yAxis,n)),r.worker.postMessage({type:"updateChart",chartObj:{xAxis:r.xAxis,yAxis:r.yAxis}})}),S(r,"deepMerge",function(t,e){var i=h({},t);for(var o in e)if(e.hasOwnProperty(o)){var a=i[o],s=e[o];"object"!==n(a)||null===a||Array.isArray(a)||"object"!==n(s)||null===s||Array.isArray(s)?i[o]=s:i[o]=r.deepMerge(a,s)}return i}),S(r,"addXPlotLine",function(t){return void 0===t.id?void console.error("请传入唯一ID"):0===r.cacheXData.length?void console.error("请先传入X轴数据"):void(r.promise=r.promise.then(function(){return new Promise(function(e){var n=r.canvasRef.current.width-r.padding.left-r.padding.right;t.value<r.showXminIndex||t.value>r.showXmaxIndex?t.left=-99999:t.left=r.padding.left+(t.value-r.showXminIndex)/(r.showXmaxIndex-r.showXminIndex)*n,r.ref.setState({xplotLines:[].concat(o(r.ref.state.xplotLines),[t])},function(){e()})})}))}),S(r,"addXPlotLines",function(t){if(0===r.cacheXData.length)return void console.error("请先传入X轴数据");r.promise=r.promise.then(function(){return new Promise(function(e){var n=r.canvasRef.current.width-r.padding.left-r.padding.right,i=[];t.forEach(function(t){t.value<r.showXminIndex||t.value>r.showXmaxIndex?t.left=-99999:t.left=r.padding.left+(t.value-r.showXminIndex)/(r.showXmaxIndex-r.showXminIndex)*n,i.push(t)}),r.ref.setState({xplotLines:[].concat(o(r.ref.state.xplotLines),i)},function(){e()})})})}),S(r,"updateXPlotLine",function(t){r.promise=r.promise.then(function(){return new Promise(function(e){var n,o=r.canvasRef.current.width-r.padding.left-r.padding.right,a=[],s=i(t);try{for(s.s();!(n=s.n()).done;){var l=n.value,c=Object.assign({},l);c.value<r.showXminIndex||c.value>r.showXmaxIndex?c.left=-99999:c.left=r.padding.left+(c.value-r.showXminIndex)/(r.showXmaxIndex-r.showXminIndex)*o,a.push(c)}}catch(t){s.e(t)}finally{s.f()}r.ref.setState({xplotLines:a},function(){e()})})})}),S(r,"removeXPlotLines",function(t){r.promise=r.promise.then(function(){return new Promise(function(e){r.ref.setState({xplotLines:r.ref.state.xplotLines.filter(function(e){return!t.includes(e.id)})},function(){e()})})})}),S(r,"addYPlotLines",function(t){r.promise=r.promise.then(function(){return new Promise(function(e){var n=[];t.forEach(function(t){if("number"==typeof t.value){var e=r.canvasRef.current.height-r.padding.top-r.padding.bottom,i=r.canvasRef.current.width-r.padding.left-r.padding.right;if(t.width=i,t.left=r.padding.left,t.value<r.min||t.value>r.max)t.top=-99999;else if(t.top=r.padding.top+(r.max-t.value)/(r.max-r.min)*e,"number"==typeof t.from&&"number"==typeof t.to){var o=t.to,a=t.from;o>r.showXmaxIndex&&(o=r.showXmaxIndex),a<r.showXminIndex&&(a=r.showXminIndex),a>o&&(a=o),t.left=r.padding.left+(a-r.showXminIndex)/(r.showXmaxIndex-r.showXminIndex)*i,t.width=(o-a)/(r.showXmaxIndex-r.showXminIndex)*i}n.push(t)}}),r.ref.setState({yplotLines:[].concat(o(r.ref.state.yplotLines),n)},function(){e()})})})}),S(r,"removeYPlotLines",function(t){r.promise=r.promise.then(function(){return new Promise(function(e){r.ref.setState({yplotLines:r.ref.state.yplotLines.filter(function(e){return!t.includes(e.id)})},function(){e()})})})}),S(r,"updateYPlotLinePosition",function(){var t=r.canvasRef.current.height-r.padding.top-r.padding.bottom,e=r.canvasRef.current.width-r.padding.left-r.padding.right;r.ref.setState(function(n){return{yplotLines:n.yplotLines.map(function(n){if(n.width=e,n.left=r.padding.left,n.value<r.min||n.value>r.max)n.top=-99999;else if(n.top=r.padding.top+(r.max-n.value)/(r.max-r.min)*t,"number"==typeof n.from&&"number"==typeof n.to){var i=n.to,o=n.from;i>r.showXmaxIndex&&(i=r.showXmaxIndex),o<r.showXminIndex&&(o=r.showXminIndex),o>i&&(o=i),n.left=r.padding.left+(o-r.showXminIndex)/(r.showXmaxIndex-r.showXminIndex)*e,n.width=(i-o)/(r.showXmaxIndex-r.showXminIndex)*e}return n})}})}),S(r,"updateYAxis",function(t){t&&(r.yAxis=r.serializeFunctions(r.deepMerge(r.yAxis,t)),r.worker.postMessage({type:"redrawYAxis",yAxis:r.yAxis}))}),S(r,"getNewRectAndTextArr",function(t){var e=[];return t.forEach(function(t){var n=t.from,i=t.to,o=r.canvasRef.current.width-r.padding.left-r.padding.right;if("number"==typeof n&&"number"==typeof i){var a=i,s=n;a>r.showXmaxIndex&&(a=r.showXmaxIndex),s<r.showXminIndex&&(s=r.showXminIndex),t.left=r.padding.left+(s-r.showXminIndex)/(r.showXmaxIndex-r.showXminIndex)*o,t.width=(a-s)/(r.showXmaxIndex-r.showXminIndex)*o}t.width<0&&(t.width=0),t.left<r.padding.left&&(t.left=r.padding.left),e.push(t)}),e}),S(r,"addRectAndTexts",function(t){r.promise=r.promise.then(function(){return new Promise(function(e){r.ref.setState({rectAndTexts:[].concat(o(r.ref.state.rectAndTexts),o(r.getNewRectAndTextArr(t)))},function(){e()})})})}),S(r,"updateRectAndTextsPosition",function(){r.promise=r.promise.then(function(){return new Promise(function(t){r.ref.setState({rectAndTexts:r.getNewRectAndTextArr(r.ref.state.rectAndTexts)},function(){t()})})})}),S(r,"removeRectAndTexts",function(t){r.promise=r.promise.then(function(){return new Promise(function(e){r.ref.setState({rectAndTexts:r.ref.state.rectAndTexts.filter(function(e){return!t.includes(e.id)})},function(){e()})})})}),S(r,"getNewSymbolArr",function(t){var e=[];return t.forEach(function(t){var n=r.canvasRef.current.height-r.padding.top-r.padding.bottom,i=r.canvasRef.current.width-r.padding.left-r.padding.right;t.xValue<r.showXminIndex||t.xValue>r.showXmaxIndex?t.left=-99999:t.left=r.padding.left+(t.xValue-r.showXminIndex)/(r.showXmaxIndex-r.showXminIndex)*i,t.yValue<r.min||t.yValue>r.max?t.top=-99999:t.top=r.padding.top+(r.max-t.yValue)/(r.max-r.min)*n,e.push(t)}),e}),S(r,"addSymbols",function(t){r.promise=r.promise.then(function(){return new Promise(function(e){r.ref.setState({symbols:[].concat(o(r.ref.state.symbols),o(r.getNewSymbolArr(t)))},function(){e()})})})}),S(r,"updateSymbolsPosition",function(){r.promise=r.promise.then(function(){return new Promise(function(t){r.ref.setState({symbols:r.getNewSymbolArr(r.ref.state.symbols)},function(){t()})})})}),S(r,"removeSymbols",function(t){r.promise=r.promise.then(function(){return new Promise(function(e){r.ref.setState({symbols:r.ref.state.symbols.filter(function(e){return!t.includes(e.id)})},function(){e()})})})}),S(r,"addRenderLabels",function(t){r.promise=r.promise.then(function(){return new Promise(function(e){r.ref.setState({renderLabels:[].concat(o(r.ref.state.renderLabels),o(r.getNewSymbolArr(t)))},function(){e()})})})}),S(r,"updateRenderLabelsPosition",function(){r.promise=r.promise.then(function(){return new Promise(function(t){r.ref.setState({renderLabels:r.getNewSymbolArr(r.ref.state.renderLabels)},function(){t()})})})}),S(r,"removeRenderLabels",function(t){r.promise=r.promise.then(function(){return new Promise(function(e){r.ref.setState({renderLabels:r.ref.state.renderLabels.filter(function(e){return!t.includes(e.id)})},function(){e()})})})}),r.state={},r.staticCanvasRef=R.a.createRef(),r.canvasRef=R.a.createRef(),r.worker=null,r.id=t.id||"spectrum",r.padding={top:30,right:30,bottom:40,left:40},r.min=0,r.max=100,r.yTickInterval=5,r.xTickInterval=10,r.xAxis={crosshair:{background:"rgba(255,255,255,0.65)",width:2,zIndex:1e4},gridLineColor:"rgba(255, 255, 255, 0.16)",gridLineWidth:1,labels:{fontFamily:"SourceHanSansCN-Regular",fontSize:"12px",color:"rgba(228,231,232,0.64)"}},r.yAxis={gridLineColor:"rgba(255, 255, 255, 0.16)",gridLineWidth:1,labels:{fontFamily:"SourceHanSansCN-Regular",fontSize:"12px",color:"rgba(228,231,232,0.64)"}},r.seriesMap=new Map,r.defaultSeriesObj={id:"series-1",data:[],color:"#C5C501",opacity:1,zIndex:1,visible:!0,name:"Series1",lineWidth:2},r.seriesOrder=[],r.tooltip={},r.cacheXData=[],r.xData=[],r.lastTooltipUpdateTime=0,r}return w(e,t),g(e,[{key:"componentDidMount",value:function(){this.promise=Promise.resolve(),this.worker=new E.a,this.worker.onmessage=function(t){var e=t.data,r=e.type;e.payload,"finish"===r&&console.log("finish---------")},this.props.onRef&&this.props.onRef(this);var t=this.canvasRef.current;t.addEventListener("mousedown",this.handleMouseDown),t.addEventListener("mousemove",this.handleMouseMove),t.addEventListener("mouseleave",this.handleMouseLeave),document.addEventListener("mouseup",this.handleMouseUp),t.addEventListener("dblclick",this.handDblClick),window.addEventListener("resize",this.reflow)}},{key:"shouldComponentUpdate",value:function(t,e){return!1}},{key:"destroy",value:function(){var t=this.canvasRef.current;t.removeEventListener("mousedown",this.handleMouseDown),t.removeEventListener("mousemove",this.handleMouseMove),t.removeEventListener("mouseleave",this.handleMouseLeave),document.removeEventListener("mouseup",this.handleMouseUp),t.removeEventListener("dblclick",this.handDblClick),window.removeEventListener("resize",this.reflow),this.seriesMap.clear(),this.seriesOrder.length=0,this.cacheXData.length=0,this.xData.length=0,this.worker&&(this.worker.postMessage({type:"destroy"}),this.worker.terminate(),this.worker=null),this.tooltipUpdateTimer&&(clearTimeout(this.tooltipUpdateTimer),this.tooltipUpdateTimer=null)}},{key:"componentWillUnmount",value:function(){this.destroy()}},{key:"serializeFunctions",value:function(t){var e=Array.isArray(t)?[]:{};for(var r in t)if(t.hasOwnProperty(r)){var i=t[r];"function"==typeof i?e[r]=i.toString():Array.isArray(i)?e[r]=this.serializeFunctions(i):"object"===n(i)&&null!==i?e[r]=this.serializeFunctions(i):e[r]=i}return e}},{key:"loadData",value:function(t){this.worker}},{key:"render",value:function(){return R.a.createElement("div",{id:this.id,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"}},R.a.createElement("canvas",{ref:this.staticCanvasRef,style:{position:"absolute",top:0,left:0,zIndex:1,pointerEvents:"none"}}),R.a.createElement("canvas",{ref:this.canvasRef,style:{position:"absolute",top:0,left:0,zIndex:2}}),R.a.createElement(L.a,{onRef:this.onToolRef}))}}])}(R.a.Component);e.a=M},function(t,e,r){t.exports=function(){return r(5)('!function(t){function r(i){if(e[i])return e[i].exports;var n=e[i]={i:i,l:!1,exports:{}};return t[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}var e={};r.m=t,r.c=e,r.d=function(t,e,i){r.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:i})},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},r.p="",r(r.s=0)}([function(t,r){function e(t){"@babel/helpers - typeof";return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t){return s(t)||o(t)||a(t)||n()}function n(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function a(t,r){if(t){if("string"==typeof t)return h(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?h(t,r):void 0}}function o(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function s(t){if(Array.isArray(t))return h(t)}function h(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,i=Array(r);e<r;e++)i[e]=t[e];return i}function l(){"use strict";function t(t,r,e,i){return Object.defineProperty(t,r,{value:e,enumerable:!i,configurable:!i,writable:!i})}function r(r,e,a,o){var s=e&&e.prototype instanceof n?e:n,h=Object.create(s.prototype);return t(h,"_invoke",function(t,r,e){var n=1;return function(a,o){if(3===n)throw Error("Generator is already running");if(4===n){if("throw"===a)throw o;return{value:v,done:!0}}for(e.method=a,e.arg=o;;){var s=e.delegate;if(s){var h=u(s,e);if(h){if(h===_)continue;return h}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if(1===n)throw n=4,e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n=3;var l=i(t,r,e);if("normal"===l.type){if(n=e.done?4:2,l.arg===_)continue;return{value:l.arg,done:e.done}}"throw"===l.type&&(n=4,e.method="throw",e.arg=l.arg)}}}(r,a,new f(o||[])),!0),h}function i(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}function n(){}function a(){}function o(){}function s(r){["next","throw","return"].forEach(function(e){t(r,e,function(t){return this._invoke(e,t)})})}function h(r,n){function a(t,o,s,h){var l=i(r[t],r,o);if("throw"!==l.type){var u=l.arg,c=u.value;return c&&"object"==e(c)&&m.call(c,"__await")?n.resolve(c.__await).then(function(t){a("next",t,s,h)},function(t){a("throw",t,s,h)}):n.resolve(c).then(function(t){u.value=t,s(u)},function(t){return a("throw",t,s,h)})}h(l.arg)}var o;t(this,"_invoke",function(t,r){function e(){return new n(function(e,i){a(t,r,e,i)})}return o=o?o.then(e,e):e()},!0)}function u(t,r){var e=r.method,n=t.i[e];if(n===v)return r.delegate=null,"throw"===e&&t.i.return&&(r.method="return",r.arg=v,u(t,r),"throw"===r.method)||"return"!==e&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a \'"+e+"\' method")),_;var a=i(n,t.i,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,_;var o=a.arg;return o?o.done?(r[t.r]=o.value,r.next=t.n,"return"!==r.method&&(r.method="next",r.arg=v),r.delegate=null,_):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,_)}function c(t){this.tryEntries.push(t)}function d(t){var r=t[4]||{};r.type="normal",r.arg=v,t[4]=r}function f(t){this.tryEntries=[[-1]],t.forEach(c,this),this.reset(!0)}function g(t){if(null!=t){var r=t[b];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,n=function r(){for(;++i<t.length;)if(m.call(t,i))return r.value=t[i],r.done=!1,r;return r.value=v,r.done=!0,r};return n.next=n}}throw new TypeError(e(t)+" is not iterable")}/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */l=function(){return p};var v,p={},y=Object.prototype,m=y.hasOwnProperty,x="function"==typeof Symbol?Symbol:{},b=x.iterator||"@@iterator",A=x.asyncIterator||"@@asyncIterator",w=x.toStringTag||"@@toStringTag";try{t({},"")}catch(v){t=function(t,r,e){return t[r]=e}}p.wrap=r;var _={},k={};t(k,b,function(){return this});var S=Object.getPrototypeOf,C=S&&S(S(g([])));C&&C!==y&&m.call(C,b)&&(k=C);var P=o.prototype=n.prototype=Object.create(k);return a.prototype=o,t(P,"constructor",o),t(o,"constructor",a),a.displayName=t(o,w,"GeneratorFunction"),p.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===a||"GeneratorFunction"===(r.displayName||r.name))},p.mark=function(r){return Object.setPrototypeOf?Object.setPrototypeOf(r,o):(r.__proto__=o,t(r,w,"GeneratorFunction")),r.prototype=Object.create(P),r},p.awrap=function(t){return{__await:t}},s(h.prototype),t(h.prototype,A,function(){return this}),p.AsyncIterator=h,p.async=function(t,e,i,n,a){void 0===a&&(a=Promise);var o=new h(r(t,e,i,n),a);return p.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},s(P),t(P,w,"Generator"),t(P,b,function(){return this}),t(P,"toString",function(){return"[object Generator]"}),p.keys=function(t){var r=Object(t),e=[];for(var i in r)e.unshift(i);return function t(){for(;e.length;)if((i=e.pop())in r)return t.value=i,t.done=!1,t;return t.done=!0,t}},p.values=g,f.prototype={constructor:f,reset:function(t){if(this.prev=this.next=0,this.sent=this._sent=v,this.done=!1,this.delegate=null,this.method="next",this.arg=v,this.tryEntries.forEach(d),!t)for(var r in this)"t"===r.charAt(0)&&m.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=v)},stop:function(){this.done=!0;var t=this.tryEntries[0][4];if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){function r(r){a.type="throw",a.arg=t,e.next=r}if(this.done)throw t;for(var e=this,i=e.tryEntries.length-1;i>=0;--i){var n=this.tryEntries[i],a=n[4],o=this.prev,s=n[1],h=n[2];if(-1===n[0])return r("end"),!1;if(!s&&!h)throw Error("try statement without catch or finally");if(null!=n[0]&&n[0]<=o){if(o<s)return this.method="next",this.arg=v,r(s),!0;if(o<h)return r(h),!1}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var i=this.tryEntries[e];if(i[0]>-1&&i[0]<=this.prev&&this.prev<i[2]){var n=i;break}}n&&("break"===t||"continue"===t)&&n[0]<=r&&r<=n[2]&&(n=null);var a=n?n[4]:{};return a.type=t,a.arg=r,n?(this.method="next",this.next=n[2],_):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),_},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e[2]===t)return this.complete(e[4],e[3]),d(e),_}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e[0]===t){var i=e[4];if("throw"===i.type){var n=i.arg;d(e)}return n}}throw Error("illegal catch attempt")},delegateYield:function(t,r,e){return this.delegate={i:g(t),r:r,n:e},"next"===this.method&&(this.arg=v),_}},p}function u(t,r,e,i,n,a,o){try{var s=t[a](o),h=s.value}catch(t){return void e(t)}s.done?r(h):Promise.resolve(h).then(i,n)}function c(t){return function(){var r=this,e=arguments;return new Promise(function(i,n){function a(t){u(s,i,n,a,o,"next",t)}function o(t){u(s,i,n,a,o,"throw",t)}var s=t.apply(r,e);a(void 0)})}}function d(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function f(t,r){for(var e=0;e<r.length;e++){var i=r[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,v(i.key),i)}}function g(t,r,e){return r&&f(t.prototype,r),e&&f(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function v(t){var r=p(t,"string");return"symbol"==e(r)?r:r+""}function p(t,r){if("object"!=e(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,r||"default");if("object"!=e(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}var y=function(){function t(){d(this,t),this.gl=null,this.program=null,this.width=0,this.height=0,this.padding={top:0,right:0,bottom:0,left:0},this.series=new Map,this.seriesOrder=[],this.dataBuffers=new Map,this.colorBuffers=new Map,this.vertexCounts=new Map,this.xData=null,this.min=0,this.max=0,this.uniforms={},this.gridProgram=null,this.gridBuffer=null,this.gridIndicesBuffer=null,this.bgCtx=null,this.projectionMatrix=new Float32Array(16),this.setIdentityMatrix(this.projectionMatrix)}return g(t,[{key:"setIdentityMatrix",value:function(t){for(var r=0;r<16;r++)t[r]=0;t[0]=1,t[5]=1,t[10]=1,t[15]=1}},{key:"init",value:function(){function t(t,e,i,n,a,o,s,h,l,u,c,d){return r.apply(this,arguments)}var r=c(l().mark(function t(r,e,i,n,a,o,s,h,u,c,d,f){var g,v,p,y,m;return l().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(g=r.getContext("webgl2")||r.getContext("webgl")||r.getContext("experimental-webgl")){t.next=3;break}throw new Error("WebGL not supported");case 3:if(this.gl=g,this.isWebGL2=g instanceof WebGL2RenderingContext,this.width=i,this.height=n,this.padding=a,this.min=h,this.max=u,this.xAxis=c,this.yAxis=d,this.yTickInterval=o,this.xTickInterval=s,r.width=i,r.height=n,this.bgCtx=e.getContext("2d"),this.drawXGridAndLabels(),this.drawYGridAndLabels(),f&&Array.isArray(f))for(v=0;v<f.length;v++){p=f[v],y={id:p.id||"series_"+Math.random().toString(36).substr(2,9),name:p.name||"",color:p.color||"#0000ff",lineWidth:p.lineWidth||2,opacity:void 0!==p.opacity?p.opacity:1,visible:void 0===p.visible||p.visible,showPoints:p.showPoints||!1,data:p.data||[]};for(m in p)p.hasOwnProperty(m)&&(y[m]=p[m]);this.series.set(y.id,y),this.seriesOrder.push(y.id),y.data&&y.data.length>0&&this.createSeriesBuffer(y.id,y.data)}this.initShaders(),g.viewport(0,0,i,n),g.clearColor(0,0,0,0),g.clear(g.COLOR_BUFFER_BIT),g.enable(g.BLEND),g.blendFunc(g.SRC_ALPHA,g.ONE_MINUS_SRC_ALPHA),this.setOrthographic(0,i,n,0,-1,1),this.render(),self.postMessage({type:"initComplete"});case 29:case"end":return t.stop()}},t,this)}));return t}()},{key:"setOrthographic",value:function(t,r,e,i,n,a){var o=r-t,s=i-e,h=a-n;this.projectionMatrix[0]=2/o,this.projectionMatrix[5]=2/s,this.projectionMatrix[10]=-2/h,this.projectionMatrix[12]=-(t+r)/o,this.projectionMatrix[13]=-(i+e)/s,this.projectionMatrix[14]=-(a+n)/h}},{key:"initShaders",value:function(){var t,r,e=this.gl,i=this.isWebGL2;if(i?(t="#version 300 es\\nprecision highp float;\\n\\nin vec2 a_position;\\nin vec4 a_color;\\nout vec4 v_color;\\n\\nuniform mat4 u_projectionMatrix;\\n\\nvoid main() {\\n gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0);\\n v_color = a_color;\\n gl_PointSize = 4.0;\\n}",r="#version 300 es\\nprecision highp float;\\n\\nin vec4 v_color;\\nout vec4 outColor;\\n\\nvoid main() {\\n outColor = v_color;\\n}"):(t="attribute vec2 a_position;\\nattribute vec4 a_color;\\nvarying vec4 v_color;\\n\\nuniform mat4 u_projectionMatrix;\\n\\nvoid main() {\\n gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0);\\n v_color = a_color;\\n gl_PointSize = 4.0;\\n}",r="precision mediump float;\\n\\nvarying vec4 v_color;\\n\\nvoid main() {\\n gl_FragColor = v_color;\\n}"),this.program=this.createProgram(t,r),!this.program)throw new Error("Failed to create line shader program");this.uniforms={projectionMatrix:e.getUniformLocation(this.program,"u_projectionMatrix")};var n,a;i?(n="#version 300 es\\nprecision highp float;\\n\\nin vec2 a_position;\\nuniform mat4 u_projectionMatrix;\\nuniform vec4 u_color;\\n\\nvoid main() {\\n gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0);\\n}",a="#version 300 es\\nprecision highp float;\\n\\nuniform vec4 u_color;\\nout vec4 outColor;\\n\\nvoid main() {\\n outColor = u_color;\\n}"):(n="attribute vec2 a_position;\\nuniform mat4 u_projectionMatrix;\\n\\nvoid main() {\\n gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0);\\n}",a="precision mediump float;\\n\\nuniform vec4 u_color;\\n\\nvoid main() {\\n gl_FragColor = u_color;\\n}"),this.gridProgram=this.createProgram(n,a),this.gridProgram&&(this.gridUniforms={projectionMatrix:e.getUniformLocation(this.gridProgram,"u_projectionMatrix"),color:e.getUniformLocation(this.gridProgram,"u_color")})}},{key:"createProgram",value:function(t,r){var e=this.gl,i=this.compileShader(e.VERTEX_SHADER,t),n=this.compileShader(e.FRAGMENT_SHADER,r);if(!i||!n)return console.error("Failed to compile shaders"),null;var a=e.createProgram();return e.attachShader(a,i),e.attachShader(a,n),e.linkProgram(a),e.getProgramParameter(a,e.LINK_STATUS)?a:(console.error("Program link failed:",e.getProgramInfoLog(a)),e.deleteProgram(a),null)}},{key:"compileShader",value:function(t,r){var e=this.gl,i=e.createShader(t);return e.shaderSource(i,r),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS)?i:(console.error("Shader compile failed:",e.getShaderInfoLog(i)),e.deleteShader(i),null)}},{key:"drawYGridAndLabels",value:function(t){var r=[];if(t)r=t;else{for(var e=Math.round((this.max-this.min)/this.yTickInterval),i=0;i<this.yTickInterval;i++)r.push(this.min+i*e);r.push(this.max)}this.bgCtx.strokeStyle=this.yAxis.gridLineColor,this.bgCtx.lineWidth=this.yAxis.gridLineWidth;for(var n=0;n<=this.yTickInterval;n++){var a=this.height-this.padding.bottom-n/this.yTickInterval*(this.height-this.padding.top-this.padding.bottom);this.bgCtx.beginPath(),this.bgCtx.moveTo(this.padding.left,a),this.bgCtx.lineTo(this.width-this.padding.right,a),this.bgCtx.stroke()}this.bgCtx.fillStyle=this.yAxis.labels.color,this.bgCtx.font=this.yAxis.labels.fontSize+" "+this.yAxis.labels.fontFamily,this.bgCtx.textAlign="right";for(var o=0;o<=this.yTickInterval;o++){var s=this.height-this.padding.bottom-o/this.yTickInterval*(this.height-this.padding.top-this.padding.bottom);this.bgCtx.fillText(void 0!==this.yAxis.labels.formatter?new Function("return "+this.yAxis.labels.formatter)().apply(null,[r[o]].concat(this.yAxis.labels.params||[])):r[o],this.padding.left-8,s+4)}}},{key:"drawXGridAndLabels",value:function(){var t=this.bgCtx,r=this.width,e=this.height,i=this.padding,n=this.xData,a=this.xAxis,o=this.xTickInterval;if(n){var s=this.tickPositioner(),h=s.length,l=s[h-1]-s[0];t.strokeStyle=this.xAxis.gridLineColor,t.lineWidth=this.xAxis.gridLineWidth;for(var u=0;u<h;u++){var c=i.left+(s[u]-s[0])/l*(r-i.left-i.right);t.beginPath(),t.moveTo(c,i.top),t.lineTo(c,e-i.bottom),t.stroke()}this.bgCtx.fillStyle=this.xAxis.labels.color,this.bgCtx.font=this.xAxis.labels.fontSize+" "+this.xAxis.labels.fontFamily,this.bgCtx.textAlign="center";for(var d=0;d<h;d++){var f=i.left+(s[d]-s[0])/l*(r-i.left-i.right);t.fillText(void 0!==this.xAxis.labels.formatter?new Function("return "+this.xAxis.labels.formatter)()(this.xData[s[d]]):this.xData[s[d]],f,e-i.bottom+20)}}else{t.strokeStyle=a.gridLineColor,t.lineWidth=a.gridLineWidth;for(var g=0;g<=o;g++){var v=i.left+g/o*(r-i.left-i.right);t.beginPath(),t.moveTo(v,i.top),t.lineTo(v,e-i.bottom),t.stroke()}}}},{key:"tickPositioner",value:function(){if("function"==typeof this.xAxis.tickPositioner)return this.xAxis.tickPositioner(0,this.xData.length-1);if(!this.xData)return[0,1];var t=this.xData.length-1,r=this.xTickInterval;t-0<r&&(r=t-0);var e=Math.ceil((t-0)/r),i=[];i.push(0);for(var n=1;n<r;n++)i.push(Math.round(0+n*e));return i.push(t),i.filter(function(r){return r<=t})}},{key:"hexToRgba",value:function(t,r){if(void 0===r&&(r=1),!t)return[0,0,0,r];if(t=t.replace(/^#/,""),3===t.length){var e=parseInt(t.charAt(0)+t.charAt(0),16)/255,i=parseInt(t.charAt(1)+t.charAt(1),16)/255,n=parseInt(t.charAt(2)+t.charAt(2),16)/255;return[e,i,n,r]}if(6===t.length){var e=parseInt(t.substr(0,2),16)/255,i=parseInt(t.substr(2,2),16)/255,n=parseInt(t.substr(4,2),16)/255;return[e,i,n,r]}return[0,0,0,r]}},{key:"preprocessData",value:function(t){for(var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],e=[],i=null,n=0;n<t.length;n++)null!==t[n]?(e.push({index:n,value:t[n]}),i={index:n,value:t[n]}):r||null===i||e.push(null);return e}},{key:"createSeriesBuffer",value:function(t,r){var e=this.series.get(t);if(e){if(!r||0===r.length)return e.data=[],this.series.set(t,e),void(this.gl&&this.gl.clear(this.gl.COLOR_BUFFER_BIT));for(var n=this.preprocessData(i(r).slice(this.startIndex,this.endIndex+1),!!e.connectNulls),a=this.gl,o=(this.width-this.padding.left-this.padding.right)/Math.max(1,this.xData?this.xData.length-1:n.length-1),s=(this.height-this.padding.top-this.padding.bottom)/Math.max(1e-4,this.max-this.min),h=this.hexToRgba(e.color,e.opacity||1),l=[],u=[],c=0;c<n.length;c++)if(null!==n[c]){var d=this.padding.left+n[c].index*o,f=this.height-this.padding.bottom-(n[c].value-this.min)*s;l.push(d,f),u.push(h[0],h[1],h[2],h[3])}var g=this.dataBuffers.get(t);g||(g=a.createBuffer()),a.bindBuffer(a.ARRAY_BUFFER,g),a.bufferData(a.ARRAY_BUFFER,new Float32Array(l),a.DYNAMIC_DRAW);var v=this.colorBuffers.get(t);v||(v=a.createBuffer()),a.bindBuffer(a.ARRAY_BUFFER,v),a.bufferData(a.ARRAY_BUFFER,new Float32Array(u),a.STATIC_DRAW),this.dataBuffers.set(t,g),this.colorBuffers.set(t,v),this.vertexCounts.set(t,l.length/2),e.data=r,this.series.set(t,e)}}},{key:"render",value:function(){var t=this.gl;if(t&&this.program){if(t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),this.gridProgram&&this.gridBuffer){t.useProgram(this.gridProgram);var r=this.gridUniforms.projectionMatrix;r&&t.uniformMatrix4fv(r,!1,this.projectionMatrix);var e=this.yAxis&&this.yAxis.gridLineColor?this.yAxis.gridLineColor:"#e0e0e0",i=this.hexToRgba(e,.5),n=this.gridUniforms.color;n&&t.uniform4f(n,i[0],i[1],i[2],i[3]);var a=t.getAttribLocation(this.gridProgram,"a_position");if(a>=0){t.enableVertexAttribArray(a),t.bindBuffer(t.ARRAY_BUFFER,this.gridBuffer),t.vertexAttribPointer(a,2,t.FLOAT,!1,0,0),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.gridIndicesBuffer);var o=this.yAxis&&this.yAxis.gridLineWidth?this.yAxis.gridLineWidth:1;t.lineWidth(o),t.drawElements(t.LINES,this.gridVertexCount,t.UNSIGNED_SHORT,0),t.disableVertexAttribArray(a)}}t.useProgram(this.program),this.uniforms.projectionMatrix&&t.uniformMatrix4fv(this.uniforms.projectionMatrix,!1,this.projectionMatrix);for(var s=0;s<this.seriesOrder.length;s++){var h=this.seriesOrder[s],l=this.series.get(h);l&&l.visible&&l.data&&0!==l.data.length&&this.drawSeries(h)}}}},{key:"drawSeries",value:function(t){var r=this.series.get(t);if(r){var e=this.gl,n=this.dataBuffers.get(t),a=this.colorBuffers.get(t),o=this.vertexCounts.get(t);if(n&&a&&o&&!(o<2)){var s=e.getAttribLocation(this.program,"a_position"),h=e.getAttribLocation(this.program,"a_color");if(!(s<0||h<0)){e.enableVertexAttribArray(s),e.bindBuffer(e.ARRAY_BUFFER,n),e.vertexAttribPointer(s,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(h),e.bindBuffer(e.ARRAY_BUFFER,a),e.vertexAttribPointer(h,4,e.FLOAT,!1,0,0),e.enable(e.SCISSOR_TEST),e.scissor(this.padding.left,this.padding.bottom,this.width-this.padding.left-this.padding.right,this.height-this.padding.top-this.padding.bottom);var l=r.lineWidth||2;try{e.lineWidth(l)}catch(t){console.warn("Line width not supported:",t)}for(var u=this.preprocessData(i(r.data).slice(this.startIndex,this.endIndex+1),!!r.connectNulls),c=0,d=0,f=0;f<u.length;f++)if(null===u[f]){if(f>d){var g=c-d;g>=2&&e.drawArrays(e.LINE_STRIP,d,g)}d=c}else c++;if(d<c){var v=c-d;v>=2&&e.drawArrays(e.LINE_STRIP,d,v)}r.showPoints&&e.drawArrays(e.POINTS,0,o),e.disableVertexAttribArray(s),e.disableVertexAttribArray(h)}}}}},{key:"clearBgCanvas",value:function(){this.bgCtx.clearRect(0,0,this.width,this.height)}},{key:"updateXData",value:function(t){this.xData=t,this.cacheXData=t,this.startIndex=0,this.endIndex=t.length-1,this.redrawData()}},{key:"redrawData",value:function(){this.clearBgCanvas(),this.drawXGridAndLabels(),this.drawYGridAndLabels();for(var t=Array.from(this.series.keys()),r=0;r<t.length;r++){var e=t[r],i=this.series.get(e);i&&i.data&&i.data.length>0&&this.createSeriesBuffer(e,i.data)}this.render()}},{key:"updateSingleSeries",value:function(t,r){var e=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.series.get(t))return void console.log("系列不存在:",t);this.createSeriesBuffer(t,r),e&&this.render()}},{key:"resize",value:function(t,r){if(this.gl){this.width=t,this.height=r,this.gl.canvas.width=t,this.gl.canvas.height=r,this.bgCtx&&(this.bgCtx.canvas.width=t,this.bgCtx.canvas.height=r),this.setOrthographic(0,t,r,0,-1,1),this.gl.viewport(0,0,t,r);for(var e=Array.from(this.series.keys()),i=0;i<e.length;i++){var n=e[i],a=this.series.get(n);a&&a.data&&a.data.length>0&&this.createSeriesBuffer(n,a.data)}this.drawXGridAndLabels(),this.drawYGridAndLabels(),this.render()}}},{key:"clear",value:function(){this.gl&&this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.bgCtx&&this.bgCtx.clearRect(0,0,this.width,this.height)}},{key:"handleZoom",value:function(t,r){this.startIndex=t,this.endIndex=r,this.xData=this.cacheXData.slice(t,r+1),this.redrawData()}},{key:"updateYTickPositions",value:function(t){this.min=t[0],this.max=t[t.length-1],this.yTickInterval=t.length-1,this.redrawData()}},{key:"setSeriesVisibility",value:function(t,r){var e=this.series.get(t);if(!e)return void console.log("系列不存在:",t);e.visible=r,this.series.set(t,e),this.render()}},{key:"updateChart",value:function(t){var r=t.xAxis,e=t.yAxis;this.clearBgCanvas(),this.xAxis=r,this.yAxis=e,this.drawXGridAndLabels(),this.drawYGridAndLabels()}},{key:"redrawYAxis",value:function(t){this.clearBgCanvas(),this.yAxis=t,this.drawXGridAndLabels(),this.drawYGridAndLabels()}},{key:"destroy",value:function(){var t=this;this.program&&(this.gl.deleteProgram(this.program),this.program=null),this.gridProgram&&(this.gl.deleteProgram(this.gridProgram),this.gridProgram=null),this.dataBuffers.forEach(function(r){r&&t.gl.deleteBuffer(r)}),this.dataBuffers.clear(),this.colorBuffers.forEach(function(r){r&&t.gl.deleteBuffer(r)}),this.gl&&(this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.gl=null),this.colorBuffers.clear(),this.vertexCounts.clear(),this.series.clear(),this.seriesOrder=[],this.bgCtx&&(this.bgCtx.clearRect(0,0,this.width,this.height),this.bgCtx=null)}}])}(),m=new y;self.onmessage=function(t){var r=t.data;if("object"!==e(r)||null===r)throw new Error("Invalid input: data must be a non-null object");var i=r.type,n=void 0===i?"":i,a=r.canvas,o=void 0===a?null:a,s=r.staticCanvas,h=void 0===s?null:s,l=r.width,u=void 0===l?0:l,c=r.height,d=void 0===c?0:c,f=r.padding,g=r.yTickInterval,v=void 0===g?1:g,p=r.xTickInterval,y=void 0===p?1:p,x=r.min,b=void 0===x?0:x,A=r.max,w=void 0===A?100:A,_=r.xAxis,k=void 0===_?{}:_,S=r.yAxis,C=void 0===S?{}:S,P=r.xData,E=void 0===P?[]:P,I=r.series,T=void 0===I?[]:I,B=r.seriesDataObj,R=void 0===B?{}:B,L=r.startIndex,j=r.endIndex,O=r.yTickPositions,M=r.visibleObj,F=r.chartObj,D=void 0===F?{}:F;try{switch(n){case"init":m.init(o,h,u,d,f,v,y,b,w,k,C,T);break;case"updateXData":void 0!==E&&m.updateXData(E);break;case"updateSeriesData":R&&R.id&&R.data&&m.updateSingleSeries(R.id,R.data,R.render);break;case"resize":u&&d&&m.resize(u,d);break;case"render":m.render();break;case"clear":m.clear();break;case"zoom":m.handleZoom(L,j);break;case"updateSeriesConfig":if(R&&R.id){var G=m.series.get(R.id);if(G){for(var U in R)R.hasOwnProperty(U)&&(G[U]=R[U]);m.series.set(R.id,G),G.data&&G.data.length>0&&(m.createSeriesBuffer(R.id,G.data),m.render())}}break;case"updateYTickPositions":m.updateYTickPositions(O);break;case"setSeriesVisibility":m.setSeriesVisibility(M.id,M.visible);break;case"redraw":m.render();break;case"updateChart":m.updateChart(D);break;case"redrawYAxis":m.redrawYAxis(C);break;case"destroy":m.destroy(),self.close()}}catch(t){console.error("WebGLChartRenderer error:",t),self.postMessage({type:"error",payload:{message:t.message,stack:t.stack,type:n}})}}}]);',null)}},function(t,e,r){"use strict";var n=window.URL||window.webkitURL;t.exports=function(t,e){try{try{var r;try{var i=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder;r=new i,r.append(t),r=r.getBlob()}catch(e){r=new Blob([t])}return new Worker(n.createObjectURL(r))}catch(e){return new Worker("data:application/javascript,"+encodeURIComponent(t))}}catch(t){if(!e)throw Error("Inline worker is not supported");return new Worker(e)}}},function(t,e,r){"use strict";function n(t){"@babel/helpers - typeof";return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function o(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?i(Object(r),!0).forEach(function(e){a(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function a(t,e,r){return(e=u(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,u(n.key),n)}}function c(t,e,r){return e&&l(t.prototype,e),r&&l(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function u(t){var e=d(t,"string");return"symbol"==n(e)?e:e+""}function d(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e||"default");if("object"!=n(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}function h(t,e,r){return e=v(e),f(t,g()?Reflect.construct(e,r||[],v(t).constructor):e.apply(t,r))}function f(t,e){if(e&&("object"==n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return p(t)}function p(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function g(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(g=function(){return!!t})()}function v(t){return(v=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function m(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&y(t,e)}function y(t,e){return(y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}var x=r(0),b=r.n(x),w=function(t){function e(t){var r;return s(this,e),r=h(this,e,[t]),r.state={plotLines:[],tooltipVisible:!1,tooltipContent:"",tooltipPosition:{x:-999,y:-999},verticalLinePosition:-999,tooltipStyle:{},crosshairStyle:{},xplotLines:[],yplotLines:[],rectAndTexts:[],symbols:[],renderLabels:[]},r.tooltipRef=b.a.createRef(),r}return m(e,t),c(e,[{key:"componentDidMount",value:function(){this.props.onRef&&this.props.onRef(this)}},{key:"componentWillUnmount",value:function(){}},{key:"render",value:function(){var t=this.state,e=t.plotLines,r=t.tooltipVisible,n=t.tooltipContent,i=t.tooltipPosition,a=t.tempRect,s=t.verticalLinePosition,l=t.tooltipStyle,c=t.crosshairStyle,u=t.xplotLines,d=t.padding,h=t.canvasHeight,f=t.canvasWidth,p=t.yplotLines,g=t.rectAndTexts,v=t.symbols,m=t.renderLabels;return b.a.createElement(b.a.Fragment,null,e.map(function(t){return b.a.createElement("div",{key:t.id,style:{position:"absolute",top:0,pointerEvents:"none",height:"100%",left:t.left,width:t.width,zIndex:t.zIndex,backgroundColor:t.color}})}),u.map(function(t){var e=t.removeEnable,r=!!t.label,n=e?{}:{pointerEvents:"none"};return b.a.createElement(b.a.Fragment,{key:t.id},b.a.createElement("div",{key:"".concat(t.id,"_plotLine"),style:o({position:"absolute",top:d.top,height:"calc(100% - ".concat(d.top,"px - ").concat(d.bottom,"px)"),left:parseFloat(t.left)-t.width/2,width:t.width,zIndex:t.zIndex,backgroundColor:t.color,cursor:e?"move":"none"},n),onMouseDown:e?function(e){return t.xPlotLineMouseDown(t.id,e)}:function(){}}),r&&b.a.createElement("span",{key:"".concat(t.id,"_text"),style:o({position:"absolute",bottom:9,left:parseFloat(t.left)+t.label.x,whiteSpace:"nowrap",zIndex:t.zIndex},t.label.style)},t.label.text))}),p.map(function(t){var e=t.removeEnable,r=!!t.label;return b.a.createElement(b.a.Fragment,{key:t.id},b.a.createElement("div",{key:"".concat(t.id,"_yplotLine"),style:{position:"absolute",top:t.top,height:t.height,left:t.left,width:t.width,zIndex:t.zIndex,backgroundColor:t.color,cursor:e?"move":"none"},onMouseDown:e?function(e){return t.yPlotLineMouseDown(t.id,e)}:function(){}}),r&&t.width&&b.a.createElement("span",{key:"".concat(t.id,"_ytext"),style:o({position:"absolute",right:f-t.left-t.width,top:parseFloat(t.top)+t.label.y,whiteSpace:"nowrap",zIndex:t.zIndex-1},t.label.style)},t.label.text))}),g.map(function(t){return b.a.createElement("div",{key:t.id,style:o({pointerEvents:"none",position:"absolute",left:t.left,width:t.width,backgroundColor:t.color,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",display:0===t.width?"none":""},t.style)},"function"==typeof t.textFormatter?t.textFormatter(t.text,t.width):t.text)}),v.map(function(t){var e=t.id,r=t.type,n=t.width,i=t.height,o=t.color,a=t.left,s=t.top,l=t.zIndex;return"diamond"===r?b.a.createElement("svg",{key:e,width:n,height:i,viewBox:"0 0 ".concat(n," ").concat(i),style:{pointerEvents:"none",position:"absolute",left:parseFloat(a)-n/2,top:parseFloat(s)-i,zIndex:l}},b.a.createElement("path",{fill:"rgba(0, 0, 0, 0.75)",d:"M ".concat(n/2," 0 L ").concat(n," ").concat(i/2," ").concat(n/2," ").concat(i," 0 ").concat(i/2," Z"),style:{fill:o},"data-z-index":l})):""}),m.map(function(t){var e=t.id,r=t.fill,n=t.color,i=t.zIndex,o=t.text,a=t.width,s=t.height,l=t.left,c=t.top,u=t.y,d=a/34,h=s/34,f=a/2,p=6*d;return b.a.createElement("svg",{key:e,width:a,height:s,viewBox:"0 0 ".concat(a," ").concat(s),style:{position:"absolute",left:parseFloat(l)-a/2,top:parseFloat(c)-s+u,zIndex:i,pointerEvents:"none"}},b.a.createElement("path",{fill:r,d:"M ".concat(5*d," 0 \n L ").concat(29*d," 0 \n C ").concat(a," 0 ").concat(a," 0 ").concat(a," ").concat(5*h," \n L ").concat(a," ").concat(23*h," \n C ").concat(a," ").concat(28*h," ").concat(a," ").concat(28*h," ").concat(29*d," ").concat(28*h," \n L ").concat(f+p," ").concat(28*h," \n ").concat(f," ").concat(s," \n ").concat(f-p," ").concat(28*h," \n L ").concat(5*d," ").concat(28*h," \n C 0 ").concat(28*h," 0 ").concat(28*h," 0 ").concat(23*h," \n L 0 ").concat(5*h," \n C 0 0 0 0 ").concat(5*d," 0")}),b.a.createElement("text",{x:"8",y:"20",style:{color:n,fill:n}},o))}),b.a.createElement("div",{ref:this.tooltipRef,style:o({position:"absolute",left:i.x,top:i.y,background:"rgba(0, 0, 0, 0.7)",color:"#fff",padding:"5px 10px",borderRadius:"4px",fontSize:"12px",whiteSpace:"nowrap",zIndex:1e3,visibility:r&&n?"visible":"hidden",pointerEvents:"none"},l),dangerouslySetInnerHTML:{__html:n}}),r&&n&&b.a.createElement("div",{style:o({width:2,height:"calc(100% - ".concat(d.top,"px - ").concat(d.bottom,"px)"),position:"absolute",left:s,top:d.top,background:"rgba(255,255,255,0.65)",zIndex:1e3,pointerEvents:"none"},c)}),a&&a.end!==a.start&&b.a.createElement("div",{style:{position:"absolute",top:d.top,left:Math.min(a.start,a.end),width:Math.abs(a.end-a.start),height:h-d.top-d.bottom,border:"1px solid rgba(51, 92, 173, 0.25)",backgroundColor:"rgba(51, 92, 173, 0.25)",pointerEvents:"none",zIndex:3}}))}}])}(b.a.Component);e.a=w}])});
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "wml-custom-spectrum",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "src/index.js",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "cross-env NODE_ENV=production webpack -p",
|
|
9
|
+
"dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot",
|
|
10
|
+
"prepare": "npm run build"
|
|
11
|
+
},
|
|
12
|
+
"peerDependencies": {
|
|
13
|
+
"react": "^16.5.2",
|
|
14
|
+
"react-dom": "^16.5.2"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@babel/core": "^7.0.0",
|
|
18
|
+
"@babel/plugin-proposal-class-properties": "^7.0.0",
|
|
19
|
+
"@babel/preset-env": "^7.0.0",
|
|
20
|
+
"@babel/preset-react": "^7.0.0",
|
|
21
|
+
"babel-loader": "^8.0.0",
|
|
22
|
+
"cross-env": "^7.0.3",
|
|
23
|
+
"css-loader": "^0.28.11",
|
|
24
|
+
"file-loader": "^1.1.11",
|
|
25
|
+
"less": "^2.7.3",
|
|
26
|
+
"less-loader": "^4.0.5",
|
|
27
|
+
"react": "16.5.2",
|
|
28
|
+
"react-dom": "16.5.2",
|
|
29
|
+
"style-loader": "^0.21.0",
|
|
30
|
+
"webpack": "~3.10.0",
|
|
31
|
+
"webpack-dev-server": "~2.11.5",
|
|
32
|
+
"worker-loader": "^2.0.0"
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"dist"
|
|
36
|
+
]
|
|
37
|
+
}
|