!/** * Highcharts JS v11.4.1 (2024-04-04) * * Data module * * (c) 2012-2024 Torstein Honsi * * License: www.highcharts.com/license */function(e){"object"==typeof module&&module.exports?(e.default=e,module.exports=e):"function"==typeof define&&define.amd?define("highcharts/modules/data",["highcharts"],function(t){return e(t),e.Highcharts=t,e}):e("undefined"!=typeof Highcharts?Highcharts:void 0)}(function(e){"use strict";var t=e?e._modules:{};function s(e,t,s,r){e.hasOwnProperty(t)||(e[t]=r.apply(null,s),"function"==typeof CustomEvent&&window.dispatchEvent(new CustomEvent("HighchartsModuleLoaded",{detail:{path:t,module:e[t]}})))}s(t,"Core/HttpUtilities.js",[t["Core/Globals.js"],t["Core/Utilities.js"]],function(e,t){let{win:s}=e,{discardElement:r,objectEach:i}=t,a={ajax:function(e){let t={json:"application/json",xml:"application/xml",text:"text/plain",octet:"application/octet-stream"},s=new XMLHttpRequest;function r(t,s){e.error&&e.error(t,s)}if(!e.url)return!1;s.open((e.type||"get").toUpperCase(),e.url,!0),e.headers&&e.headers["Content-Type"]||s.setRequestHeader("Content-Type",t[e.dataType||"json"]||t.text),i(e.headers,function(e,t){s.setRequestHeader(t,e)}),e.responseType&&(s.responseType=e.responseType),s.onreadystatechange=function(){let t;if(4===s.readyState){if(200===s.status){if("blob"!==e.responseType&&(t=s.responseText,"json"===e.dataType))try{t=JSON.parse(t)}catch(e){if(e instanceof Error)return r(s,e)}return e.success&&e.success(t,s)}r(s,s.responseText)}},e.data&&"string"!=typeof e.data&&(e.data=JSON.stringify(e.data)),s.send(e.data)},getJSON:function(e,t){a.ajax({url:e,success:t,dataType:"json",headers:{"Content-Type":"text/plain"}})},post:function(e,t,a){let n=new s.FormData;i(t,function(e,t){n.append(t,e)}),n.append("b64","true");let{filename:o,type:l}=t;return s.fetch(e,{method:"POST",body:n,...a}).then(e=>{e.ok&&e.text().then(e=>{let t=document.createElement("a");t.href=`data:${l};base64,${e}`,t.download=o,t.click(),r(t)})})}};return a}),s(t,"Extensions/Data.js",[t["Core/Chart/Chart.js"],t["Core/Defaults.js"],t["Core/Globals.js"],t["Core/HttpUtilities.js"],t["Core/Series/Point.js"],t["Core/Series/SeriesRegistry.js"],t["Core/Utilities.js"]],function(e,t,s,r,i,a,n){let{getOptions:o}=t,{doc:l}=s,{ajax:u}=r,{seriesTypes:h}=a,{addEvent:d,defined:m,extend:c,fireEvent:p,isNumber:f,merge:g,objectEach:C,pick:x,splat:y}=n;function T(e){return!!(e&&(e.rowsURL||e.csvURL||e.columnsURL))}class v{static data(e,t={},s){return new v(e,t,s)}static rowsToColumns(e){let t,s,r,i,a;if(e)for(t=0,a=[],s=e.length;tt.getFullYear()-2e3?s+=1900:s+=2e3,Date.UTC(s,e[2]-1,+e[1])},alternative:"mm/dd/YY"},"mm/dd/YY":{regex:/^([0-9]{1,2})[\-\/\.]([0-9]{1,2})[\-\/\.]([0-9]{2})$/,parser:function(e){return e?Date.UTC(+e[3]+2e3,e[1]-1,+e[2]):NaN}}},this.chart=s,this.chartOptions=t,this.options=e,this.rawColumns=[],this.init(e,t,s)}init(e,t,s){let r=e.decimalPoint,i;t&&(this.chartOptions=t),s&&(this.chart=s),"."!==r&&","!==r&&(r=void 0),this.options=e,this.columns=e.columns||this.rowsToColumns(e.rows)||[],this.firstRowAsNames=x(e.firstRowAsNames,this.firstRowAsNames,!0),this.decimalRegex=r&&RegExp("^(-?[0-9]+)"+r+"([0-9]+)$"),void 0!==this.liveDataTimeout&&clearTimeout(this.liveDataTimeout),this.rawColumns=[],this.columns.length&&(this.dataFound(),i=!T(e)),i||(i=this.fetchLiveData()),i||(i=!!this.parseCSV().length),i||(i=!!this.parseTable().length),i||(i=this.parseGoogleSpreadsheet()),!i&&e.afterComplete&&e.afterComplete()}getColumnDistribution(){let e=this.chartOptions,t=this.options,s=[],r=function(e){return(h[e||"line"].prototype.pointArrayMap||[0]).length},i=function(e){return h[e||"line"].prototype.pointArrayMap},a=e&&e.chart&&e.chart.type,n=[],o=[],l=t&&t.seriesMapping||e&&e.series&&e.series.map(function(){return{x:0}})||[],u=0,d;(e&&e.series||[]).forEach(e=>{n.push(r(e.type||a))}),l.forEach(e=>{s.push(e.x||0)}),0===s.length&&s.push(0),l.forEach(t=>{let s=new R,l=n[u]||r(a),h=(e&&e.series||[])[u]||{},c=i(h.type||a),p=c||["y"];for((m(t.x)||h.isCartesian||!c)&&s.addColumnReader(t.x,"x"),C(t,function(e,t){"x"!==t&&s.addColumnReader(e,t)}),d=0;d=m.length)&&(h=m.length-1),r.itemDelimiter)d=r.itemDelimiter;else{let e,s,i;d=null,e=0,s=0,i=!1,m.some(function(t,r){let i=!1,a,n,l,u="";if(r>13)return!0;for(let r=0;ro[","]?i=";":(o[","],o[";"],i=","),r.decimalPoint||(e>s?r.decimalPoint=".":r.decimalPoint=",",t.decimalRegex=RegExp("^(-?[0-9]+)"+r.decimalPoint+"([0-9]+)$")),d=i}let e=0;for(c=u;c<=h;c++)"#"===m[c][0]?e++:function(e,t,o,l){let u=0,h="",m="",c="",p="",f=0,g=0;function C(t){h=e[t],m=e[t-1],c=e[t+1]}function x(e){n.lengthf||f>a){++f,p="";return}r.columnTypes||(!isNaN(parseFloat(p))&&isFinite(p)?(p=parseFloat(p),x("number")):isNaN(Date.parse(p))?x("string"):(p=p.replace(/\//g,"-"),x("date"))),s.lengthe.length)&&(s=e.length);h31?o[m]<100?l[m]="YY":l[m]="YYYY":o[m]>12&&o[m]<=31?(l[m]="dd",d=!0):l[m].length||(l[m]="mm")));if(d){for(m=0;m12&&"YY"!==l[m]&&"YYYY"!==l[m]&&(l[m]="YY"):n[m]>12&&"mm"===l[m]&&(l[m]="dd");return(3===l.length&&"dd"===l[1]&&"dd"===l[2]&&(l[2]="YY"),u=l.join("/"),(r.dateFormats||t.dateFormats)[u])?u:(p("deduceDateFailed"),i)}return i}(s[0])),this.dataFound()}return s}parseTable(){let e=this.options,t=this.columns||[],s=e.startRow||0,r=e.endRow||Number.MAX_VALUE,i=e.startColumn||0,a=e.endColumn||Number.MAX_VALUE;if(e.table){let n=e.table;"string"==typeof n&&(n=l.getElementById(n)),[].forEach.call(n.getElementsByTagName("tr"),(e,n)=>{n>=s&&n<=r&&[].forEach.call(e.children,(e,r)=>{let o=t[r-i],l=1;if(("TD"===e.tagName||"TH"===e.tagName)&&r>=i&&r<=a)for(t[r-i]||(t[r-i]=[]),t[r-i][n-s]=e.innerHTML;n-s>=l&&void 0===o[n-s-l];)o[n-s-l]=null,l++})}),this.dataFound()}return t}fetchLiveData(){let e=this,t=this.chart,s=this.options,r=s.enablePolling,i=g(s),a=0,n=1e3*(s.dataRefreshRate||2);return!!T(s)&&(n<1e3&&(n=1e3),delete s.csvURL,delete s.rowsURL,delete s.columnsURL,function o(l){function h(i,h,d){if(!i||!/^(http|\/|\.\/|\.\.\/)/.test(i))return i&&s.error&&s.error("Invalid URL"),!1;function m(){r&&t.liveDataURL===i&&(e.liveDataTimeout=setTimeout(o,n))}return l&&(clearTimeout(e.liveDataTimeout),t.liveDataURL=i),u({url:i,dataType:d||"json",success:function(e){t&&t.series&&h(e),m()},error:function(e,t){return++a<3&&m(),s.error&&s.error(t,e)}}),!0}h(i.csvURL,function(e){t.update({data:{csv:e}})},"text")||h(i.rowsURL,function(e){t.update({data:{rows:e}})})||h(i.columnsURL,function(e){t.update({data:{columns:e}})})}(!0),T(s))}parseGoogleSpreadsheet(){let e=this,t=this.options,s=t.googleSpreadsheetKey,r=this.chart,i=Math.max(1e3*(t.dataRefreshRate||2),4e3),a=()=>{if(t.googleSpreadsheetRange)return t.googleSpreadsheetRange;let e="ABCDEFGHIJKLMNOPQRSTUVWXYZ",s=(e.charAt(t.startColumn||0)||"A")+((t.startRow||0)+1),r=e.charAt(x(t.endColumn,-1))||"ZZ";return m(t.endRow)&&(r+=t.endRow+1),`${s}:${r}`};return s&&(delete t.googleSpreadsheetKey,function r(n){u({url:["https://sheets.googleapis.com/v4/spreadsheets",s,"values",a(),"?alt=json&majorDimension=COLUMNS&valueRenderOption=UNFORMATTED_VALUE&dateTimeRenderOption=FORMATTED_STRING&key="+t.googleAPIKey].join("/"),dataType:"json",success:function(s){n(s),t.enablePolling&&(e.liveDataTimeout=setTimeout(function(){r(n)},i))},error:function(e,s){return t.error&&t.error(s,e)}})}(function(t){let s=t.values;if(!s||0===s.length)return!1;let i=s.reduce((e,t)=>Math.max(e,t.length),0);s.forEach(e=>{for(let t=0;t31536e6&&"float"!==l?e.isDatetime=!0:e.isNumeric=!0,void 0!==e[d+1]&&(v=p>e[d+1])):(g&&g.length&&(x=this.parseDate(c)),a&&f(x)&&"float"!==l?(n[d]=c,e[d]=x,e.isDatetime=!0,void 0!==e[d+1]&&((T=x>e[d+1])!==v&&void 0!==v&&(this.alternativeFormat?(this.dateFormat=this.alternativeFormat,d=e.length,this.alternativeFormat=this.dateFormats[this.dateFormat].alternative):e.unsorted=!0),v=T)):(e[d]=""===g?null:g,0!==d&&(e.isDatetime||e.isNumeric)&&(e.mixed=!0)));if(a&&e.mixed&&(r[t]=s[t]),a&&v&&this.options.sort)for(t=0;t0;){for((l=new R).addColumnReader(0,"x"),-1!==(d=u.indexOf(0))&&u.splice(d,1),r=0;r0&&f[0].readers.length>0&&void 0!==(h=c[f[0].readers[0].columnIndex])&&(h.isDatetime?e="datetime":h.isNumeric||(e="category")),"category"===e)for(n=0;n{void 0===t.columnIndex&&(t.columnIndex=e.shift())}),this.readers.forEach(e=>{void 0===e.columnIndex&&(t=!1)}),t}read(e,t){let s=this.pointIsArray,r=s?[]:{};if(this.readers.forEach(a=>{let n=e[a.columnIndex][t];s?r.push(n):a.configName.indexOf(".")>0?i.prototype.setNestedProperty(r,n,a.configName):r[a.configName]=n}),void 0===this.name&&this.readers.length>=2){let t=[];this.readers.forEach(function(e){("x"===e.configName||"name"===e.configName||"y"===e.configName)&&void 0!==e.columnIndex&&t.push(e.columnIndex)}),t.length>=2&&(t.shift(),t.sort(function(e,t){return e-t})),this.name=e[x(t.shift(),0)].name}return r}addColumnReader(e,t){this.readers.push({columnIndex:e,configName:t}),"x"===t||"y"===t||void 0===t||(this.pointIsArray=!1)}getReferencedColumnIndexes(){let e,t;let s=[];for(e=0;e