/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/highcharts-contour@1.10.3/highcharts-contour.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
!function(t){"use strict";"object"==typeof module&&module.exports?module.exports=t:t(Highcharts)}((function(t){"use strict";var e=t.getOptions(),i=t.defined,o=t.each,r=t.find,s=t.pick,a=t.extendClass,n=t.merge,l=t.seriesTypes,p=t.wrap,h=(t.perspective,t._modules["Core/Utilities.js"].diffObjects||t._modules["Core/Utilities.js"].cleanRecursively),u=1e-4,c=0;e.plotOptions.contour=n(e.plotOptions.scatter,{marker:{radius:0,fillColor:"#ffffff",states:{hover:{radius:e.plotOptions.scatter.marker.radius}}},states:{hover:{halo:{size:e.plotOptions.scatter.marker.radius+4,attributes:{fill:"#000000"},opacity:.5}}},turboThreshold:0}),l.contour=a(l.heatmap,{type:"contour",hasPointSpecificOptions:!0,getSymbol:l.scatter.prototype.getSymbol,drawPoints:t.Series.prototype.drawPoints,pointClass:t.Point,pointAttribs:t.Series.prototype.pointAttribs,init:function(t){this.is3d=t.is3d&&t.is3d(),this.gradiend_ids={},this.dataFuncState={},l.scatter.prototype.init.apply(this,arguments)},translate:function(){l.scatter.prototype.translate.call(this,arguments),this.translateColors()},dataFunction:function(e){var i=this.options.dataFunction(e);if("number"==typeof i){var r={};return o(this.parallelArrays,(function(t){r[t]="value"===t?i:s(e[t],i)})),r}return"object"==typeof i?t.merge(e,i):null},updateDataIfNecessary:function(){var t=this,e=s(t.options.axis1,"x"),o=s(t.options.axis2,t.is3d?"z":"y"),r=t[e+"Axis"],a=t[o+"Axis"];if(t.options.dataFunction&&i(r.min)&&i(r.max)&&i(a.min)&&i(a.max)){var n=s(r.min,r.options.min),p=s(a.min,a.options.min),u=s(r.max,r.options.max),c=s(a.max,a.options.max),d=s(t.options.grid_width,t.options.grid_height,21),f=s(t.options.grid_height,t.options.grid_width,21),x={dataFunc:t.options.dataFunction,axis1_type:e,axis2_type:o,axis1_min:n,axis1_max:u,axis2_min:p,axis2_max:c,axis1_steps:d,axis2_steps:f},g=h(x,t.dataFuncState);if(0!==Object.keys(g).length){t.dataFuncState=x;for(var v=[],m=0;m<f;m++)for(var y=0;y<d;y++){var _={};_[e]=y/(d-1)*(u-n)+n,_[o]=m/(f-1)*(c-p)+p;var A=this.dataFunction(_);v.push(A)}return l.scatter.prototype.setData.call(this,v,!0,!1,!1)}}},bindAxes:function(){this.is3d?(this.axisTypes=["xAxis","yAxis","zAxis","colorAxis"],this.parallelArrays=["x","y","z","value"]):(this.axisTypes=["xAxis","yAxis","colorAxis"],this.parallelArrays=["x","y","value"]),l.scatter.prototype.bindAxes.apply(this,arguments)},drawTriangle:function(e,i,o,r,s,a){var n,l=this,p=this.chart,h=this.chart.renderer,v=e.A,m=e.B,y=e.C,_=[v,m,y];if(o){var A=[this.colorAxis.normalizedValue(v.value),this.colorAxis.normalizedValue(m.value),this.colorAxis.normalizedValue(y.value)],b=Math.max(A[0],A[1],A[2]),w=Math.min(A[0],A[1],A[2]),Y=Math.abs(d(v,m,y));if(b-w<u||Y<u)n=this.colorAxis.toColor((v.value+m.value+y.value)/3);else{var X=new g([[v.plotX,v.plotY,1,A[0]],[m.plotX,m.plotY,1,A[1]],[y.plotX,y.plotY,1,A[2]]]);X.toReducedRowEchelonForm();var k=X.mtx[0][3],z=X.mtx[1][3],S=X.mtx[2][3],M=(0-S)/(k*k+z*z),F=(1-S)/(k*k+z*z),C=f(M*k),O=f(M*z),T=f(F*k),j=f(F*z);if(h.isSVG){var P=e.gradient;P?P.animate({x1:C,y1:O,x2:T,y2:j}):(P=h.createElement("linearGradient"),e.gradient=P,P.add(h.defs),P.attr({id:"contour-gradient-id-"+c++,x1:C,y1:O,x2:T,y2:j})),P.element.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",this.base_gradient_id),n="url("+h.url+"#"+P.attr("id")+")"}else n={linearGradient:{x1:C,y1:O,x2:T,y2:j,spreadMethod:"pad",gradientUnits:"userSpaceOnUse"},stops:this.colorAxis.stops}}var E=["M",v.plotX,v.plotY,"L",m.plotX,m.plotY,"L",y.plotX,y.plotY,"Z"];e.shape?(e.shape.animate({d:E}).attr({fill:n}),e.shape.parent!=e.group&&e.shape.add(e.group)):(e.shape=h.path(E).attr({"shape-rendering":"crispEdges",fill:n}),e.shape.on("mousemove",(function(i){if(i=p.pointer.normalize(i),p.inverted)var o=p.plotTop+p.plotHeight-i.chartY,r=p.plotLeft+p.plotWidth-i.chartX;else o=i.chartX-p.plotLeft,r=i.chartY-p.plotTop;if(l.options.interpolateTooltip){var s=new g([[v.plotX,v.plotY,1,v.x,v.y,v.z,v.value],[m.plotX,m.plotY,1,m.x,m.y,m.z,m.value],[y.plotX,y.plotY,1,y.x,y.y,y.z,y.value]]);s.toReducedRowEchelonForm();var a={x:x(l.xAxis,s.mtx[0][3]*o+s.mtx[1][3]*r+s.mtx[2][3]),y:x(l.yAxis,s.mtx[0][4]*o+s.mtx[1][4]*r+s.mtx[2][4]),z:x(l.zAxis,s.mtx[0][5]*o+s.mtx[1][5]*r+s.mtx[2][5]),value:s.mtx[0][6]*o+s.mtx[1][6]*r+s.mtx[2][6]};l.options.dataFunction&&(a=l.dataFunction(a));var n=(new t.Point).init(l);n.applyOptions(a);var h=l.data;l.data=[n],l.translate(),l.data=h,p.tooltip.refresh(n,i)}else{var u=function(t){return(t.plotX-o)*(t.plotX-o)+(t.plotY-r)*(t.plotY-r)},c=e.A;u(e.B)<u(c)&&(c=e.B),u(e.C)<u(c)&&(c=e.C),c.onMouseOver(i)}})),e.shape.add(e.group))}else e.shape&&(e.shape.destroy,delete e.shape);var L=e.group.edge_path,V=e.group.edge_path_old;if(r||s){var G=function(t,e,o,r){i[e+"-"+t]?s&&i[t+"-"+e]--:1==i[t+"-"+e]--&&(L.push("M",o.plotX,o.plotY,"L",r.plotX,r.plotY),V.push("M",o.plotX_prev,o.plotY_prev,"L",r.plotX_prev,r.plotY_prev))};G(e.a,e.b,e.A,e.B),G(e.b,e.c,e.B,e.C),G(e.c,e.a,e.C,e.A)}for(var R=0;R<a.length;R++){var B=a[R].axis,Z=a[R].attr;for(var U in B.tickPositions){for(var D=B.tickPositions[U],I=[],N=0;N<3;N++){C=_[N].plotX;var H=_[N].plotX_prev,W=(O=_[N].plotY,_[N].plotY_prev),q=_[N][Z],J=(T=_[(N+1)%3].plotX,_[(N+1)%3].plotX_prev),K=(j=_[(N+1)%3].plotY,_[(N+1)%3].plotY_prev),Q=_[(N+1)%3][Z];if(q!=Q&&D>=Math.min(q,Q)&&D<Math.max(q,Q)){var $=(D-q)/(Q-q);I.push([$*(T-C)+C,$*(j-O)+O,$*(J-H)+H,$*(K-W)+W])}}2==I.length&&(L.push("M",I[0][0],I[0][1],"L",I[1][0],I[1][1]),V.push("M",I[0][2],I[0][3],"L",I[1][2],I[1][3]))}}},assignGroups:function(){for(var e=this,i=0;i<e.triangles.length;i++)e.triangles[i].group_id=e.is3d?i:0;var o={},r=e.groups;for(i=0;i<e.triangles.length;i++){var s=e.triangles[i],a=s.group_id;r[a]?(o[a]=r[a],o[a].zSum=0,o[a].triangle_count=0,delete r[a]):o[a]||(o[a]=e.chart.renderer.g().add(this.surface_group),o[a].zSum=0,o[a].triangle_count=0),e.triangles[i].group=o[a],o[a].zSum+=s.A.plotZ+s.B.plotZ+s.C.plotZ,o[a].triangle_count++}t.objectEach(o,(function(t,e){t.attr({zIndex:-t.zSum/(3*t.triangle_count)})})),t.objectEach(r,(function(t){t.destroy()})),e.groups=o},drawGraph:function(){this.updateDataIfNecessary();var e=this,i=e.points,o=this.options,r=e.chart.renderer;if(e.surface_group||(e.surface_group=r.g().add(e.group),e.triangles=[],e.groups={}),e.chart.renderer.isSVG){for(var a="",n=0;n<this.colorAxis.stops.length;n++)for(var l=0;l<this.colorAxis.stops[n].length;l++)a+=":"+this.colorAxis.stops[n][l];if(!this.gradiend_ids[a]){var p=e.chart.renderer.rect(0,0,1,1).attr({fill:{linearGradient:{x1:0,y1:0,x2:1,y2:0,spreadMethod:"pad",gradientUnits:"userSpaceOnUse"},stops:this.colorAxis.stops}});this.gradiend_ids[a]=/(#.*)[)]/.exec(p.attr("fill"))[1]}this.base_gradient_id=this.gradiend_ids[a]}e.surface_group;var h=0,u={},c=function(t){return t&&"number"==typeof t.x&&"number"==typeof t.y&&("number"==typeof t.z||!e.is3d)&&"number"==typeof t.value},f=function(t,e){u[t+"-"+e]=(u[t+"-"+e]||0)+1},x=function(t,o,r){if(c(i[t])&&c(i[o])&&c(i[r])){if(e.is3d)if(d(i[t],i[o],i[r])<0){var s=t;t=o,o=s}var a=e.triangles[h];a||(a=e.triangles[h]={}),h++,a.a=t,a.b=o,a.c=r,a.A=i[t],a.B=i[o],a.C=i[r],f(t,o),f(o,r),f(r,t)}},g=[];if(o.triangles)for(n=0;n<o.triangles.length;n++){var v=o.triangles[n];"number"==typeof v?g.push(v):"object"==typeof v&&"number"==typeof v[0]&&"number"==typeof v[1]&&"number"==typeof v[2]&&g.push(v[0],v[1],v[2])}else if(o.grid_width){var m=o.grid_width;for(n=1;n<i.length/m;n++)for(l=1;l<o.grid_width&&n*m+l<i.length;l++){var y=(n-1)*m+(l-1),_=(n-1)*m+l,A=n*m+(l-1),b=n*m+l;this.is3d&&Math.abs(i[y].value-i[b].value)<Math.abs(i[_].value-i[A].value)?(g.push(y,_,b),g.push(y,b,A)):(g.push(y,_,A),g.push(_,b,A))}}else{var w=[],Y={};i.forEach((function(t,i){if(c(t)){if(e.is3d)var o=[t.axisXpos,t.axisZpos];else o=[t.plotX,t.plotY];Y[i]=w.length,w.push(o)}}));var X=[];(o.outer_edges||[]).forEach((function(t){t[0]in w&&t[1]in w&&X.push([Y[t[0]],Y[t[1]]])})),g=o.cdt2d||0!=X.length||!window.Delaunay?cdt2d(w,X,o.cdt2d).flat():Delaunay.triangulate(w)}for(n=0;n<g.length-2;n+=3)x(g[n],g[n+1],g[n+2]);for(n=h;n<e.triangles.length;n++)e.triangles[n].shape&&e.triangles[n].shape.destroy(),e.triangles[n].edge&&e.triangles[n].edge.destroy(),e.triangles[n].gradient&&e.triangles[n].gradient.destroy();e.triangles.splice(h,e.triangles.length-h),this.assignGroups(),t.objectEach(e.groups,(function(t){t.edge_path_old=[],t.edge_path=[]}));var k=[];for(o.contours?t.each(o.contours,(function(t){switch(t){case"x":k.push({axis:e.xAxis,attr:"x"});break;case"y":k.push({axis:e.yAxis,attr:"y"});break;case"z":k.push({axis:e.zAxis,attr:"z"});break;case"value":k.push({axis:e.colorAxis,attr:"value"})}})):o.showContours&&k.push({axis:e.colorAxis,attr:"value"}),n=0;n<h;n++)e.drawTriangle(e.triangles[n],u,s(o.showFaces,!0),s(o.showEdges,!1),s(o.showTriangles,!1),k);t.objectEach(e.groups,(function(t){t.edge_path.length?t.edges?t.edges.attr({d:t.edge_path_old}).animate({d:t.edge_path}):(t.edges=r.path(t.edge_path).attr({"stroke-linecap":"round",stroke:"black","stroke-width":1,zIndex:1}),t.edges.add(t)):t.edges&&(t.edges.destroy(),delete t.edges)})),t.each(i,(function(t){t.plotX_prev=t.plotX,t.plotY_prev=t.plotY,t.plotZ_prev=t.plotZ}))}});var d=function(t,e,i){return(t.plotX*(e.plotY-i.plotY)+e.plotX*(i.plotY-t.plotY)+i.plotX*(t.plotY-e.plotY))/2},f=function(t){return t>=-1e-6&&t<=1e-6?0:t},x=function(e,i){if(!e)return i;var o=e.toValue(e.toPixels(i)-.5),r=e.toValue(e.toPixels(i)+.5),s=Math.abs(r-o),a=t.normalizeTickInterval(s,[1,2,5,10],t.getMagnitude(s),!0);return t.correctFloat(a*Math.round(i/a))};function g(t){this.mtx=t,this.height=t.length,this.width=t[0].length}g.prototype.toReducedRowEchelonForm=function(){for(var t=0;t<this.width&&t<this.height;t++){for(var e=null,i=0,o=t;o<this.height;o++)Math.abs(this.mtx[o][t])>i&&(e=o,i=Math.abs(this.mtx[o][t]));if(null!=e){var r=this.mtx[t];this.mtx[t]=this.mtx[e],this.mtx[e]=r;for(o=0;o<this.height;o++)if(o!=t)for(var s=this.mtx[o][t]/this.mtx[t][t],a=t;a<this.width;a++)this.mtx[o][a]-=s*this.mtx[t][a];for(s=this.mtx[t][t],a=t;a<this.width;a++)this.mtx[t][a]/=s;for(o=0;o<this.height;o++)this.mtx[o][t]=o==t?1:0}else for(var o=0;o<this.height;o++)this.mtx[o][t]=0}return this},g.prototype.toString=function(){for(var t=[],e=0;e<this.mtx.length;e++)t.push(this.mtx[e].join(","));return t.join("\n")};var v=function(t,e){var i,o,r=t.contourSeries.xAxis,s=t.contourSeries.yAxis;return t.isXAxis?(i=r.toValue(e,!0),o=s.toValue(!t.opposite!=!t.chart.inverted?0:s.len,!0)):(i=r.toValue(!t.opposite!=!t.chart.inverted?r.len:0,!0),o=s.toValue(e,!0)),{x:i,y:o}},m=function(){var e=this,i=e.contourSeries;if(!i){if(!(i=r(e.chart.series,(function(t){return e.options.serie?t.id===e.options.serie||t.options&&t.options.id===e.options.serie:"contour"===t.type}))))return t.error(17,!1),[];e.contourSeries=i,o(i.axisTypes||[],(function(t){p(i[t],"setTickPositions",(function(t){t.apply(this,[].slice.call(arguments,1)),e.forceRedraw=!0,e.setScale()}))}))}var s,a,n=i.colorAxis.tickPositions;if(!n||0===n.length)return[];for(var l=[],h={},u=0;u<=e.len;u++){var c=e.toValue(u,!0),d=i.dataFunction(v(e,u)).value;if(u>0&&a!==d)for(var f in n){var x=n[f];if(x>=Math.min(a,d)&&x<=Math.max(a,d)){var g=(x-a)/(d-a)*(c-s)+s;l.push(g),h[g]=x}}s=c,a=d}return e._contourAxisLabels=h,l};p(t.Axis.prototype,"setOptions",(function(t,e){return e.contourAxis&&(e=n({tickWidth:1,tickColor:"black",title:{text:null}},e,{min:0,max:1,startOnTick:!1,endOnTick:!1,tickPositioner:m})),t.call(this,e)})),p(t.Axis.prototype,"init",(function(t,e,i){if(t.apply(this,[].slice.call(arguments,1)),this.options.tickPositioner===m){var o=this.defaultLabelFormatter;this.defaultLabelFormatter=function(){return this.value=this.axis._contourAxisLabels[this.value],o.call(this)}}}))}));
//# sourceMappingURL=/sm/6cdecc55d5122dc200a85bc52cfbb5512415b02e24c57eedb7a20890420c20af.map