UNPKG

@highcharts/dashboards

Version:
13 lines 145 kB
!/**
 * Highcharts Dashboards v4.2.1 (2026-08-06)
 * @module dashboards/dashboards
 *
 * (c) 2009-2026 Highsoft AS
 *
 * A commercial license may be required depending on use,
 * see www.highcharts.com/license
 */function(e,t){"object"==typeof exports&&"object"==typeof module?(e._Dashboards=t(),module.exports=e._Dashboards):"function"==typeof define&&define.amd?define("dashboards/dashboards",[],t):"object"==typeof exports?(e._Dashboards=t(),exports["dashboards/dashboards"]=e._Dashboards):(e.Dashboards&&e.Dashboards.error(16,!0),e.Dashboards=t())}("u"<typeof window?this:window,()=>(()=>{"use strict";var e,t;let i,n,s,o={};o.d=(e,t)=>{if(Array.isArray(t))for(var i=0;i<t.length;){var n=t[i++],s=t[i++];o.o(e,n)?0===s&&i++:0===s?Object.defineProperty(e,n,{enumerable:!0,value:t[i++]}):Object.defineProperty(e,n,{enumerable:!0,get:s})}else for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);let r={};o.d(r,{default:()=>iM}),(t=e||(e={})).SVG_NS="http://www.w3.org/2000/svg",t.product="Highcharts",t.version="4.2.1",t.win="u">typeof window?window:{},t.doc=t.win.document,t.svg=!!t.doc?.createElementNS?.(t.SVG_NS,"svg")?.createSVGRect,t.pageLang=t.doc?.documentElement?.closest("[lang]")?.lang,t.userAgent=t.win.navigator?.userAgent||"",t.isChrome=t.win.chrome,t.isFirefox=-1!==t.userAgent.indexOf("Firefox"),t.isMS=/(edge|msie|trident)/i.test(t.userAgent)&&!t.win.opera,t.isSafari=!t.isChrome&&-1!==t.userAgent.indexOf("Safari"),t.isTouchDevice=/(Mobile|Android|Windows Phone)/.test(t.userAgent),t.isWebKit=-1!==t.userAgent.indexOf("AppleWebKit"),t.deg2rad=2*Math.PI/360,t.marginNames=["plotTop","marginRight","marginBottom","plotLeft"],t.noop=function(){},t.supportsPassiveEvents=function(){let e=!1;if(!t.isMS){let i=Object.defineProperty({},"passive",{get:function(){e=!0}});t.win.addEventListener&&t.win.removeEventListener&&(t.win.addEventListener("testPassive",t.noop,i),t.win.removeEventListener("testPassive",t.noop,i))}return e}(),t.charts=[],t.composed=[],t.dateFormats={},t.seriesTypes={},t.symbolSizes={},t.chartCount=0;let a=e,{doc:l,win:h}=a;function c(e,t,i,n={}){let s="function"==typeof e&&e.prototype||e;Object.hasOwnProperty.call(s,"hcEvents")||(s.hcEvents={});let o=s.hcEvents;a.Point&&e instanceof a.Point&&e.series&&e.series.chart&&(e.series.chart.runTrackerClick=!0);let r=e.addEventListener;r&&r.call(e,t,i,!!a.supportsPassiveEvents&&{passive:void 0===n.passive?-1!==t.indexOf("touch"):n.passive,capture:!1}),o[t]||(o[t]=[]);let l={fn:i,order:"number"==typeof n.order?n.order:1/0};return o[t].push(l),o[t].sort((e,t)=>e.order-t.order),function(){P(e,t,i)}}function d(e,t,i){let n,s=T(t)&&!g(i),o=(t,i)=>{g(t)?e.setAttribute(i,t):s?(n=e.getAttribute(i))||"class"!==i||(n=e.getAttribute(i+"Name")):e.removeAttribute(i)};return T(t)?o(i,t):S(t,o),n}function u(e,t){return e>1e14?e:parseFloat(e.toPrecision(t||14))}function p(e,t,i,n,s){let o=l.createElement(e);return t&&y(o,t),s&&m(o,{padding:"0",border:"none",margin:"0"}),i&&m(o,i),n&&n.appendChild(o),o}function m(e,t){y(e.style,t)}function g(e){return null!=e}function f(e,t,i,n){let s={};return!function e(t,s,o,r){let a=i?s:t;S(t,function(i,l){if(!r&&n&&n.indexOf(l)>-1&&s[l]){i=I(i),o[l]=[];for(let t=0;t<Math.max(i.length,s[l].length);t++)s[l][t]&&(void 0===i[t]?o[l][t]=s[l][t]:(o[l][t]={},e(i[t],s[l][t],o[l][t],r+1)))}else E(i,!0)&&!i.nodeType?(o[l]=x(i)?[]:{},e(i,s[l]||{},o[l],r+1),0===Object.keys(o[l]).length&&("colorAxis"!==l||0!==r)&&delete o[l]):(t[l]!==s[l]||l in t&&!(l in s))&&"__proto__"!==l&&"constructor"!==l&&(o[l]=a[l])})}(e,t,s,0),s}function y(e,t){let i;for(i in e||(e={}),t)e[i]=t[i];return e}function b(e,t,i,n){if(i=i||{},l?.createEvent&&(e.dispatchEvent||e.fireEvent&&e!==a)){let n=l.createEvent("Events");n.initEvent(t,!0,!0),i=y(n,i),e.dispatchEvent?e.dispatchEvent(i):e.fireEvent(t,i)}else if(e.hcEvents){i.target||y(i,{preventDefault:function(){i.defaultPrevented=!0},target:e,type:t});let n=[],s=e,o=!1;for(;s.hcEvents;)Object.hasOwnProperty.call(s,"hcEvents")&&s.hcEvents[t]&&(n.length&&(o=!0),n.unshift.apply(n,s.hcEvents[t])),s=Object.getPrototypeOf(s);o&&n.sort((e,t)=>e.order-t.order),n.forEach(t=>{!1===t.fn.call(e,i,e)&&i.preventDefault()})}n&&!i.defaultPrevented&&n.call(e,i)}function C(e,t,i){let n;if("width"===t){let t=Math.min(e.offsetWidth,e.scrollWidth),i=e.getBoundingClientRect?.().width;return i<t&&i>=t-1&&(t=Math.floor(i)),Math.max(0,t-(C(e,"padding-left",!0)||0)-(C(e,"padding-right",!0)||0))}if("height"===t)return Math.max(0,Math.min(e.offsetHeight,e.scrollHeight)-(C(e,"padding-top",!0)||0)-(C(e,"padding-bottom",!0)||0));let s=h.getComputedStyle(e,void 0);return s&&(n=s.getPropertyValue(t),A(i,"opacity"!==t)&&(n=parseInt(n,10))),n}let w=Array.prototype.find?function(e,t){return e.find(t)}:function(e,t){let i,n=e.length;for(i=0;i<n;i++)if(t(e[i],i))return e[i]};function v(e){return E(e)&&"number"==typeof e.nodeType}function O(e){return"number"==typeof e&&!isNaN(e)&&e<1/0&&e>-1/0}function T(e){return"string"==typeof e}function x(e){let t=Object.prototype.toString.call(e);return"[object Array]"===t||"[object Array Iterator]"===t}function N(e){return"function"==typeof e}function E(e,t){return!!e&&"object"==typeof e&&(!t||!x(e))}function M(e,...t){let i,n=[e,...t],s={},o=function(e,t){return"object"!=typeof e&&(e={}),S(t,function(i,n){if("__proto__"!==n&&"constructor"!==n){let s;!E(i,!0)||(s=i?.constructor,E(i,!0)&&!v(i)&&s?.name&&"Object"!==s.name)||v(i)?e[n]=t[n]:e[n]=o(e[n]||{},i)}}),e};!0===e&&(s=n[1],n=Array.prototype.slice.call(n,2));let r=n.length;for(i=0;i<r;i++)s=o(s,n[i]);return s}function S(e,t,i){for(let n in e)Object.hasOwnProperty.call(e,n)&&t.call(i||e[n],e[n],n,e)}function R(e,t,i){return Array((t||2)+1-String(e).replace("-","").length).join(i||"0")+e}function A(){let e=arguments,t=e.length;for(let i=0;i<t;i++){let t=e[i];if(null!=t)return t}}function P(e,t,i){function n(t,i){let n=e.removeEventListener;n&&n.call(e,t,i,!1)}function s(i){let s,o;e.nodeName&&(t?(s={})[t]=!0:s=i,S(s,function(e,t){if(i[t])for(o=i[t].length;o--;)n(t,i[t][o].fn)}))}let o="function"==typeof e&&e.prototype||e;if(Object.hasOwnProperty.call(o,"hcEvents")){let e=o.hcEvents;if(t){let o=e[t]||[];i?(e[t]=o.filter(function(e){return i!==e.fn}),n(t,i)):(s(e),e[t]=[])}else s(e),delete o.hcEvents}}function I(e){return x(e)?e:[e]}function L(e){return T(e)?e.substring(0,1).toUpperCase()+e.substring(1):String(e)}function D(e,t){return"string"==typeof e&&(e=e.replace(/^\s+|\s+$/g,""),t&&/^[\d\s]+$/.test(e)&&(e=e.replace(/\s/g,""))),e}let k=function(e,t){let i;if("string"==typeof e)i=t.parseDate(e);else if("number"==typeof e)i=e;else{if(e instanceof Date)return e;i=t.parseDate(""+e)}return new Date(i)},H=function(e,t){if("number"==typeof e)return e;if("boolean"==typeof e)return+!!e;if("string"==typeof e){if(e.indexOf(" ")>-1&&(e=e.replace(/\s+/g,"")),t){if(!t.test(e))return NaN;e=e.replace(t,"$1.$2")}return parseFloat(e)}return e instanceof Date?e.getDate():e?e.getRowCount():NaN},F=function(e){return""+e},j=function(e=[],t){let i={};for(let n=0,s=Math.max(t.length,e.length);n<s;++n)i[t[n]||`${n}`]=e[n]?e[n].slice():[];return i},z=function(e,t){let i="string";if("string"==typeof e){let n=D(`${e}`),s=t.decimalRegExp,o=D(n,!0);s&&(o=s.test(o)?o.replace(s,"$1.$2"):"");let r=parseFloat(o);+o===r?e=r:i=O(t.parseDate(e))?"Date":"string"}return"number"==typeof e&&(i=e>31536e6?"Date":"number"),i};class V{static registerType(e,t){return!!e&&!V.types[e]&&!!(V.types[e]=t)}constructor(e){this.dateFormats={"YYYY/mm/dd":{regex:/^(\d{4})([\-\.\/])(\d{1,2})\2(\d{1,2})$/,parser:function(e){return e?Date.UTC(+e[1],e[3]-1,+e[4]):NaN}},"dd/mm/YYYY":{regex:/^(\d{1,2})([\-\.\/])(\d{1,2})\2(\d{4})$/,parser:function(e){return e?Date.UTC(+e[4],e[3]-1,+e[1]):NaN},alternative:"mm/dd/YYYY"},"mm/dd/YYYY":{regex:/^(\d{1,2})([\-\.\/])(\d{1,2})\2(\d{4})$/,parser:function(e){return e?Date.UTC(+e[4],e[1]-1,+e[3]):NaN}},"dd/mm/YY":{regex:/^(\d{1,2})([\-\.\/])(\d{1,2})\2(\d{2})$/,parser:function(e){let t=new Date;if(!e)return NaN;let i=+e[4];return i>t.getFullYear()-2e3?i+=1900:i+=2e3,Date.UTC(i,e[3]-1,+e[1])},alternative:"mm/dd/YY"},"mm/dd/YY":{regex:/^(\d{1,2})([\-\.\/])(\d{1,2})\2(\d{2})$/,parser:function(e){return e?Date.UTC(+e[4]+2e3,e[1]-1,+e[3]):NaN}}};const t=M(V.defaultOptions,e);let i=t.decimalPoint;("."===i||","===i)&&(i="."===i?"\\.":",",this.decimalRegExp=RegExp("^(-?[0-9]+)"+i+"([0-9]+)$")),this.options=t}convertByType(e){let t=this;return({number:e=>H(e,t.decimalRegExp),Date:e=>k(e,t),string:F})[z(e,t)].call(t,e)}deduceDateFormat(e,t,i){let n=[],s=[],o="YYYY/mm/dd",r,a=[],l=0,h=!1,c,d;for((!t||t>e.length)&&(t=e.length);l<t;l++)if(void 0!==e[l]&&e[l]&&e[l].length)for(d=0,r=e[l].trim().replace(/[\-\.\/]/g," ").split(" "),a=["","",""];d<r.length;d++)d<a.length&&(c=parseInt(r[d],10))&&(s[d]=!s[d]||s[d]<c?c:s[d],void 0!==n[d]?n[d]!==c&&(n[d]=!1):n[d]=c,c>31?c<100?a[d]="YY":a[d]="YYYY":c>12&&c<=31?(a[d]="dd",h=!0):a[d].length||(a[d]="mm"));if(h){for(d=0;d<n.length;d++)!1!==n[d]?s[d]>12&&"YY"!==a[d]&&"YYYY"!==a[d]&&(a[d]="YY"):s[d]>12&&"mm"===a[d]&&(a[d]="dd");3===a.length&&"dd"===a[1]&&"dd"===a[2]&&(a[2]="YY"),o=a.join("/")}return i&&(this.options.dateFormat=o),o}emit(e){b(this,e.type,e)}on(e,t){return c(this,e,t)}parseDate(e,t){let i=this.options,n=t||i.dateFormat,s=NaN,o,r=null;if(i.parseDate)s=i.parseDate(e);else{let t=this.dateFormats;if(n){let i=t[n];i||(i=t["YYYY/mm/dd"]),(r=e.match(i.regex))&&(s=i.parser(r))}else for(o in t){let i=t[o];if(r=e.match(i.regex)){n=o,s=i.parser(r);break}}if(!r){let t=Date.parse(e);!isNaN(t)&&(s=t-6e4*new Date(t).getTimezoneOffset(),e.includes("2001")||2001!==new Date(s).getFullYear()||(s=NaN))}}return s}}V.defaultOptions={dateFormat:"",firstRowAsNames:!0},V.types={};let $=V;class B extends ${constructor(e){const t=M(B.defaultOptions,e);super(t),this.headers=[],this.dataTypes=[],this.options=t}parse(e,t){let i=this.dataTypes,n=M(this.options,e),{beforeParse:s,lineDelimiter:o,firstRowAsNames:r,itemDelimiter:a}=n,l,h=0,{csv:c,startRow:d,endRow:u}=n,p,m=[];if(this.emit({type:"parse",columns:m,detail:t,headers:this.headers}),c&&s&&(c=s(c)),c){if(l=c.replace(/\r\n|\r/g,"\n").split(o||"\n"),(!d||d<0)&&(d=0),(!u||u>=l.length)&&(u=l.length-1),a||(this.guessedItemDelimiter=this.guessDelimiter(l)),r){let e=l[0].split(a||this.guessedItemDelimiter||",");for(let t=0;t<e.length;t++)e[t]=e[t].trim().replace(/^["']|["']$/g,"");this.headers=e,d++}let e=0;for(h=d;h<=u;h++)"#"===l[h][0]?e++:this.parseCSVRow(m,l[h],h-d-e);i.length&&i[0].length&&"date"===i[0][1]&&!this.options.dateFormat&&this.deduceDateFormat(m[0],null,!0);for(let e=0,t=m.length;e<t;++e){p=m[e];for(let t=0,i=p.length;t<i;++t)if(p[t]&&"string"==typeof p[t]){let i=this.convertByType(p[t]);i instanceof Date&&(i=i.getTime()),m[e][t]=i}}}return m.forEach(e=>{e.length=Math.max(...m.map(e=>e.length))}),this.emit({type:"afterParse",columns:m,detail:t,headers:this.headers}),j(m,this.headers)}parseCSVRow(e,t,i){let n=this,s=n.dataTypes,{startColumn:o,endColumn:r}=n.options,a=n.options.itemDelimiter||n.guessedItemDelimiter,{decimalPoint:l}=n.options;l&&l!==a||(l=n.guessedDecimalPoint||".");let h=0,c="",d="",u=0,p=0,m=e=>{c=t[e]},g=e=>{s.length<p+1&&s.push([e]),s[p][s[p].length-1]!==e&&s[p].push(e)},f=()=>{if(o>u||u>r){++u,d="";return}if("string"==typeof d){let e=parseFloat(d);!isNaN(e)&&isFinite(Number(d))?(d=e,g("number")):isNaN(Date.parse(d))?g("string"):(d=d.replace(/\//g,"-"),g("date"))}else g("number");if(e.length<p+1&&e.push([]),"number"!=typeof d&&"number"!==z(d,n)&&l){let e=d;"number"!==z(d=d.replace(l,"."),n)&&(d=e)}e[p][i]=d,d="",++p,++u};if(t.trim().length&&"#"!==t.trim()[0]){for(;h<t.length;h++){if(m(h),"#"===c&&!/^#[A-F\d]{3,3}|[A-F\d]{6,6}/i.test(t.substring(h)))return void f();if('"'===c)for(m(++h);h<t.length&&'"'!==c;)d+=c,m(++h);else c===a?f():d+=c}f()}}guessDelimiter(e){let t=0,i=0,n,s={",":0,";":0,"	":0},o=e.length;for(let n=0;n<o;n++){let o=!1,r,a,l,h="";if(n>13)break;let c=e[n];for(let e=0;e<c.length&&(r=c[e],a=c[e+1],l=c[e-1],"#"!==r);e++){if('"'===r)if(o){if('"'!==l&&'"'!==a){for(;" "===a&&e<c.length;)a=c[++e];void 0!==s[a]&&s[a]++,o=!1}}else o=!0;else void 0!==s[r]?(isNaN(Date.parse(h=h.trim()))?(isNaN(Number(h))||!isFinite(Number(h)))&&s[r]++:s[r]++,h=""):h+=r;","===r&&i++,"."===r&&t++}}return s[";"]>s[","]?n=";":(s[","]>s[";"],n=","),t>i?this.guessedDecimalPoint=".":this.guessedDecimalPoint=",",n}}B.defaultOptions={...$.defaultOptions,lineDelimiter:"\n",startColumn:0,endColumn:Number.MAX_VALUE,startRow:0,endRow:Number.MAX_VALUE},$.registerType("CSV",B);class G{static registerType(e,t){return!!e&&!G.types[e]&&!!(G.types[e]=t)}benchmark(e,t){let i=[],n=this,s=()=>{n.modifyTable(e),n.emit({type:"afterBenchmarkIteration"})},{iterations:o}=M({iterations:1},t);n.on("afterBenchmarkIteration",()=>{i.length===o?n.emit({type:"afterBenchmark",results:i}):s()});let r={startTime:0,endTime:0};return n.on("modify",()=>{r.startTime=window.performance.now()}),n.on("afterModify",()=>{r.endTime=window.performance.now(),i.push(r.endTime-r.startTime)}),s(),i}emit(e){b(this,e.type,e)}modify(e,t){let i=this;return new Promise((n,s)=>{e.modified||(e.modified=e.clone(!1,t));try{n(i.modifyTable(e,t))}catch(n){i.emit({type:"error",detail:t,table:e}),s(n instanceof Error?n:Error(""+n))}})}on(e,t){return c(this,e,t)}}G.types={};let U=G,Y={convertToNumber:function(e,t){switch(typeof e){case"boolean":return+!!e;case"number":return isNaN(e)&&!t?null:e;default:return isNaN(e=parseFloat(`${e??""}`))&&!t?null:e}},setLength:function(e,t,i){return Array.isArray(e)?(e.length=t,e):e[i?"subarray":"slice"](0,t)},splice:function(e,t,i,n,s=[]){if(Array.isArray(e))return Array.isArray(s)||(s=Array.from(s)),{removed:e.splice(t,i,...s),array:e};let o=Object.getPrototypeOf(e).constructor,r=e[n?"subarray":"slice"](t,t+i),a=new o(e.length-i+s.length);return a.set(e.subarray(0,t),0),a.set(s,t),a.set(e.subarray(t+i),t+s.length),{removed:r,array:a}}},{charts:_,win:W}=a;function J(e,t,i,n){let s=t?"Highcharts error":"Highcharts warning";32===e&&(e=`${s}: Deprecated member`);let o=O(e),r=o?`${s} #${e}: www.highcharts.com/errors/${e}/`:e.toString();if(void 0!==n){let e="";o&&(r+="?"),S(n,function(t,i){e+=`
 - ${i}: ${t}`,o&&(r+=encodeURI(i)+"="+encodeURI(t))}),r+=e}b(a,"displayError",{chart:i,code:e,message:r,params:n},function(){if(t)throw Error(r);W.console&&-1===J.messages.indexOf(r)&&console.warn(r)}),J.messages.push(r)}(J||(J={})).messages=[];let Z={millisecond:1,second:1e3,minute:6e4,hour:36e5,day:864e5,week:6048e5,month:24192e5,year:314496e5};Math.easeInOutSine=function(e){return -.5*(Math.cos(Math.PI*e)-1)};let K=(n=Math.random().toString(36).substring(2,9)+"-",s=0,function(){return"highcharts-"+(i?"":n)+s++});W.jQuery&&(W.jQuery.fn.highcharts=function(){let e=[].slice.call(arguments);if(this[0])return e[0]?(new a[T(e[0])?e.shift():"Chart"](this[0],e[0],e[1]),this):_[d(this[0],"data-highcharts-chart")]});let{setLength:q,splice:X}=Y,Q=class{constructor(e={}){this.isDataTable=!0,this.autoId=!e.id,this.columns={},this.id=e.id||K(),this.rowCount=0,this.versionTag=K();let t=0;S(e.columns||{},(e,i)=>{this.columns[i]=e.slice(),t=Math.max(t,e.length)}),this.applyRowCount(t)}applyRowCount(e){this.rowCount=e,S(this.columns,(t,i)=>{t.length!==e&&(this.columns[i]=q(t,e))})}deleteRows(e,t=1){if(t>0&&e<this.rowCount){let i=0;S(this.columns,(n,s)=>{this.columns[s]=X(n,e,t).array,i=n.length}),this.rowCount=i}b(this,"afterDeleteRows",{rowIndex:e,rowCount:t}),this.versionTag=K()}getColumn(e,t){return this.columns[e]}getColumns(e,t){return(e||Object.keys(this.columns)).reduce((e,t)=>(e[t]=this.columns[t],e),{})}getRowObject(e,t){let i={},n=this.columns;for(let s of(t??(t=Object.keys(this.columns)),t))i[s]=n[s]?.[e];return i}setColumn(e,t=[],i=0,n){this.setColumns({[e]:t},i,n)}setColumns(e,t,i){let n=this.rowCount;S(e,(e,t)=>{this.columns[t]=e.slice(),n=e.length}),this.applyRowCount(n),i?.silent||(b(this,"afterSetColumns"),this.versionTag=K())}setRow(e,t=this.rowCount,i,n){var s;let{columns:o}=this,r=i?this.rowCount+1:t+1,a=Object.keys(e);if(n?.addColumns!==!1)for(let e=0,t=a.length;e<t;e++)o[s=a[e]]||(o[s]=Array(this.rowCount));S(o,(n,s)=>{n&&(i?n=X(n,t,0,!0,[e[s]]).array:n[t]=s in e?e[s]:n[t],o[s]=n)}),this.applyRowCount(Math.max(r,this.rowCount)),n?.silent||(b(this,"afterSetRows",{rowIndex:t}),this.versionTag=K())}getModified(){return this.modified||this}},{splice:ee,setLength:et}=Y;class ei extends Q{constructor(e={}){super(e),this.metadata=e.metadata}clone(e,t){let i={};this.emit({type:"cloneTable",detail:t}),e||(i.columns=this.columns),this.autoId||(i.id=this.id);let n=new ei(i);return e||(n.versionTag=this.versionTag,n.originalRowIndexes=this.originalRowIndexes,n.localRowIndexes=this.localRowIndexes),n.metadata={...this.metadata},this.emit({type:"afterCloneTable",detail:t,tableClone:n}),n}deleteColumns(e,t){let i=this.columns,n={},s={},o=this.modifier,r=this.rowCount;if((e=e||Object.keys(i)).length){this.emit({type:"deleteColumns",columnIds:e,detail:t});for(let t=0,o=e.length,a,l;t<o;++t)(a=i[l=e[t]])&&(n[l]=a,s[l]=Array(r)),delete i[l];return Object.keys(i).length||(this.rowCount=0,this.deleteRowIndexReferences()),o&&o.modifyTable(this),this.emit({type:"afterDeleteColumns",columns:n,columnIds:e,detail:t}),n}}deleteRowIndexReferences(){delete this.originalRowIndexes,delete this.localRowIndexes}deleteRows(e,t=1,i){let n,s,{columns:o,modifier:r}=this,a=[];if(g(e)?Array.isArray(e)?s=(n=e.filter((e,t,i)=>e>=0&&e<this.rowCount&&i.indexOf(e)===t).sort((e,t)=>t-e)).length:(n=[e],s=t):(n=[0],s=this.rowCount),this.emit({type:"deleteRows",detail:i,rowCount:s,rowIndex:e??0}),s>0){let e=Object.keys(o);for(let t=0;t<e.length;++t){let i,r=e[t],l=o[r];if(1===n.length&&s>1){let e=ee(l,n[0],s);i=e.removed,o[r]=e.array}else{for(let e of(i=[],n))i.push(l[e]),ee(l,e,1);i.reverse()}t||(this.rowCount=l.length);for(let e=0,n=i.length;e<n;++e)a[e]=a[e]||[],a[e][t]=i[e]}}return r&&r.modifyTable(this),this.emit({type:"afterDeleteRows",detail:i,rowCount:s,rowIndex:e??0,rows:a}),a}emit(e){["afterDeleteColumns","afterDeleteRows","afterSetCell","afterSetColumns","afterSetRows"].includes(e.type)&&(this.versionTag=K()),b(this,e.type,e)}getCell(e,t){let i=this.columns[e];if(i)return i[t]}getColumn(e,t){return this.getColumns([e],t)[e]}getColumnIds(){return Object.keys(this.columns)}getColumns(e,t,i){let n=this.columns,s={};e=e||Object.keys(n);for(let o=0,r=e.length,a,l;o<r;++o)(a=n[l=e[o]])&&(t?s[l]=a:i&&!Array.isArray(a)?s[l]=Array.from(a):s[l]=a.slice());return s}getLocalRowIndex(e){let{localRowIndexes:t}=this;return t?t[e]:e}getModifier(){return this.modifier}getOriginalRowIndex(e){let{originalRowIndexes:t}=this;return t?t[e]:e}getRow(e,t){return this.getRows(e,1,t)[0]}getRowCount(){return this.rowCount}getRowIndexBy(e,t,i){let n=this.columns[e];if(n){let e=-1;if(Array.isArray(n)?e=n.indexOf(t,i):O(t)&&(e=n.indexOf(t,i)),-1!==e)return e}}getRowObject(e,t){return this.getRowObjects(e,1,t)[0]}getRowObjects(e=0,t=this.rowCount-e,i){let n=this.columns,s=Array(t);i=i||Object.keys(n);for(let o=e,r=0,a=Math.min(this.rowCount,e+t),l,h;o<a;++o,++r)for(let e of(h=s[r]={},i))l=n[e],h[e]=l?l[o]:void 0;return s}getRows(e=0,t=this.rowCount-e,i){let n=this.columns,s=Array(t);i=i||Object.keys(n);for(let o=e,r=0,a=Math.min(this.rowCount,e+t),l,h;o<a;++o,++r)for(let e of(h=s[r]=[],i))l=n[e],h.push(l?l[o]:void 0);return s}getVersionTag(){return this.versionTag}hasColumns(e){let t=this.columns;for(let i=0,n=e.length;i<n;++i)if(!t[e[i]])return!1;return!0}hasRowWith(e,t){let i=this.columns[e];return Array.isArray(i)?-1!==i.indexOf(t):!!(g(t)&&Number.isFinite(t))&&-1!==i.indexOf(+t)}on(e,t){return c(this,e,t)}changeColumnId(e,t){let i=this.columns;return!!i[e]&&(e!==t&&(i[t]=i[e],delete i[e]),!0)}setCell(e,t,i,n){let s=this.columns,o=this.modifier,r=s[e];r&&r[t]===i||(this.emit({type:"setCell",cellValue:i,columnId:e,detail:n,rowIndex:t}),r||(r=s[e]=Array(this.rowCount)),t>=this.rowCount&&(this.rowCount=t+1),r[t]=i,o&&o.modifyTable(this),this.emit({type:"afterSetCell",cellValue:i,columnId:e,detail:n,rowIndex:t}))}setColumns(e,t,i,n){let s=this.columns,o=this.modifier,r=Object.keys(e),a=this.rowCount;if(this.emit({type:"setColumns",columns:e,columnIds:r,detail:i,rowIndex:t}),g(t)||n){for(let i=0,o=r.length,l,h,c,d;i<o;++i){l=e[c=r[i]],d=Object.getPrototypeOf((h=s[c])&&n?h:l).constructor,h?d===Array?Array.isArray(h)||(h=Array.from(h)):h.length<a&&(h=new d(a)).set(s[c]):h=new d(a),s[c]=h;for(let e=t||0,i=l.length;e<i;++e)h[e]=l[e];a=Math.max(a,l.length)}this.applyRowCount(a)}else super.setColumns(e,t,y(i,{silent:!0}));o&&o.modifyTable(this),this.emit({type:"afterSetColumns",columns:e,columnIds:r,detail:i,rowIndex:t})}setModifier(e,t){let i=this;return i.emit({type:"setModifier",detail:t,modifier:e,modified:i.getModified()}),i.modifier=e,(e?e.modify(i):Promise.resolve(i)).then(i=>(i.emit({type:"afterSetModifier",detail:t,modifier:e,modified:i.getModified()}),i)).catch(t=>{throw i.emit({type:"setModifierError",error:t,modifier:e,modified:i.getModified()}),t})}setOriginalRowIndexes(e,t=!1){if(this.originalRowIndexes=e,t)return;let i=this.localRowIndexes=[];for(let t=0,n=e.length,s;t<n;++t)g(s=e[t])&&(i[s]=t)}setRow(e,t,i,n){this.setRows([e],t,i,n)}setRows(e,t=this.rowCount,i,n){let s=this.columns,o=Object.keys(s),r=this.modifier,a=e.length;this.emit({type:"setRows",detail:n,rowCount:a,rowIndex:t,rows:e});for(let n=0,r=t,l;n<a;++n,++r)if(0===Object.keys(l=e[n]).length)for(let e=0,t=o.length;e<t;++e){let t=s[o[e]];i?s[o[e]]=ee(t,r,0,!0,[null]).array:t[r]=null}else if(Array.isArray(l))for(let e=0,t=o.length;e<t;++e)s[o[e]][r]=l[e];else super.setRow(l,r,i,{silent:!0});let l=i?a+e.length:t+a;if(l>this.rowCount){this.rowCount=l;for(let e=0,t=o.length;e<t;++e){let t=o[e];s[t]=et(s[t],l)}}r&&r.modifyTable(this),this.emit({type:"afterSetRows",detail:n,rowCount:a,rowIndex:t,rows:e})}}class en{static registerType(e,t){return!!e&&!en.types[e]&&!!(en.types[e]=t)}get polling(){return!!this._polling}constructor(e){this.dataTables={},this.loaded=!1,this.metadata=e.metadata||{columns:{}},this.options=e;const t=e?.dataTables;let i=0;if(e.options&&console.error("The `DataConnectorOptions.options` property was removed in Dashboards v4.0.0. Check how to upgrade your connector to use the new options structure here: https://api.highcharts.com/dashboards/#interfaces/Data_DataTableOptions.DataTableOptions"),t&&t?.length>0)for(let e=0,n=t.length;e<n;++e){const n=t[e],s=n?.key;this.dataTables[s??i]=new ei(n),!s&&i++}else this.dataTables[0]=new ei({id:e.id})}getTable(e){return e?this.dataTables[e]:Object.values(this.dataTables)[0]}describeColumn(e,t){let i=this.metadata.columns;i[e]=M(i[e]||{},t)}describeColumns(e){let t,i=Object.keys(e);for(;"string"==typeof(t=i.pop());)this.describeColumn(t,e[t])}getColumnOrder(){let e=this.metadata.columns,t=Object.keys(e||{});if(t.length)return t.sort((t,i)=>A(e[t].index,0)-A(e[i].index,0))}getSortedColumns(){return this.getTable().getColumns(this.getColumnOrder())}setColumnOrder(e){for(let t=0,i=e.length;t<i;++t)this.describeColumn(e[t],{index:t})}async update(e,t=!0){this.emit({type:"beforeUpdate"}),M(!0,this.options,e);let{options:i}=this;("enablePolling"in e||"dataRefreshRate"in e)&&("enablePolling"in i&&i.enablePolling?(this.stopPolling(),this.startPolling("dataRefreshRate"in i&&"number"==typeof i.dataRefreshRate?1e3*Math.max(i.dataRefreshRate,1):1e3)):this.stopPolling()),t&&await this.load(),this.emit({type:"afterUpdate"})}load(){return this.emit({type:"afterLoad"}),Promise.resolve(this)}async applyTableModifiers(){let e=this.options?.dataTables;for(let[t,i]of Object.entries(this.dataTables)){let n=e?.find(e=>e.key===t)?.dataModifier??this.options?.dataModifier;if(!n)continue;let s=n&&U.types[n.type];await i.setModifier(s?new s(n):void 0)}return this}startPolling(e=1e3){let t=this;this.pollingController=new AbortController,window.clearTimeout(t._polling),t._polling=window.setTimeout(()=>t.load().catch(e=>t.emit({type:"loadError",error:e})).then(()=>{t._polling&&t.startPolling(e)}),e)}stopPolling(){this.polling&&(this?.pollingController?.abort(),window.clearTimeout(this._polling),delete this._polling)}emit(e){b(this,e.type,e)}on(e,t){return c(this,e,t)}initConverters(e,t,i){let n=0;for(let[s,o]of Object.entries(this.dataTables)){let r=t(s),a=i(r,e);o.deleteColumns(),o.setColumns(a),0===n&&(this.converter=r),n++}}}en.types={};let es=en;class eo extends es{constructor(e){const t=M(eo.defaultOptions,e);super(t),this.options=t,t.enablePolling&&this.startPolling(1e3*Math.max(t.dataRefreshRate||0,1))}emit(e){b(this,e.type,e)}load(e){let t=this,i=t.options,{csv:n,csvURL:s,dataTables:o,decimalPoint:r}=i;return t.emit({type:"load",csv:n}),Promise.resolve(s?fetch(s,{signal:t?.pollingController?.signal}).then(e=>e.text()):n||"").then(e=>(e&&this.initConverters(e,e=>{let{firstRowAsNames:t=i.firstRowAsNames,beforeParse:n=i.beforeParse}=o?.find(t=>t.key===e)||{};return new B(M(i,{decimalPoint:r,firstRowAsNames:t,beforeParse:n}))},(e,t)=>e.parse({csv:t})),t.applyTableModifiers().then(()=>e))).then(i=>(t.emit({type:"afterLoad",detail:e,csv:i}),t)).catch(i=>{throw t.emit({type:"loadError",detail:e,error:i}),i})}}eo.defaultOptions={id:"csv-connector",type:"CSV",csv:"",csvURL:"",enablePolling:!1,dataRefreshRate:1,firstRowAsNames:!0},es.registerType("CSV",eo);class er extends ${constructor(e){const t=M(er.defaultOptions,e);super(t),this.header=[],this.options=t}parse(e,t){let i,n=M(this.options,e),s=(n.json?.values||[]).map(e=>e.slice());if(0===s.length)return{};this.header=[],this.emit({type:"parse",columns:[],detail:t,headers:this.header});let{beforeParse:o,json:r}=n;o&&r&&(s=o(r.values));for(let e=0,t=s.length;e<t;e++){i=s[e],this.header[e]=n.firstRowAsNames?`${i.shift()}`:K();for(let t=0,n=i.length;t<n;++t){var a;let n=i[t];a=n,"[object Date]"===Object.prototype.toString.call(a)&&(n=n.getTime()),s[e][t]=n}}return this.emit({type:"afterParse",columns:s,detail:t,headers:this.header}),j(s,this.header)}}er.defaultOptions={...$.defaultOptions},$.registerType("GoogleSheets",er);class ea extends es{constructor(e){const t=M(ea.defaultOptions,e);super(t),this.options=t}emit(e){b(this,e.type,e)}load(e){let t=this,i=t.options,{dataRefreshRate:n,enablePolling:s,googleAPIKey:o,googleSpreadsheetKey:r,dataTables:a}=i,l=function(e,t,i={}){let n=new URL(`https://sheets.googleapis.com/v4/spreadsheets/${t}/values/`),s=i.onlyColumnIds?"A1:Z1":function(e={}){let{endColumn:t,endRow:i,googleSpreadsheetRange:n,startColumn:s,startRow:o}=e;return n||(el[s||0]||"A")+(Math.max(o||0,0)+1)+":"+(el[A(t,25)]||"Z")+(i?Math.max(i,0):"Z")}(i);n.pathname+=s;let o=n.searchParams;return o.set("alt","json"),i.onlyColumnIds||(o.set("dateTimeRenderOption","FORMATTED_STRING"),o.set("majorDimension","COLUMNS"),o.set("valueRenderOption","UNFORMATTED_VALUE")),o.set("prettyPrint","false"),o.set("key",e),n.href}(o,r,i);if(t.emit({type:"load",detail:e,url:l}),!URL.canParse(l))throw Error("Invalid URL: "+l);return fetch(l,{signal:t?.pollingController?.signal}).then(e=>e.json()).then(e=>{if("object"==typeof e&&e&&"object"==typeof e.error&&e.error&&"number"==typeof e.error.code&&"string"==typeof e.error.message&&"string"==typeof e.error.status)throw Error(e.error.message);return this.initConverters(e,e=>{let{firstRowAsNames:t=i.firstRowAsNames,beforeParse:n=i.beforeParse}=a?.find(t=>t.key===e)||{};return new er({firstRowAsNames:t,beforeParse:n})},(e,t)=>e.parse({json:t})),t.applyTableModifiers()}).then(()=>(t.emit({type:"afterLoad",detail:e,url:l}),s&&setTimeout(()=>t.load(),1e3*Math.max(n||0,1)),t)).catch(i=>{throw t.emit({type:"loadError",detail:e,error:i}),i})}}ea.defaultOptions={id:"google-sheets-connector",type:"GoogleSheets",googleAPIKey:"",googleSpreadsheetKey:"",enablePolling:!1,dataRefreshRate:2,firstRowAsNames:!0};let el="ABCDEFGHIJKLMNOPQRSTUVWXYZ";es.registerType("GoogleSheets",ea);class eh extends ${constructor(e){const t=M(eh.defaultOptions,e);super(t),this.headers=[],this.options=t,t.tableElement&&(this.tableElement=t.tableElement,this.tableElementID=t.tableElement.id)}export(e,t=this.options){let i=!1!==t.firstRowAsNames,n=t.useMultiLevelHeaders,s=e.getSortedColumns(),o=Object.keys(s),r=[],a=o.length,l=[],h="";if(i){let e=[];if(n){for(let t of o){let i=s[t];Array.isArray(i)||(i=Array.from(i));let n=(i.shift()||"").toString();s[t]=i,e.push(n)}h=this.getTableHeaderHTML(o,e,t)}else h=this.getTableHeaderHTML(void 0,o,t)}for(let e=0;e<a;e++){let t=s[o[e]],i=t.length;for(let n=0;n<i;n++){let i=t[n];l[n]||(l[n]=[]),"string"!=typeof i&&"number"!=typeof i&&void 0!==i&&(i=(i||"").toString()),l[n][e]=this.getCellHTMLFromValue(e?"td":"th",null,e?"":'scope="row"',i),e===a-1&&r.push("<tr>"+l[n].join("")+"</tr>")}}let c="";return t.tableCaption&&(c='<caption class="highcharts-table-caption">'+t.tableCaption+"</caption>"),"<table>"+c+h+"<tbody>"+r.join("")+"</tbody></table>"}getCellHTMLFromValue(e,t,i,n,s){let o=n,r="text"+(t?" "+t:"");return"number"==typeof o?(o=o.toString(),","===s&&(o=o.replace(".",s)),r="number"):n||(o="",r="empty"),"<"+e+(i?" "+i:"")+' class="'+r+'">'+o+"</"+e+">"}getTableHeaderHTML(e=[],t=[],i=this.options){let{useMultiLevelHeaders:n,useRowspanHeaders:s}=i,o="<thead>",r=0,a=t&&t.length,l,h=0,c;if(n&&e&&t&&!function(e,t){let i=e.length;if(t.length!==i)return!1;for(;--i;)if(e[i]!==t[i])return!1;return!0}(e,t)){for(o+="<tr>";r<a;++r)(l=e[r])===e[r+1]?++h:h?(o+=this.getCellHTMLFromValue("th","highcharts-table-topheading",'scope="col" colspan="'+(h+1)+'"',l),h=0):(l===t[r]?s?(c=2,t.splice(r,1)):(c=1,t[r]=""):c=1,o+=this.getCellHTMLFromValue("th","highcharts-table-topheading",'scope="col"'+(c>1?' valign="top" rowspan="'+c+'"':""),l));o+="</tr>"}if(t){for(o+="<tr>",r=0,a=t.length;r<a;++r)void 0!==t[r]&&(o+=this.getCellHTMLFromValue("th",null,'scope="col"',t[r]));o+="</tr>"}return o+"</thead>"}parse(e,t){let i=[],n=[],s=M(this.options,e),{endRow:o,startColumn:r,endColumn:a,firstRowAsNames:l}=s,h=s.tableElement||this.tableElement;if(!(h instanceof HTMLElement))return this.emit({type:"parseError",columns:i,detail:t,headers:n,error:"Not a valid HTML Table"}),{};this.tableElement=h,this.tableElementID=h.id,this.emit({type:"parse",columns:i,detail:t,headers:this.headers});let c=h.getElementsByTagName("tr"),d=c.length,u=0,p,{startRow:m}=s;if(l&&d){let e=c[0].children,t=e.length;for(let i=r;i<t&&!(i>a);i++)("TD"===(p=e[i]).tagName||"TH"===p.tagName)&&n.push(p.innerHTML);m++}for(;u<d;){if(u>=m&&u<=o){let e=c[u].children,t=e.length,n=0;for(;n<t;){let t=n-r,s=i[t];if(("TD"===(p=e[n]).tagName||"TH"===p.tagName)&&n>=r&&n<=a){i[t]||(i[t]=[]);let e=this.convertByType(p.innerHTML);e instanceof Date&&(e=e.getTime()),i[t][u-m]=e;let n=1;for(;u-m>=n&&void 0===s[u-m-n];)s[u-m-n]=null,n++}n++}}u++}return this.headers=n,this.emit({type:"afterParse",columns:i,detail:t,headers:n}),j(i,this.headers)}}eh.defaultOptions={...$.defaultOptions,useRowspanHeaders:!0,useMultiLevelHeaders:!0,startColumn:0,endColumn:Number.MAX_VALUE,startRow:0,endRow:Number.MAX_VALUE},$.registerType("HTMLTable",eh);let{win:ec}=a;class ed extends es{constructor(e){const t=M(ed.defaultOptions,e);super(t),this.options=t,this.converter=new eh(t)}async load(e){let t,i=this.options,n=this.converter,s=this.getTable(),o=i.htmlTable;if(this.emit({type:"load",detail:e}),"string"==typeof o?(this.tableID=o,t=ec.document.getElementById(o)):(t=o,this.tableID=t.id),this.tableElement=t||void 0,!this.tableElement){let t="HTML table not provided, or element with ID not found";return this.emit({type:"loadError",detail:e,error:t}),Promise.reject(Error(t))}let r=n.parse(M({tableElement:this.tableElement},i),e);return s.deleteColumns(),s.setColumns(r),await this.applyTableModifiers(),this.emit({type:"afterLoad",detail:e}),this}}ed.defaultOptions={id:"HTML-table-connector",type:"HTMLTable",htmlTable:""},es.registerType("HTMLTable",ed);class eu extends ${constructor(e){const t=M(eu.defaultOptions,e);super(t),this.headerColumnIds=[],this.headers=[],this.options=t}parse(e,t){let{beforeParse:i,orientation:n,firstRowAsNames:s,columnIds:o}=e=M(this.options,e),r=e.data;if(!r)return{};this.headers=[];let a=[];return this.emit({type:"parse",columns:a,detail:t,headers:this.headers}),i&&(r=i(r)),r=r.slice(),"columns"===n?this.parseColumnsOrientation(a,r,s,o):"rows"===n&&this.parseRowsOrientation(a,r,s,o),this.emit({type:"afterParse",columns:a,detail:t,headers:this.headers}),j(a,this.headers)}parseColumnsOrientation(e,t,i,n){for(let s=0,o=t.length;s<o;s++){let o=t[s];if(!Array.isArray(o))return;Array.isArray(this.headers)?(i?this.headers.push(`${o.shift()}`):n&&Array.isArray(n)&&this.headers.push(n[s]),e.push(o)):J("JSONConverter: Invalid `columnIds` option.",!1)}}parseRowsOrientation(e,t,i,n){i?this.headers=t.shift():n&&(this.headerColumnIds=n);for(let s=0,o=t.length;s<o;s++){let o=t[s];x(o)||(o=this.convertItemToRow(o,n));for(let t=0,n=o.length;t<n;t++)e.length<t+1&&e.push([]),e[t].push(o[t]),i||0!==s||(Array.isArray(this.headerColumnIds)?this.headers.push(this.headerColumnIds[t]||t.toString()):J("JSONConverter: Invalid `columnIds` option.",!1))}}convertItemToRow(e,t){let i=this;if(t&&!Array.isArray(t)){let n=[];return S(t,(t,s)=>{n.push(t.reduce((e,t)=>e[t],e)),0>i.headers.indexOf(s)&&i.headers.push(s)}),n}return i.headerColumnIds=Object.keys(e),Object.values(e)}}eu.defaultOptions={...$.defaultOptions,orientation:"rows"},$.registerType("JSON",eu);class ep extends es{constructor(e){const t=M(ep.defaultOptions,e);super(t),this.options=t,t.enablePolling&&this.startPolling(1e3*Math.max(t.dataRefreshRate||0,1))}emit(e){b(this,e.type,e)}load(e){let t=this,i=t.options,{data:n,dataUrl:s,dataTables:o}=i;return t.emit({type:"load",detail:e,data:n}),Promise.resolve(s?fetch(s,{signal:t?.pollingController?.signal}).then(e=>e.json()).catch(i=>{t.emit({type:"loadError",detail:e,error:i}),console.warn(`Unable to fetch data from ${s}.`)}):n||[]).then(async e=>(e&&this.initConverters(e,t=>{let{columnIds:n=i.columnIds,firstRowAsNames:s=i.firstRowAsNames,orientation:r=i.orientation,beforeParse:a=i.beforeParse}=o?.find(e=>e.key===t)||{};return new eu({data:e,columnIds:n,firstRowAsNames:s,orientation:r,beforeParse:a})},(e,t)=>e.parse({data:t})),t.applyTableModifiers().then(()=>e??[]))).then(i=>(t.emit({type:"afterLoad",detail:e,data:i}),t)).catch(i=>{throw t.emit({type:"loadError",detail:e,error:i}),i})}}ep.defaultOptions={type:"JSON",id:"json-connector",data:[],enablePolling:!1,dataRefreshRate:0,firstRowAsNames:!0,orientation:"rows"},es.registerType("JSON",ep);class em extends U{constructor(e,...t){super(),this.chain=t,this.options=M(em.defaultOptions,e);const i=this.options.chain||[];for(let e=0,n=i.length,s,o;e<n;++e)(s=i[e]).type&&(o=U.types[s.type])&&t.push(new o(s))}add(e,t){this.emit({type:"addModifier",detail:t,modifier:e}),this.chain.push(e),this.emit({type:"addModifier",detail:t,modifier:e})}clear(e){this.emit({type:"clearChain",detail:e}),this.chain.length=0,this.emit({type:"afterClearChain",detail:e})}async modify(e,t){let i=this.options.reverse?this.chain.slice().reverse():this.chain.slice();e.modified||(e.modified=e.clone(!1,t));let n=e;for(let s=0,o=i.length;s<o;++s){try{await i[s].modify(n,t)}catch(i){throw this.emit({type:"error",detail:t,table:e}),i}n=n.getModified()}return e.modified=n,e}modifyTable(e,t){this.emit({type:"modify",detail:t,table:e});let i=this.options.reverse?this.chain.reverse():this.chain.slice(),n=e.getModified();for(let e=0,s=i.length;e<s;++e)n=i[e].modifyTable(n,t).getModified();return e.modified=n,this.emit({type:"afterModify",detail:t,table:e}),e}remove(e,t){let i=this.chain;this.emit({type:"removeModifier",detail:t,modifier:e}),i.splice(i.indexOf(e),1),this.emit({type:"afterRemoveModifier",detail:t,modifier:e})}emit(e){b(this,e.type,e)}on(e,t){return c(this,e,t)}}em.defaultOptions={type:"Chain"},U.registerType("Chain",em);class eg extends U{constructor(e){super(),this.options=M(eg.defaultOptions,e)}modifyTable(e,t){this.emit({type:"modify",detail:t,table:e});let i=e.getModified();if(e.hasColumns(["columnIds"])){let t=(e.deleteColumns(["columnIds"])||{}).columnIds||[],n={},s=[];for(let e=0,i=t.length;e<i;++e)s.push(""+t[e]);for(let t=0,i=e.getRowCount(),o;t<i;++t)(o=e.getRow(t))&&(n[s[t]]=o);i.deleteColumns(),i.setColumns(n)}else{let t={};for(let i=0,n=e.getRowCount(),s;i<n;++i)(s=e.getRow(i))&&(t[`${i}`]=s);t.columnIds=e.getColumnIds(),i.deleteColumns(),i.setColumns(t)}return this.emit({type:"afterModify",detail:t,table:e}),e}}eg.defaultOptions={type:"Invert"},U.registerType("Invert",eg);class ef extends U{constructor(e){super(),this.options=M(ef.defaultOptions,e)}modifyTable(e,t){this.emit({type:"modify",detail:t,table:e});let{start:i,end:n}=this.options;i=Math.max(0,i||0);let s=Math.max((n=Math.min(n||1/0,e.getRowCount()))-i,0),o=e.getModified();return o.deleteRows(),o.setRows(e.getRows(i,s)),o.setOriginalRowIndexes(Array.from({length:s},(t,n)=>e.getOriginalRowIndex(i+n))),this.emit({type:"afterModify",detail:t,table:e}),e}}ef.defaultOptions={type:"Range",start:0,end:1/0},U.registerType("Range",ef);class ey extends U{static ascending(e,t){return(e||0)<(t||0)?-1:+((e||0)>(t||0))}static descending(e,t){return(t||0)<(e||0)?-1:+((t||0)>(e||0))}static compareFactory(e,t){return t?"desc"===e?(e,i)=>-t(e,i):t:"asc"===e?ey.ascending:ey.descending}constructor(e){super(),this.options=M(ey.defaultOptions,e)}getRowReferences(e){let t=e.getRows(),i=[];for(let e=0,n=t.length;e<n;++e)i.push({index:e,row:t[e]});return i}modifyTable(e,t){this.emit({type:"modify",detail:t,table:e});let i=e.getColumnIds(),n=e.getRowCount(),s=this.getRowReferences(e),{direction:o,orderInColumn:r,compare:a}=this.options,l=e.getModified(),h="columns"in this.options?this.options.columns:[this.options.orderByColumn],c=[];for(let e=0,t=h.length;e<t;++e){let t=h[e],n="string"==typeof t,s=n?t:t.column,r=i.indexOf(s);-1!==r&&c.push({columnIndex:r,compare:ey.compareFactory(n?o:t.direction||o,n?a:t.compare||a)})}if(c.length&&s.sort((e,t)=>{for(let i=0,n=c.length;i<n;++i){let{columnIndex:n,compare:s}=c[i],o=s(e.row[n],t.row[n]);if(o)return o}return e.index-t.index}),r){let e=[];for(let t=0;t<n;++t)e[s[t].index]=t;l.setColumns({[r]:e})}else{let t,i=[],o=[];for(let r=0;r<n;++r)t=s[r],i.push(e.getOriginalRowIndex(t.index)),o.push(t.row);l.setRows(o,0),l.setOriginalRowIndexes(i)}return this.emit({type:"afterModify",detail:t,table:e}),e}}ey.defaultOptions={type:"Sort",direction:"desc",orderByColumn:"y"},U.registerType("Sort",ey);class eb extends U{static compile(e){if(N(e))return e;let t=e.operator;switch(t){case"and":{let t=e.conditions.map(e=>this.compile(e));return(e,i,n)=>t.every(t=>t(e,i,n))}case"or":{let t=e.conditions.map(e=>this.compile(e));return(e,i,n)=>t.some(t=>t(e,i,n))}case"not":{let t=this.compile(e.condition);return(e,i,n)=>!t(e,i,n)}}let{columnId:i,value:n}=e;switch(t){case"==":return e=>e[i]==n;case"===":return e=>e[i]===n;case"!=":return e=>e[i]!=n;case"!==":return e=>e[i]!==n;case">":return e=>(e[i]||0)>(n||0);case">=":return e=>(e[i]||0)>=(n||0);case"<":return e=>(e[i]||0)<(n||0);case"<=":return e=>(e[i]||0)<=(n||0);case"empty":return e=>null===e[i]||""===e[i]}let{ignoreCase:s}=e,o=e=>{let t=""+e;return s??!0?t.toLowerCase():t};return"contains"===t?e=>o(e[i]).includes(o(n)):e=>o(e[i])[t](o(n))}constructor(e){super(),this.options=M(eb.defaultOptions,e)}modifyTable(e,t){this.emit({type:"modify",detail:t,table:e});let{condition:i}=this.options;if(!i)return e;let n=eb.compile(i),s=e.getModified(),o=[],r=[];for(let t=0,i=e.getRowCount();t<i;++t){let i=e.getRowObject(t);i&&n(i,e,t)&&(o.push(i),r.push(e.getOriginalRowIndex(t)))}return s.deleteRows(),s.setRows(o),s.setOriginalRowIndexes(r),this.emit({type:"afterModify",detail:t,table:e}),e}}eb.defaultOptions={type:"Filter"},U.registerType("Filter",eb);let eC={},ew=function(e){if(eC[e.$class])throw Error("A serializer for '"+e.$class+"' is already registered.");eC[e.$class]=e},ev={$class:"Data.DataTable",fromJSON:function(e){return new ei({columns:e.columns,id:e.id})},jsonSupportFor:function(e){return e instanceof ei},toJSON:function(e){let t={$class:"Data.DataTable",columns:e.getColumns(void 0,!1,!0)};return e.autoId||(t.id=e.id),t}};function eO(e,t){if("position"===e.type){for(let i,n=0,s=t.length;n<s;++n)if("position"===(i=t[n]).type&&i.state===e.state&&i.column===e.column&&i.row===e.row)return n}else{let i=JSON.stringify(e.columns);for(let n,s=0,o=t.length;s<o;++s)if("range"===(n=t[s]).type&&n.state===e.state&&n.firstRow===e.firstRow&&n.lastRow===e.lastRow&&JSON.stringify(n.columns)===i)return s}return -1}ew(ev),ew({$class:"Data.CSVConnector",fromJSON:function(e){return new eo(e.options)},jsonSupportFor:function(e){return e instanceof eo},toJSON:function(e){let t=M(e.options);return t.dataTable=ev.toJSON(e.getTable()),{$class:"Data.CSVConnector",options:t}}}),ew({$class:"Data.DataConverter",fromJSON:function(e){return new $(e.options)},jsonSupportFor:function(e){return e instanceof $},toJSON:function(e){return{$class:"Data.DataConverter",options:M(e.options)}}});let eT=class{constructor(e={}){this.emittingRegister=[],this.listenerMap={},this.stateMap=e}addListener(e,t,i){let n=this.listenerMap[e]=this.listenerMap[e]||{};return(n[t]=n[t]||[]).push(i),this}buildEmittingTag(e){return("position"===e.cursor.type?[e.table.id,e.cursor.column,e.cursor.row,e.cursor.state,e.cursor.type]:[e.table.id,e.cursor.columns,e.cursor.firstRow,e.cursor.lastRow,e.cursor.state,e.cursor.type]).join("\0")}emitCursor(e,t,i,n){let s=e.id,o=t.state,r=this.listenerMap[s]&&this.listenerMap[s][o];if(r){let o=this.stateMap[s]=this.stateMap[s]??{},a=o[t.state]||[];n&&(a.length||(o[t.state]=a),-1===eO(t,a)&&a.push(t));let l={cursor:t,cursors:a,table:e};i&&(l.event=i);let h=this.emittingRegister,c=this.buildEmittingTag(l);if(h.indexOf(c)>=0)return this;try{this.emittingRegister.push(c);for(let e=0,t=r.length;e<t;++e)r[e].call(this,l)}finally{let e=this.emittingRegister.indexOf(c);e>=0&&this.emittingRegister.splice(e,1)}}return this}remitCursor(e,t){let i=this.stateMap[e]&&this.stateMap[e][t.state];if(i){let e=eO(t,i);e>=0&&i.splice(e,1)}return this}removeListener(e,t,i){let n=this.listenerMap[e]&&this.listenerMap[e][t];if(n){let e=n.indexOf(i);e>=0&&n.splice(e,1)}return this}};ew({$class:"Data.DataCursor",fromJSON:function(e){return new eT(e.stateMap)},jsonSupportFor:function(e){return e instanceof eT},toJSON:function(e){let t,i,n,s,o,r=e.stateMap,a={},l=Object.keys(e.stateMap);for(let e=0,h=l.length;e<h;++e){o=Object.keys(r[n=l[e]]),a[n]={};for(let e=0,l=o.length;e<l;++e){s=o[e],t=r[n][s],a[n][s]=i=[];for(let e=0,n=t.length;e<n;++e)i.push({...t[e]})}}return{$class:"Data.DataCursor",stateMap:a}}}),ew({$class:"Data.GoogleSheetsConnector",fromJSON:function(e){return new ea(e.options||{googleAPIKey:"",googleSpreadsheetKey:""})},jsonSupportFor:function(e){return e instanceof ea},toJSON:function(e){let t=M(e.options);return t.dataTable=ev.toJSON(e.getTable()),{$class:"Data.GoogleSheetsConnector",options:t}}}),ew({$class:"Data.HTMLTableConnector",fromJSON:function(e){return new ed(e.options)},jsonSupportFor:function(e){return e instanceof ed},toJSON:function(e){let t=M(e.options);return t.dataTable=ev.toJSON(e.getTable()),{$class:"Data.HTMLTableConnector",options:t}}});let{SVG_NS:ex,win:eN}=a,{trustedTypes:eE}=eN,eM=eE&&N(eE.createPolicy)&&eE.createPolicy("highcharts",{createHTML:e=>e}),eS=eM?eM.createHTML(""):"";class eR{static filterUserAttributes(e){return S(e,(t,i)=>{let n=!0;-1===eR.allowedAttributes.indexOf(i)&&(n=!1),-1!==["background","dynsrc","href","lowsrc","src"].indexOf(i)&&(n=T(t)&&eR.allowedReferences.some(e=>0===t.indexOf(e))),n||(J(33,!1,void 0,{"Invalid attribute in config":`${i}`}),delete e[i]),T(t)&&e[i]&&(e[i]=t.replace(/</g,"&lt;"))}),e}static parseStyle(e){return e.split(";").reduce((e,t)=>{let i=t.split(":").map(e=>e.trim()),n=i.shift();return n&&i.length&&(e[n.replace(/-([a-z])/g,e=>e[1].toUpperCase())]=i.join(":")),e},{})}static setElementHTML(e,t){e.innerHTML=eR.emptyHTML,t&&new eR(t).addToDOM(e)}constructor(e){this.nodes="string"==typeof e?this.parseMarkup(e):e}addToDOM(e){return function e(t,i){let n;return I(t).forEach(function(t){let s,o=t.tagName,r=t.textContent?a.doc.createTextNode(t.textContent):void 0,l=eR.bypassHTMLFiltering;if(o)if("#text"===o)s=r;else if(-1!==eR.allowedTags.indexOf(o)||l){let n="svg"===o?ex:i.namespaceURI||ex,h=a.doc.createElementNS(n,o),c=t.attributes||{};S(t,function(e,t){"tagName"!==t&&"attributes"!==t&&"children"!==t&&"style"!==t&&"textContent"!==t&&(c[t]=e)}),d(h,l?c:eR.filterUserAttributes(c)),t.style&&m(h,t.style),r&&h.appendChild(r),e(t.children||[],h),s=h}else J(33,!1,void 0,{"Invalid tagName in config":o});s&&i.appendChild(s),n=s}),n}(this.nodes,e)}parseMarkup(e){let t,i=[];e=e.trim().replace(/ style=(["'])/g," data-style=$1");try{t=new DOMParser().parseFromString(eM?eM.createHTML(e):e,"text/html")}catch{}if(!t){let i=p("div");i.innerHTML=e,t={body:i}}let n=(e,t)=>{let i=e.localName||e.nodeName.toLowerCase(),s={tagName:i};"#text"===i&&(s.textContent=e.textContent||"");let o=e.attributes;if(o){let e={};[].forEach.call(o,t=>{"data-style"===t.name?s.style=eR.parseStyle(t.value):e[t.name]=t.value}),s.attributes=e}if(e.childNodes.length){let t=[];[].forEach.call(e.childNodes,e=>{n(e,t)}),t.length&&(s.children=t)}t.push(s)};return[].forEach.call(t.body.childNodes,e=>n(e,i)),i}}eR.allowedAttributes=["alt","aria-controls","aria-describedby","aria-expanded","aria-haspopup","aria-hidden","aria-label","aria-labelledby","aria-live","aria-pressed","aria-readonly","aria-roledescription","aria-selected","aria-sort","class","clip-path","color","colspan","cx","cy","d","disabled","dx","dy","fill","filterUnits","flood-color","flood-opacity","height","href","id","in","in2","markerHeight","markerWidth","offset","opacity","operator","orient","padding","paddingLeft","paddingRight","patternUnits","r","radius","refX","refY","result","role","rowspan","scope","slope","src","startOffset","stdDeviation","stop-color","stop-opacity","stroke-linecap","stroke-width","stroke","style","summary","tabindex","tableValues","target","text-align","text-anchor","textAnchor","textLength","title","type","valign","width","x","x1","x2","xlink:href","y","y1","y2","zIndex"],eR.allowedReferences=["https://","http://","mailto:","/","../","./","#"],eR.allowedTags=["#text","a","abbr","b","br","button","caption","circle","clipPath","code","dd","defs","div","dl","dt","em","feComponentTransfer","feComposite","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","filter","h1","h2","h3","h4","h5","h6","hr","i","img","li","linearGradient","marker","ol","p","path","pattern","pre","rect","small","span","stop","strong","style","sub","sup","svg","table","tbody","td","text","textPath","th","thead","title","tr","tspan","u","ul"],eR.emptyHTML=eS,eR.bypassHTMLFiltering=!1;let eA={},eP={registerComponent:function(e,t){return!!e&&!eA[e]&&!!(eA[e]=t)},types:eA},eI="highcharts-dashboards-",eL=window,eD=document,ek=function(){},eH=/(edge|msie|trident)/i.test(eL.navigator&&eL.navigator.userAgent||"")&&!eL.opera,eF=function(){let e=!1;if(!eH){let t=Object.defineProperty({},"passive",{get:function(){e=!0}});eL.addEventListener&&eL.removeEventListener&&(eL.addEventListener("testPassive",ek,t),eL.removeEventListener("testPassive",ek,t))}return e}(),ej={boards:[],classNamePrefix:eI,classNames:{layout:eI+"layout",cell:eI+"cell",cellHover:eI+"cell-state-hover",cellActive:eI+"cell-state-active",cellLoading:eI+"cell-state-loading",row:eI+"row",layoutsWrapper:eI+"layouts-wrapper",boardContainer:eI+"wrapper"},doc:eD,guiElementType:{row:"row",cell:"cell",layout:"layout"},isMS:eH,noop:ek,supportsPassiveEvents:eF,version:"4.2.1",win:eL},ez=ej.classNamePrefix+"edit-",eV={classNames:{resizeSnap:ez+"resize-snap",resizeSnapX:ez+"resize-snap-x",resizeSnapY:ez+"resize-snap-y",separator:ez+"separator",contextMenuBtn:ez+"context-menu-btn",contextMenuBtnText:ez+"context-menu-btn-text",contextMenu:ez+"context-menu",contextMenuItem:ez+"context-menu-item",editModeEnabled:ez+"enabled",editToolbar:ez+"toolbar",editToolbarCellOutline:ez+"toolbar-cell-outline",editToolbarRowOutline:ez+"toolbar-row-outline",editToolbarItem:ez+"toolbar-item",editToolbarRow:ez+"toolbar-row",editToolbarCell:ez+"toolbar-cell",editSidebar:ez+"sidebar",editSidebarShow:ez+"sidebar-show",editSidebarHide:ez+"sidebar-hide",editSidebarHeader:ez+"sidebar-header",editSidebarTitle:ez+"sidebar-title",editSidebarMenuItem:ez+"sidebar-item",rowContextHighlight:ez+"row-context-highlight",cellEditHighlight:ez+"cell-highlight",dashboardCellEditHighlightActive:ez+"cell-highlight-active",dragMock:ez+"drag-mock",dropPointer:ez+"drop-pointer",contextDetectionPointer:ez+"ctx-detection-pointer",resizePointer:ez+"resize-pointer",currentEditedElement:ez+"unmask",maskElement:ez+"mask",menuItem:ez+"menu-item",menu:ez+"menu",menuVerticalSeparator:ez+"menu-vertical-separator",menuHorizontalSeparator:ez+"menu-horizontal-separator",menuDestroy:ez+"menu-destroy",editSidebarWrapper:ez+"sidebar-wrapper",customSelect:ez+"custom-select",customSelectButton:ez+"custom-option-button",toggleContainer:ez+"toggle-container",toggleWrapper:ez+"toggle-wrapper",toggleSlider:ez+"toggle-slider",toggleWrapperColored:ez+"toggle-wrapper-colored",toggleLabels:ez+"toggle-labels",labeledToggleWrapper:ez+"labeled-toggle-wrapper",button:ez+"button",sidebarNavButton:ez+"sidebar-button-nav",labelText:ez+"label-text",editSidebarTabBtn:ez+"sidebar-tab-btn",editToolsBtn:ez+"tools-btn",editTools:ez+"tools",editGridItems:ez+"grid-items",editStandaloneToggle:ez+"standalone-toggle",confirmationPopup:ez+"confirmation-popup",popupButtonContainer:ez+"confirmation-popup-button-container",popupContentContainer:ez+"confirmation-popup-content",popupCancelBtn:ez+"confirmation-popup-cancel-btn",popupConfirmBtn:ez+"confirmation-popup-confirm-btn",popupCloseButton:ez+"popup-close",editOverlay:ez+"overlay",editOverlayActive:ez+"overlay-active",resizerMenuBtnActive:ez+"resizer-menu-btn-active",sidebarCloseButton:ez+"close-btn",editSidebarTabBtnWrapper:ez+"tabs-buttons-wrapper",editSidebarRight:ez+"sidebar-right",editSidebarRightShow:ez+"sidebar-right-show",viewFullscreen:ez+"view-fullscreen",accordionMenu:ez+"accordion-menu",accordionContainer:ez+"accordion",accordionHeader:ez+"accordion-header",accordionHeaderBtn:ez+"accordion-header-btn",accordionHeaderWrapper:ez+"accordion-header-wrapper",accordionHeaderIcon:ez+"accordion-header-icon",accordionContent:ez+"accordion-content",accordionNestedWrapper:ez+"accordion-nested",accordionMenuButtonsContainer:ez+"accordion-menu-buttons-container",accordionMenuButton:ez+"accordion-menu-button",accordionStandaloneWrapper:ez+"accordion-standalone-wrapper",hiddenElement:ez+"hidden-element",collapsableContentHeader:ez+"collapsable-content-header",standaloneElement:ez+"standalone-element",collapsedElement:ez+"collapsed-element",dropdown:ez+"dropdown",dropdownContent:ez+"dropdown-content",dropdownButton:ez+"dropdown-button",dropdownButtonContent:ez+"dropdown-button-content",dropdownIcon:ez+"pointer",icon:ez+"icon"}},e$=class{static getOffsets(e,t){let i={left:0,top:0,right:0,bottom:0};if(!e.container)return i;let n=e.container.getBoundingClientRect(),s=t?t.getBoundingClientRect():{left:0,top:0};return i.left=n.left-s.left,i.top=n.top-s.top,i.right=n.right-s.left,i.bottom=n.bottom-s.top,i}static getDimFromOffsets(e){return{width:e.right-e.left,height:e.bottom-e.top}}static getElementId(e){return ej.classNamePrefix+e+"-"+K().slice(11)}static getPercentageWidth(e){let t,i=/^(\d{1})[\-\/\.](\d{1,2})$/;if(i.test(e)){let n=e.match(i)||[];t=((t=100*n[1]/n[2])<=100?t:100)+"%"}else if(-1!==e.indexOf("%")){let i=parseFloat(e);t=(i<=100?i>=0?i:0:100)+"%"}return t}getElementContainer(e){let t,i=this;if(e.render)e.attribs&&!e.attribs.id&&delete e.attribs.id;else if("string"==typeof e.elementId){let t=document.getElementById(e.elementId);t?i.container=t:J("Element "+e.elementId+" does not exist")}return i.removeBindedEventFn=c(t=e.element instanceof HTMLElement?e.element:p("div",e.attribs||{},e.style||{},e.parentContainer),"bindedGUIElement",function(e){e.guiElement=i,e.stopImmediatePropagation()}),t}destroy(){let e=this;e.removeBindedEventFn&&e.removeBindedEventFn(),e.container&&e.container.parentNode&&e.container.parentNode.removeChild(e.container),S(e,function(t,i){delete e[i]})}getType(){return this.type}changeVisibility(e=!0,t){let i=this.isVisible&&!e||!this.isVisible&&e;this.container&&i&&(this.container.style.display=e?t||"block":"none",this.isVisible=e)}hide(){this.changeVisibility(!1)}show(){this.changeVisibility()}},eB=class extends e${constructor(e){super(),this.type="cell-html",this.options=e,this.id=e.id,this.container=e.container,this.mountedComponent=e.mountedComponent}destroy(){this.mountedComponent?.destroy(),super.destroy()}setHighlight(){this.container.classList.toggle(eV.classNames.cellEditHighlight),this.mountedComponent?.board.container.classList.toggle(eV.classNames.dashboardCellEditHighlightActive)}setActiveState(){this.container&&this.container.classList.add(ej.classNames.cellActive)}};function eG(e,t){let i;"string"==typeof e&&document.querySelectorAll("#"+e).length>1&&console.warn(`Multiple cells have identical ID %c${e}%c, potentially leading to unexpected behavior. 
Ensure that each cell has a unique ID on the page.`,"font-weight: bold","");let n=t?t.querySelector("#"+e):document.getElementById(e);return null!==n&&b(n,"bindedGUIElement",{},function(e){i=e.guiElement}),i}let eU={addComponent:async function e(e,t,i){let n=e.states,s=e.events,o=e.renderTo;if(!o)return void console.error("The%c renderTo%c option is required to render the component.","font-weight: bold","");if(t.mountedComponents.filter(e=>e.options.renderTo===o).length>0)return void console.error(`A component has already been declared in the cell %c${o}%c use a different cell.`,"font-weight: bold","");i=i||eU.getCell(o,t.container);let r=i?.container||document.querySelector("#"+o);if(!r||!e.type)return void console.error(`The component is unable to find the HTML cell element %c${o}%c to render the content.`,"font-weight: bold","");let a=eP.types[e.type];!a&&(console.error(`The component's type %c${e.type}%c does not exist.`,"font-weight: bold",""),i&&(a=eP.types.HTML,e.title={text:t.editMode?.lang.errorMessage||"Something went wrong",className:ej.classNamePrefix+"component-title-error "+ej.classNamePrefix+"component-title"}));let l=new a(i,e,t),h=l.load().catch(e=>(console.error(e),l.update({connector:{id:""},title:{text:t.editMode?.lang.errorMessage||"Something went wrong",className:ej.classNamePrefix+"component-title-error "+ej.classNamePrefix+"component-title"}})));return i&&(l.setCell(i),i.mountedComponent=l),t.mountedComponents.push({options:e,component:l,cell:i||new eB({id:o,container:r,mountedComponent:l})}),i&&n?.active?.enabled&&n?.active?.isActive&&(i.setActiveState(),l.isActive=!0),b(l,"mount"),c(r,"click",()=>{s&&s.click&&s.click.call(l),i&&l&&r&&n?.active?.enabled&&(i.setActiveState(),l.isActive=!0)}),n?.hover?.enabled&&r.classList.add(ej.classNames.cellHover),b(l,"afterLoad"),h},getCell:function(e,t){let i=eG(e,t);if(i&&"cell"===i.getType())return i}},eY=class{constructor(e){this.board=e,this.addTabIndexToCells()}addTabIndexToCells(){let e,t=this.board.mountedComponents;for(let i=0,n=t.length;i<n;++i)(e=t[i].cell)&&e.container&&e.container.setAttribute("tabindex",-1)}};class e_{constructor(e){this.options=M(e_.defaultOptions,e),this.connectors={},this.waiting={}}emit(e){b(this,e.type,e)}getConnector(e){let t=this.connectors[e];if(t?.loaded)return Promise.resolve(t);let i=this.waiting[e];if(!i){i=this.waiting[e]=[];let t=this.getConnectorOptions(e);if(!t)throw Error(`Connector '${e}' not found.`);this.loadConnector(t).then(t=>{delete this.waiting[e];for(let e=0,n=i.length;e<n;++e)i[e][0](t)}).catch(t=>{delete this.waiting[e];for(let e=0,n=i.length;e<n;++e)i[e][1](t)})}return new Promise((e,t)=>{i.push([e,t])})}getConnectorIds(){let e=this.options.connectors,t=[];for(let i=0,n=e.length;i<n;++i)t.push(e[i].id);return t}getConnectorOptions(e){let t=this.options.connectors;for(let i=0,n=t.length;i<n;++i)if(t[i].id===e)return t[i]}isNewConnector(e){return!this.connectors[e]}loadConnector(e){return new Promise((t,i)=>{this.emit({type:"load",options:e});let n=es.types[e.type];if(!n)throw Error(`Connector type not found. (${e.type})`);let s=this.connectors[e.id]=new n(e);s.load().then(({converter:i})=>{s.converter=i,s.loaded=!0,this.emit({type:"afterLoad",options:e}),t(s)}).catch(i)})}cancelPendingRequests(){let{connectors:e}=this;for(let t of Object.keys(e))e[t].stopPolling()}on(e,t){return c(this,e,t)}async setConnectorOptions(e,t){let i=this.options.connectors,n=this.connectors;this.emit({type:"setConnectorOptions",options:e});for(let t=0,n=i.length;t<n;++t)if(i[t].id===e.id){i.splice(t,1);break}let s=n[e.id];s&&(t?await s.update(e,!0):(s.stopPolling(),s=void 0,delete n[e.id])),s||i.push(e),this.emit({type:"afterSetConnectorOptions",options:e})}}e_.defaultOptions={connectors:[]};let eW={gui:{enabled:!0,layoutOptions:{rowClassName:void 0,cellClassName:void 0},layouts:[]},components:[]};function eJ(e){return!!e&&"row"in e&&"cell"===e.type}let eZ=class extends e${constructor(e,t,i){super(),this.type=ej.guiElementType.cell,this.id=t.id,this.options=t,this.row=e,this.isVisible=!0;const n=document.getElementById(t.parentContainerId||"")||e.container,s=e.layout.options||{},o=e.options||{},r=s.cellClassName||"",a=t.style||{},l=M(s.style,o.style,a);this.applySizeOptions(t,a,l),this.container=this.getElementContainer({render:e.layout.board.guiEnabled,parentContainer:n,attribs:{id:t.id,className:ej.classNames.cell+" "+r},element:i,elementId:t.id,style:l}),this.options.layout&&this.setNestedLayout()}setNestedLayout(){let e=this.row.layout.board,t=this.row.layout.constructor,i=e.options.gui;this.nestedLayout=new t(e,M({},i&&i.layoutOptions,this.options.layout,{parentContainerId:this.options.id}),this)}destroy(){b(this,"outdate");let{row:e}=this;this.mountedComponent?.destroy(),this.nestedLayout?.destroy(),e.unmountCell(this);let t=e.cells?.length===0;super.destroy(),t&&e.destroy()}getOptions(){return this.options.layout&&this.nestedLayout?{...this.options,layout:this.nestedLayout.getOptions()}:this.options}changeVisibility(e=!0){super.changeVisibility(e);let t=this,i=t.row;t.row.getVisibleCells().length?t.isVisible&&!i.isVisible&&t.row.show():t.row.hide(),setTimeout(()=>{b(i,"cellChange",{row:i,cell:t})},0)}getParentCell(e){let t;if(e<=this.row.layout.level){if(this.row.layout.level===e)return this;if(this.row.layout.level-1>=0&&(t=this.row.layout.parentCell))return t.getParentCell(e)}}getOverlappingLevels(e,t,i){let n=this.row.layout.parentCell,s=[this.row.layout.level];if(n){let o=i||e$.getOffsets(this)[e],r=e$.getOffsets(n)[e];Math.abs(o-r)<t&&(s=[...s,...n.getOverlappingLevels(e,t,r)])}return s}setSize(e,t){let i=this.row.layout.board.editMode;if(this.container){if(g(e))if("auto"===e&&"1 1 0%"!==this.container.style.flex)this.container.style.flex="1 1 0%",this.options.width=this.container.style.flex;else{let t=this.convertWidthToValue(e);t&&(this.container.style.flex="0 0 "+t,this.options.width=this.container.style.flex)}if(g(t)){let e="number"==typeof t?t+"px":t;this.height=this.container.style.height=e,this.options.height=e}i&&(i.hideContextPointer(),i.cellToolbar&&i.cellToolbar.isVisible&&(i.cellToolbar.cell===this?i.cellToolbar.showToolbar(this):i.cellToolbar.hide())),b(this.row.layout.board,"cellResize",{cell:this}),b(this.row,"cellChange",{cell:this,row:this.row})}}setHighlight(e){let t=this.row?.layout.board.editMode;if(this.container&&t){let t=this.container,i=t.classList.contains(eV.classNames.cellEditHighlight);e||i?e&&i&&(t.classList.remove(eV.classNames.cellEditHighlight),this.row.layout.board.container.classList.remove(eV.classNames.dashboardCellEditHighlightActive),this.isHighlighted=!1):(t.classList.add(eV.classNames.cellEditHighlight),this.row.layout.board.container.classList.add(eV.classNames.dashboardCellEditHighlightActive),this.isHighlighted=!0)}}setActiveState(){this.row.layout.board.mountedComponents.forEach(e=>{e.cell.container&&e.cell.container.classList.remove(ej.classNames.cellActive),e.component.isActive=!1}),this.container&&this.container.classList.add(ej.classNames.cellActive)}setLoadingState(e=!0){this.container?.classList?.toggle(ej.classNames.cellLoading,e)}convertWidthToValue(e){return"number"==typeof e?e+"px":/px/.test(e)?e:e$.getPercentageWidth(e)||""}applySizeOptions(e,t,i){let n=g(e.height)?e.height:t.height;g(n)?(this.height="number"==typeof n?n+"px":String(n),i.height=this.height,e.height=this.height):g(i.height)&&delete i.height;let s=g(e.width)?e.width:t.flex;if(g(s)&&("string"==typeof s||"number"==typeof s)){let t;if("string"==typeof s&&-1!==s.indexOf(" "))t=s;else if("auto"===s)t="1 1 0%";else{let e=this.convertWidthToValue(s);e&&(t="0 0 "+e)}t&&(i.flex=t,e.width=t)}}};class eK extends e${static setContainerHeight(e,t){t&&(e.style.height=t+"px")}constructor(e,t,i){super(),this.type=ej.guiElementType.row,this.layout=e,this.cells=[],this.options=t,this.isVisible=!0;const n=document.getElementById(t.parentContainerId||"")||e.container,s=e.options||{},o=s.rowClassName||"";this.container=this.getElementContainer({render:e.board.guiEnabled,parentContainer:n,attribs:{id:t.id,className:ej.classNames.row+" "+o},element:i,elementId:t.id,style:M(s.style,t.style)}),this.options.cells&&this.setCells()}setCells(){let e,t,i,n=(this.layout.options||{}).cellClassName||"",s=A(this.options.cells,this.container&&this.container.getElementsByClassName(n))||[];for(t=0,i=s.length;t<i;++t)e=s[t],this.addCell(this.layout.board.guiEnabled?e:{id:""},e instanceof HTMLElement?e:void 0)}addCell(e,t,i){let n=new eZ(this,e,t);return g(i)?this.mountCell(n,i):this.cells.push(n),this.layout.board.editMode&&this.layout.board.editMode.setCellEvents(n),n}destroy(){let{layout:e}=this,t=this.layout.board,i=t.editMode;if(this.cells){let e=[...this.cells];for(let t=0,i=e.length;t<i;++t)e[t]&&e[t].destroy()}this.layout&&(this.layout.unmountRow(this),super.destroy(),e.rows?.length===0&&e.destroy()),b(i,"rowDestroyed",{target:this,board:t})}getOptions(){let e=[];for(let t=0,i=this.cells.length;t<i;++t)e.push(this.cells[t].getOptions());return{id:this.options.id,style:this.options.style,cells:e}}setSize(e){eK.setContainerHeight(this.container,e)}getCellIndex(e){for(let t=0,i=this.cells?.length;t<i;++t)if(this.cells[t].id===e.id)return t}mountCell(e,t=0){let i=this,n=i.cells[t],s=i.cells[t-1];e.container&&(n&&n.container?n.container.parentNode.insertBefore(e.container,n.container):s&&s.container?s.container.parentNode.insertBefore(e.container,s.container.nextSibling):s||n||!i.container||i.container.appendChild(e.container),i.cells.splice(t,0,e),e.row=i,setTimeout(()=>{b(i,"cellChange",{row:i,cell:e})},0))}unmountCell(e){let t=this.getCellIndex(e);g(t)&&this.cells.splice(t,1),setTimeout(()=>{b(this,"cellChange",{row:this,cell:e})},0)}getVisibleCells(){let e=[];for(let t=0,i=this.cells.length;t<i;++t)this.cells[t].isVisible&&e.push(this.cells[t]);return e}changeVisibility(e=!0,t){super.changeVisibility(e,t),this.layout.getVisibleRows().length?this.isVisible&&!this.layout.isVisible&&this.layout.show():this.layout.hide()}show(){this.changeVisibility(!0,"flex")}setHighlight(e){let t=this.container.classList,i=eV.classNames.rowContextHighlight;!0===e?t.remove(i):t.toggle(i,!e)}getRowLevels(){let e,t,i={},n=[];for(let n=0,s=this.cells.length;n<s;++n)(e=this.cells[n]).isVisible&&(i[(t=e$.getOffsets(e)).top]||(i[t.top]={top:t.top,bottom:t.bottom,cells:[]}),i[t.top].bottom<t.bottom&&(i[t.top].bottom=t.bottom),i[t.top].cells.push(e));return S(i,e=>{n.push(e)}),n}getRowLevelInfo(e){let t,i=this.getRowLevels();for(let n=0,s=i.length;n<s;++n)i[n].top<=e&&i[n].bottom>e&&(t={index:n,rowLevels:i,rowLevel:i[n]});return t}}let eq=class extends e${constructor(e,t,i){super(),this.type=ej.guiElementType.layout,this.board=e,this.rows=[],this.options=t,this.isVisible=!0;const n=i?i.container:document.getElementById(t.parentContainerId||"")||e.layoutsWrapper;i?(this.parentCell=i,this.level=i.row.layout.level+1):this.level=0,t.copyId&&(this.copyId=t.copyId);const s=(this.options||{}).rowClassName||"";this.container=this.getElementContainer({render:e.guiEnabled,parentContainer:n,attribs:{id:(t.id||"")+(this.copyId?"_"+this.copyId:""),className:ej.classNames.layout+" "+s},elementId:t.id,style:this.options.style}),this.options.rows&&this.setRows()}setRows(){let e,t,i,n=A(this.options.rows,this.container&&this.container.getElementsByClassName(this.options.rowClassName||""))||[];for(t=0,i=n.length;t<i;++t)e=n[t],this.addRow(this.board.guiEnabled?e:{},e instanceof HTMLElement?e:void 0)}addRow(e,t,i){let n=new eK(this,e,t);return g(i)?this.mountRow(n,i):this.rows.push(n),this.board.editMode&&this.board.editMode.setRowEvents(n),n}destroy(){for(let e=this.board.layouts.length-1;e>=0;e--)this.board.layouts[e]===this&&this.board.layouts.splice(e,1);this.parentCell&&delete this.parentCell.nestedLayout;for(let e=this.rows.length-1;e>=0;e--)this.rows[e].destroy();this.parentCell&&this.parentCell.destroy(),super.destroy()}getRowIndex(e){for(let t=0,i=this.rows.length;t<i;++t)if(this.rows[t]===e)return t}mountRow(e,t){let i=this.rows[t],n=this.rows[t-1];e.container&&(i&&i.container?i.container.parentNode.insertBefore(e.container,i.container):n&&n.container&&n.container.parentNode.insertBefore(e.container,n.container.nextSibling),this.rows.splice(t,0,e),e.layout=this)}unmountRow(e){let t=this.getRowIndex(e);g(t)&&this.rows.splice(t,1)}getVisibleRows(){let e=[];for(let t=0,i=this.rows.length;t<i;++t)this.rows[t].isVisible&&e.push(this.rows[t]);return e}changeVisibility(e=!0){super.changeVisibility(e),this.parentCell&&(this.isVisible&&!this.parentCell.isVisible?this.parentCell.show():!this.isVisible&&this.parentCell.isVisible&&this.parentCell.hide())}getOptions(){let e=[];for(let t=0,i=this.rows.length;t<i;++t)e.push(this.rows[t].getOptions());return{id:this.options.id,layoutClassName:this.options.layoutClassName,rowClassName:this.options.rowClassName,cellClassName:this.options.cellClassName,style:this.options.style,rows:e}}},eX=class{constructor(){this.registry={}}addCallback(e,t){this.registry[e]=t}getCallback(e){return this.registry[e]}toJSON(){let e={};return Object.keys(this.registry).forEach(t=>{let{func:i,type:n}=this.getCallback(t);e[t]={func:i.toString(),type:n}}),e}},eQ=class{constructor(e,t){this.tableEvents=[],this.component=e,this.options=t}async initConnector(){let e=this.component,t=this.options.id,i=this.component.board.dataPool;if(t&&(this.connectorId!==t||i.isNewConnector(t))){eJ(e.cell)&&e.cell.setLoadingState();let n=await i.getConnector(t);this.destroyed||this.setConnector(n)}return e}setTable(e){this.clearTableListeners(e),this.setupTableListeners(e),e.on("setModifier",()=>this.clearTableListeners(e)),e.on("afterSetModifier",e=>{"afterSetModifier"===e.type&&e.modified&&(this.setupTableListeners(e.modified),this.component.emit({type:"tableChanged",connector:this.connector}))}),this.dataTable=e}setConnector(e){for(;this.tableEvents.length;){let e=this.tableEvents.pop();"function"==typeof e&&e()}return this.connector=e,e&&this.setTable(e.getTable(this.options.dataTableKey)),this.addConnectorAssignment(),this.component}setupTableListeners(e){let t=this.connector;t&&e&&["afterDeleteRows","afterSetCell","afterSetColumns","afterSetRows"].forEach(i=>{this.tableEvents.push(e.on(i,e=>{clearTimeout(this.tableEventTimeout),this.tableEventTimeout=ej.win.setTimeout(()=>{this.component.emit({...e,type:"tableChanged",targetConnector:t}),this.tableEventTimeout=void 0})}))})}clearTableListeners(e){let t=this.connector,i=this.tableEvents;this.removeTableEvents(),t&&i.push(e.on("afterSetModifier",e=>{"afterSetModifier"===e.type&&(clearTimeout(this.tableEventTimeout),this.tableEventTimeout=ej.win.setTimeout(()=>{this.component.emit({...e,type:"tableChanged",targetConnector:t}),this.tableEventTimeout=void 0}))}))}addConnectorAssignment(){let{connector:e}=this;if(e&&(e.components||(e.components=[]),!e.components.includes(this.component))){let t=e.options;e.components.push(this.component),"enablePolling"in t&&t.enablePolling&&!e.polling&&1===e.components.length&&"dataRefreshRate"in t&&e.startPolling(1e3*Math.max(t.dataRefreshRate||0,1))}}removeConnectorAssignment(){let{connector:e}=this;if(!e?.components)return;let t=e.components.indexOf(this.component);t>-1&&(e.components.splice(t,1),e.components.length||(e.stopPolling(),delete e.components))}removeTableEvents(){this.tableEvents.forEach(e=>e()),this.tableEvents.length=0}updateOptions(e){this.options=e}destroy(){this.destroyed=!0,this.removeConnectorAssignment(),this.removeTableEvents()}};class e0{constructor(e,t=e0.defaultBindings){this.component=e,this.bindings=t}getOptions(){let e=this.component.options.editableOptions;if(!e)return[];for(let t=0,i=e.length;t<i;t++){let i=e[t];if(i.propertyPath?.some(e=>"connector"===e)){let e=this.component.board;i.selectOptions=e?e.dataPool.getConnectorIds().map(e=>({name:e})):[]}}return e}}e0.defaultBindings={keyMap:{color:"colorPicker",title:"text",caption:"text",style:"textarea"},typeMap:{string:"text",number:"input",boolean:"toggle"},skipRedraw:[]},e0.defaultTypeMap={string:"text",number:"input",boolean:"toggle"};class e1{static register(e){let{id:t}=e;this.registry[t]=e}static get(e){return this.registry[e]}constructor(e,t){this.id=e,this.func=t,e1.register(this)}create(e){this.callback=this.func.call(e)}remove(){this.callback&&this.callback()}}e1.registry={};class e2{static register(e){let{id:t}=e;this.registry[t]=e}static get(e){return this.registry[e]}constructor(e,t){this.id=e,this.func=t,e2.register(this)}register(e){let{func:t}=this;this.callback=t.call(e)}remove(){this.callback&&this.callback()}}e2.registry={};class e3{constructor(e,t){this.component=e,this.predefinedSyncConfig=t,this.syncConfig=e3.prepareSyncConfig(t,e.options.sync),this.registeredSyncHandlers={},this.registeredSyncEmitters={},this.isSyncing=!1,this.listeners=[]}static prepareSyncConfig(e,t={}){let{defaultSyncPairs:i,defaultSyncOptions:n}=e;return Object.keys(t).reduce((e,s)=>{if(s){let o=i[s],r=n[s],a=t[s],l=M(r||{},{enabled:E(a)?a.enabled:a},E(a)?a:{});if(o&&l.enabled)for(let e of["emitter","handler"])(!0===l[e]||void 0===l[e])&&(l[e]=o[e]);e[s]=l}return e},{})}registerSyncEmitter(e){let{id:t}=e;this.registeredSyncEmitters[t]=e}isRegisteredEmitter(e){return!!this.registeredSyncEmitters[e]}registerSyncHandler(e){let{id:t}=e;this.registeredSyncHandlers[t]=e}isRegisteredHandler(e){return!!this.registeredSyncHandlers[e]}start(){let{component:e}=this;for(let t of(this.syncConfig=e3.prepareSyncConfig(this.predefinedSyncConfig,e.options.sync),Object.keys(this.syncConfig))){let i=this.syncConfig[t];if(!i)continue;let{emitter:n,handler:s}=i;if(s){!0===s&&(s=e3.defaultHandlers[t].handler);let i=new e2(t,s);this.isRegisteredHandler(i.id)||(this.registerSyncHandler(i),i.register(e))}if(n){!0===n&&(n=e3.defaultHandlers[t].emitter);let i=new e1(t,n);this.isRegisteredEmitter(i.id)||(this.registerSyncEmitter(i),i.create(e))}}this.isSyncing=!0,this.listeners.push(e.on("update",()=>this.stop()))}stop(){let{component:e,listeners:t,registeredSyncHandlers:i,registeredSyncEmitters:n}=this;Object.keys(i).forEach(e=>{i[e].remove(),delete i[e]}),Object.keys(n).forEach(e=>{n[e].remove(),delete n[e]}),this.isSyncing=!1;for(let e=0,i=t.length;e<i;++e)t[e]();this.listeners.length=0,this.listeners.push(e.on("afterUpdate",()=>{this.start()}))}}function e4(e,t){let i=window.getComputedStyle(e);return t.map(e=>i[e])}function e5(e,t){return t&&(e+="number"==typeof t?t:parseFloat(t)),e}e3.defaultHandlers={};let e6={deepClone:function e(t,i){if(Array.isArray(t))return t.map(t=>e(t,i));if(t&&"object"==typeof t){let n={};for(let s of Object.keys(t))i&&i.includes(s)?n[s]=t[s]:n[s]=e(t[s],i);return n}return t},error:function(e,t){16===e?console.warn("Dashboard error: Dashboards library loaded more than once.This may cause undefined behavior."):J(e,t)}},{classNamePrefix:e8}=ej,{getMargins:e9,getPaddings:e7}={getMargins:function(e,t=!0){return{y:e4(e,["marginTop","marginBottom",...t?["borderTop","borderBottom"]:[]]).reduce(e5,0),x:e4(e,["marginLeft","marginTop",...t?["borderLeft","borderRight"]:[]]).reduce(e5,0)}},getPaddings:function(e){return{x:e4(e,["paddingLeft","paddingRight"]).reduce(e5,0),y:e4(e,["paddingTop","paddingBottom"]).reduce(e5,0)}},getStyles:e4,sumPixels:e5},{deepClone:te}=e6;class tt{static createTextElement(e,t,i){if("object"==typeof i){let{className:n,text:s,style:o}=i;return p(e,{className:n||`${e8}component-${t}`,textContent:s},o)}if("string"==typeof i)return p(e,{className:`${e8}component-${t}`,textContent:i},{})}constructor(e,t,i){this.connectorHandlers=[],this.callbackRegistry=new eX,this.cellListeners=[],this.resizeTimeouts=[],this.innerResizeTimeouts=[];const n=t.renderTo;if(this.board=i||e?.row?.layout?.board||{},this.parentElement=e?.container||document.querySelector("#"+n),this.cell=e,this.options=M(tt.defaultOptions,t),this.id=this.options.id&&this.options.id.length?this.options.id:K(),this.options.connector)for(const e of x(this.options.connector)?this.options.connector:[this.options.connector])this.connectorHandlers.push(new eQ(this,e));this.editableOptions=new e0(this,t.editableOptionsBindings),this.dimensions={width:null,height:null},this.element=p("div",{className:this.options.className},{},this.parentElement),Number(C(this.element,"padding"))||(this.element.style.padding="0.1px"),this.contentElement=p("div",{className:`${this.options.className}-content`},{},this.element,!0),this.sync=new e3(this,this.constructor.predefinedSyncConfig),this.setupEventListeners(),e&&(this.attachCellListeners(),this.on("update",()=>{eJ(this.cell)&&this.cell.setLoadingState()}),this.on("afterRender",()=>{eJ(this.cell)&&this.cell.setLoadingState(!1)})),this.on("tableChanged",()=>{this.onTableChanged()})}getOptionsOnDrop(e){return{}}getFirstConnector(){return this.connectorHandlers[0]?.connector}getDataTable(e,t){for(let i of this.connectorHandlers)if((!e||i.options.id===e)&&(!t||i.options.dataTableKey===t))return i.dataTable}attachCellListeners(){for(;this.cellListeners.length;){let e=this.cellListeners.pop();e&&e()}if(this.cell&&eJ(this.cell)&&Object.keys(this.cell).length){let e=this.cell.row.layout.board;this.cellListeners.push(c(e,"cellResize",()=>{this.resizeTo(this.parentElement)}),c(this.cell.row,"cellChange",e=>{let{row:t}=e;t&&this.cell&&void 0===t.getCellIndex(this.cell)&&this.cell&&this.setCell(this.cell)}))}}setCell(e,t=!1){this.cell=e,e.container&&(this.parentElement=e.container),this.attachCellListeners(),t&&this.resizeTo(this.parentElement)}async initConnectors(){for(let e of(b(this,"setConnectors",{connectorHandlers:this.connectorHandlers}),this.connectorHandlers))await e.initConnector();return b(this,"afterSetConnectors",{connectorHandlers:this.connectorHandlers}),this}getContentHeight(){return(this.titleElement?this.titleElement.clientHeight+e9(this.titleElement).y:0)+(this.captionElement?this.captionElement.clientHeight+e9(this.captionElement).y:0)}resize(e,t){if(t){let e=e7(this.element).y+e9(this.element).y;this.element.style.height="calc(100% - "+e+"px)",this.contentElement.style.height="calc(100% - "+this.getContentHeight()+"px)"}else null===t&&(this.dimensions.height=null,this.element.style.removeProperty("height"));b(this,"resize",{width:e,height:t})}resizeDynamicContent(e,t){let{element:i}=this;if(t){let e=e9(i).y,n=e7(i).y;"string"==typeof t&&(t=parseFloat(t)),t=Math.round(t),i.style.height=`${t-e-n}px`,this.contentElement.style.height=`${i.clientHeight-this.getContentHeight()-n}px`}else null===t&&(this.dimensions.height=null,i.style.removeProperty("height"));b(this,"resize",{width:e,height:t})}resizeTo(e){for(;this.resizeTimeouts.length;){let e=this.resizeTimeouts.pop();e&&cancelAnimationFrame(e)}let t=requestAnimationFrame(()=>{let{width:t,height:i}=e.getBoundingClientRect(),n=e7(e),s=e9(e);this.resize(t-n.x-s.x,i-n.y-s.y)});this.resizeTimeouts.push(t)}async update(e,t=!0){let i={options:e,shouldForceRerender:!1};b(this,"update",i),e.connector&&Array.isArray(this.options.connector)&&(this.options.connector=void 0),this.options=M(this.options,e);let n=this.options.connector?x(this.options.connector)?this.options.connector:[this.options.connector]:[],s=n.length!==this.connectorHandlers.length;if(!s)for(let e=0,t=n.length;e<t;e++){let t=this.connectorHandlers[e]?.options,i=n[e];if(t.id!==i.id||t.dataTableKey!==i.dataTableKey){s=!0;break}this.connectorHandlers[e].updateOptions(i)}if(s){for(let e of this.connectorHandlers)e.destroy();for(let e of(this.connectorHandlers.length=0,n))this.connectorHandlers.push(new eQ(this,e));await this.initConnectors()}(t||i.shouldForceRerender)&&this.render()}setupEventListeners(){let e=this.options.events;e&&(Object.keys(e).forEach(t=>{let i=e[t];i&&this.callbackRegistry.addCallback(t,{type:"component",func:i})}),S(e,(e,t)=>{N(e)&&this.on(t,e)}));let t=()=>{this.resizeTo(this.parentElement)};if("function"==typeof ResizeObserver)this.resizeObserver=new ResizeObserver(t),this.resizeObserver.observe(this.element);else{let e=c(window,"resize",t);c(this,"destroy",e)}}setTitle(e){let t=this.titleElement;if(e&&("string"==typeof e||e.text)){let i=tt.createTextElement("h2","title",e);i&&(t?t.replaceWith(i):this.element.insertBefore(i,this.element.firstChild),this.titleElement=i)}else if(t){t.remove(),delete this.titleElement;return}}setCaption(e){let t=this.captionElement;if(e&&("string"==typeof e||e.text)){let i=tt.createTextElement("div","caption",e);i&&(t?t.replaceWith(i):this.element.appendChild(i),this.captionElement=i)}else if(t){t.remove(),delete this.captionElement;return}}async load(){return await this.initConnectors(),this.render(),this}render(){return this.emit({type:"render"}),this.setTitle(this.options.title),this.setCaption(this.options.caption),this.resizeTo(this.parentElement),this}destroy(){for(this.sync.isSyncing&&this.sync.stop();this.element.firstChild;)this.element.firstChild.remove();for(let e of(b(this,"unmount"),this.connectorHandlers))e.destroy();P(this),this.element.remove()}on(e,t){return c(this,e,t)}emit(e){e.target||(e.target=this),b(this,e.type,e)}getOptions(){return f(this.options,tt.defaultOptions)}getEditableOptions(){return te(this.options,["dataTable","points","series","data","editableOptions"])}getEditableOptionValue(e){if(!e)return;let t=this.getEditableOptions();for(let i=0,n=e.length;i<n;i++){if(x(t)&&"connector"===e[0]&&t.length>1)return"multiple connectors";if(!t)return;!1===(t=t[e[i]])&&(e.indexOf("title")>=0||e.indexOf("subtitle")>=0||e.indexOf("caption")>=0)&&(t="")}return t}}tt.Sync=e3,tt.predefinedSyncConfig={defaultSyncOptions:{},defaultSyncPairs:{}},tt.defaultOptions={className:`${e8}component`,id:"",title:!1,caption:!1,sync:e3.defaultHandlers,editableOptions:[{name:"title",propertyPath:["title"],type:"input"},{name:"caption",propertyPath:["caption"],type:"input"}]};let ti=tt,tn={type:"HTML",className:[ti.defaultOptions.className,`${ti.defaultOptions.className}-html`].join(" "),elements:[],editableOptions:[...ti.defaultOptions.editableOptions||[],{name:"htmlInput",propertyPath:["html"],type:"textarea"}]},{deepClone:ts}=e6;eR.allowedTags=[...eR.allowedTags,"option","select","label","input","textarea"],eR.allowedAttributes=[...eR.allowedAttributes,"for","value","checked","src","name","selected"],eR.allowedReferences=[...eR.allowedReferences,"data:image/"];class to extends ti{constructor(e,t){t.className&&(t.className=`${to.defaultOptions.className} ${t.className}`),super(e,t=M(to.defaultOptions,t)),this.options=t,this.type="HTML",this.elements=[]}async load(){this.emit({type:"load"}),await super.load();let e=this.options,t=!1;if(e.elements?.length?this.elements=e.elements.map(function(e){return"string"==typeof e?new eR(e).nodes[0]:(e.textContent||e.tagName||!e.attributes||(t=!0),e)}):e.html&&(this.elements=this.getElementsFromString(e.html),this.options.elements=this.elements),this.constructTree(),this.emit({type:"afterLoad"}),t)throw Error(`Missing tagName param in component: ${e.renderTo}`);return this}render(){return super.render(),this.constructTree(),this.sync.start(),this.emit({type:"afterRender"}),this}resize(e,t){return super.resize(e,t),this}async update(e,t=!0){e.html?(this.elements=this.getElementsFromString(e.html),this.options.elements=this.elements,this.constructTree()):e.elements&&(this.elements=e.elements),await super.update(e,t),this.emit({type:"afterUpdate"})}getOptionsOnDrop(){return{type:"HTML",elements:[{tagName:"span",textContent:"[Your custom HTML here- edit the component]"}]}}constructTree(){for(;this.contentElement.firstChild;)this.contentElement.firstChild.remove();new eR(this.options.elements||[]).addToDOM(this.contentElement)}getElementsFromString(e){return new eR(e).nodes}getOptions(){return{...f(this.options,to.defaultOptions),type:"HTML"}}getEditableOptions(){return ts(this.options,["editableOptions"])}getEditableOptionValue(e){if(e){if("html"===e[0]){let t=this.getEditableOptions();return!t.html&&t.elements?this.getStringFromElements(t.elements):t[e[0]]}return super.getEditableOptionValue(e)}}getStringFromElements(e){let t="";for(let i of e)t+=this.serializeNode(i);return t}serializeNode(e){if(!e.tagName||"#text"===e.tagName)return e.textContent||"";let t=e.attributes,i=`<${e.tagName}`;if(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let n=t[e];void 0!==n&&(i+=` ${e}="${n}"`)}}return i+=">",i+=e.textContent||"",(e.children||[]).forEach(e=>{i+=this.serializeNode(e)}),i+=`</${e.tagName}>`}onTableChanged(e){e.detail?.sender!==this.id&&this.render()}}to.defaultOptions=M(ti.defaultOptions,tn),to.predefinedSyncConfig={defaultSyncPairs:{},defaultSyncOptions:{}};class tr{static board(e,t,i){return new tr(e,t).init(i)}constructor(e,t){this.componentTypes=eP.types,this.options=M(eW,t),this.dataPool=new e_(t.dataPool),this.id=K(),this.guiEnabled=!!t.gui&&this.options?.gui?.enabled,this.editModeEnabled=!!t.editMode&&this.options?.editMode?.enabled,this.layouts=[],this.mountedComponents=[],this.initContainer(e),this.initEditMode(),this.dataCursor=new eT,this.index=ej.boards.length,ej.boards.push(this),this.a11y=new eY(this)}init(e){let t=this.options,i=t.components?this.setComponents(t.components):[];return(this.initEvents(),e)?Promise.all(i).then(()=>(t.events?.mounted?.call(this),this)):(t.events?.mounted?.call(this),this)}initEvents(){let e=this,t=()=>{e.reflow()};if("function"==typeof ResizeObserver)this.resizeObserver=new ResizeObserver(t),this.resizeObserver.observe(e.container);else{let e=c(window,"resize",t);c(this,"destroy",e)}}initContainer(e){"string"==typeof e&&(e=window.document.getElementById(e)),e||J(13,!0),this.container=e}initEditMode(){let{EditMode:e}=ej.win.Dashboards;if(e)this.editMode=new e(this,this.options.editMode);else if(this.editModeEnabled)throw Error("Missing layout.js module")}setComponents(e){let t=[];for(let i=0,n=e.length;i<n;++i)t.push(eU.addComponent(e[i],this));return t}destroy(){let e=this,t=this.index;if(this.dataPool.cancelPendingRequests(),this.guiEnabled)for(let t of(e.layouts||[]).slice())t.destroy();else for(let t of e.mountedComponents)t.component.destroy();this.resizeObserver?.unobserve(e.container),this.guiEnabled&&e.container?.remove(),S(e,function(t,i){delete e[i]}),ej.boards[t]=void 0}reflow(){if(this.editMode){let e=this.editMode.tools;this.editMode.hideToolbars(["cell","row"]),this.editMode.hideContextPointer(),e.contextMenu&&e.contextMenu.updatePosition(e.contextButtonElement)}}update(e){for(let t of(this.options=M(this.options,e),e.dataPool&&(this.dataPool=new e_(this.options.dataPool)),void 0!==e.gui&&(this.guiEnabled=!!e.gui&&this.options?.gui?.enabled),void 0!==e.editMode&&(this.editModeEnabled=!!e.editMode&&this.options?.editMode?.enabled),this.mountedComponents))t.component.destroy();if(this.mountedComponents=[],this.guiEnabled&&this.layouts){for(let e of this.layouts.slice())e.destroy();if(this.layouts=[],!this.layoutsWrapper&&this.container&&(this.layoutsWrapper=p("div",{className:ej.classNames.layoutsWrapper},{},this.container)),this.options.gui?.layouts){let e=this.options.gui;for(let t=0,i=e.layouts.length;t<i;++t)this.layouts.push(new eq(this,M({},e.layoutOptions,e.layouts[t])));if(this.editMode){let e=0,t=this.layouts.length;for(;e<t;++e)this.editMode.setLayoutEvents(this.layouts[e])}}}this.options.components&&this.setComponents(this.options.components)}getOptions(){let e={...this.options,components:[]};for(let t=0,i=this.mountedComponents.length;t<i;++t)this.mountedComponents[t].cell&&this.mountedComponents[t].cell.mountedComponent&&e.components?.push(this.mountedComponents[t].component.getOptions());if(this.guiEnabled){e.gui={layouts:[]};for(let t=0,i=this.layouts.length;t<i;++t)e.gui.layouts?.push(this.layouts[t].getOptions())}else delete e.gui;return e}getComponentById(e){return this.mountedComponents.find(t=>t.component.id===e)?.component}getComponentByCellId(e){return this.mountedComponents.find(t=>t.cell.id===e)?.component}}function ta(e){return!!(e&&"function"==typeof e.getDataTable)}eP.registerComponent("HTML",to);let tl={defaultOptions:{autoScroll:!1},syncPair:{emitter:function(){if("Grid"!==this.type)return;let{grid:e,board:t}=this,i=this.sync.syncConfig.highlight,n=i.group?":"+i.group:"";if(!t||!e||!i?.enabled)return;let{dataCursor:s}=t,o=this.getDataTable(),r=(t,i)=>{if(o){let r=t.row.index,a=e.dataProvider,l=ta(a)?a.getDataTable(!0):void 0,h=l?.getOriginalRowIndex(r);"number"==typeof h&&s.emitCursor(o,{type:"position",row:h,column:t.column.id,state:i+n,sourceId:this.id})}},a=e=>{r(e.target,"point.mouseOver")},l=e=>{r(e.target,"point.mouseOut")};return c(e,"cellMouseOver",a),c(e,"cellMouseOut",l),function(){P(e,"cellMouseOver",a),P(e,"cellMouseOut",l)}},handler:function(){if("Grid"!==this.type)return;let e=this,{board:t}=e,i=e.sync.syncConfig.highlight,n=i.group?":"+i.group:"";if(!i?.enabled)return;let s=e.getDataTable(),o=t=>{let n=t.cursor;if(n.sourceId===e.id||"position"!==n.type)return;let{row:s,column:o}=n,{grid:r}=e,a=r?.viewport,l=r?.dataProvider,h=ta(l)?l.getDataTable(!0):void 0;if(void 0===s||!a)return;let c=h?.getLocalRowIndex(s);void 0!==c&&(i.autoScroll&&a.scrollToRow(c),r.syncRow(c),r.syncColumn(o))},r=t=>{let{grid:i}=e;i&&t.cursor.sourceId!==e.id&&(i.syncColumn(),i.syncRow())};if(t)return(()=>{let{dataCursor:e}=t;!e||s&&(e.addListener(s.id,"point.mouseOver"+n,o),e.addListener(s.id,"point.mouseOut"+n,r))})(),()=>{if(!s)return;let e=t.dataCursor;e.removeListener(s.id,"point.mouseOver"+n,o),e.removeListener(s.id,"point.mouseOut"+n,r)}}}},th={defaultOptions:{},syncPair:{emitter:void 0,handler:function(){if("Grid"!==this.type)return;let e=this,t=this.sync.syncConfig.visibility,i=t.group?":"+t.group:"",{board:n}=e,s=t=>{let n=t.cursor,s=e.grid;s&&"position"===n.type&&n.column&&s.updateColumn(n.column,{enabled:n.state!=="series.hide"+i})};if(n)return(()=>{let{dataCursor:t}=n;if(!t)return;let o=e.getDataTable();o&&(t.addListener(o.id,"series.show"+i,s),t.addListener(o.id,"series.hide"+i,s))})(),()=>{let t=e.getDataTable(),{dataCursor:o}=n;t&&(o.removeListener(t.id,"series.show"+i,s),o.removeListener(t.id,"series.hide"+i,s))}}}},tc={defaultSyncPairs:{extremes:{emitter:void 0,handler:function(){if("Grid"!==this.type)return;let e=this,t=this.sync.syncConfig.extremes,i=t.group?":"+t.group:"",{board:n}=e,s=t=>{let i=t.cursor;if("position"===i.type&&e.grid&&"number"==typeof i?.row){let{row:t}=i,n=e.grid.dataProvider,s=ta(n)?n.getDataTable(!0)?.getLocalRowIndex(t):void 0;void 0!==s&&e.grid.viewport?.scrollToRow(s)}};if(n)return(()=>{let{dataCursor:t}=n;if(!t)return;let o=e.connectorHandlers?.[0]?.connector?.getTable();o&&t.addListener(o.id,"xAxis.extremes.min"+i,s)})(),()=>{let t=e.connectorHandlers?.[0]?.connector?.getTable(),{dataCursor:o}=n;t&&o.removeListener(t.id,"xAxis.extremes.min"+i,s)}}},highlight:tl.syncPair,visibility:th.syncPair},defaultSyncOptions:{extremes:{},highlight:tl.defaultOptions,visibility:th.defaultOptions}},td={gridClassName:"highcharts-grid-container",gridID:"grid-"+K(),gridOptions:{},editableOptions:[{name:"connectorName",propertyPath:["connector","id"],type:"select"},{name:"title",propertyPath:["title"],type:"input"},{name:"caption",propertyPath:["caption"],type:"input"},{name:"Grid options",type:"nested",nestedOptions:[{name:"General",options:[{name:"Caption/title",propertyPath:["gridOptions","caption","text"],type:"input"},{name:"Columns resizing mode",propertyPath:["gridOptions","rendering","columns","resizing","mode"],type:"select",selectOptions:[{name:"adjacent"},{name:"distributed"},{name:"independent"}]},{name:"Editable Grid",propertyPath:["gridOptions","columnDefaults","cells","editMode","enabled"],type:"toggle"},{name:"Resizable columns",propertyPath:["gridOptions","rendering","columns","resizing","enabled"],type:"toggle"},{name:"Sortable columns",propertyPath:["gridOptions","columnDefaults","sorting","enabled"],type:"toggle"},{name:"Cell text truncation",propertyPath:["gridOptions","rendering","rows","strictHeights"],type:"toggle"}]}]},{name:"Grid class name",propertyPath:["gridClassName"],type:"input"},{name:"Grid ID",propertyPath:["gridID"],type:"input"}],onUpdate:(e,t)=>{let i=e.target;if(i){let e=i.closest(".hcg-row"),n=i.closest(".hcg-cell");if(e&&e instanceof HTMLElement&&n&&n instanceof HTMLElement){let s=e.dataset.rowIndex,{columnId:o}=n.dataset;if(void 0!==s&&void 0!==o){let e=t.getTable();if(e){let t=new $().convertByType(i.value);t instanceof Date&&(t=t.toString()),e.setCell(o,Number(s),t)}}}}}},{deepClone:tu}=e6;class tp extends ti{constructor(e,t,i){super(e,t=M(tp.defaultOptions,t),i),this.options=t,this.type="Grid",this.setOptions()}async update(e,t=!0){let i=this.getGridDataTable(!0)?.id;await super.update(e,!1),this.setOptions();let n=this.grid,s=this.getDataTable();if(n&&this.options.connector&&i!==s?.id){this.recreateGrid(t),this.emit({type:"afterUpdate"});return}n&&t&&super.render(),n?(n.update(e.gridOptions,!1),e.gridOptions?.dataTable&&this.options.gridOptions&&(this.options.gridOptions.dataTable=e.gridOptions.dataTable),await n.redraw(),this.options.gridOptions=this.getGridOptionsSnapshot(n),t&&this.finalizeGridRender()):t&&this.render(),this.emit({type:"afterUpdate"})}render(){return super.render(),this.grid?this.grid.renderViewport():this.grid=this.constructGrid(),this.finalizeGridRender(),this}resize(e,t){t?this.contentElement.style.minHeight="0":null===t&&this.contentElement.style.removeProperty("min-height"),this.resizeDynamicContent(e,t),this.grid?.viewport?.reflow()}onTableChanged(){let{grid:e}=this;if(!e)return;if(!("dataProvider"in e)){console.warn("GridComponent: Legacy Grid detected. Using legacy handler for table changes. Consider upgrading the Highcharts Grid Library to the latest version."),this.onTableChangedLegacy();return}if(!e?.dataProvider||!ta(e.dataProvider)||!this.connectorHandlers?.length)return;let t=this.getDataTable()?.getModified();if(!t)return void this.recreateGrid(!0);if(!e.options?.header){let i=t.getColumnIds(),{enabledColumns:n,columnPolicy:s}=e,o=0;for(let e of i)if(s.getIndividualColumnOptions(e)?.enabled!==!1){if(n?.[o]!==e)return void this.recreateGrid(!0);o++}}this.getGridDataTable()!==t?this.recreateGrid(!0):(e.querying.shouldBeUpdated=!0,e.viewport?.updateRows())}onTableChangedLegacy(){let{grid:e}=this;if(!e)return;let t=this.getDataTable()?.getModified();if(!t)return void e.update({dataTable:void 0});if(!e.options?.header){let i=t.getColumnIds(),{enabledColumns:n,columnPolicy:s}=e,o=0;for(let r of i)if(s.getIndividualColumnOptions(r)?.enabled!==!1){if(n?.[o]!==r)return void e.update({dataTable:t});o++}}e.dataTable=t,e.querying.shouldBeUpdated=!0,e.viewport?.updateRows()}getEditableOptions(){let e=this.options;return tu(M({gridOptions:this.grid?this.getGridOptionsSnapshot(this.grid):void 0},e),["editableOptions","dataTable"])}getOptionsOnDrop(e){let t=e.editMode.board.dataPool.getConnectorIds(),i={type:"Grid"};return t.length&&(i={...i,connector:{id:t[0]}}),i}getOptions(){let e=M(this.options);return e.gridOptions=this.grid?this.getGridOptionsSnapshot(this.grid):void 0,e.connector?.id?delete e.gridOptions?.dataTable:e.gridOptions?.dataTable?.id&&(e.gridOptions.dataTable={columns:e.gridOptions.dataTable.columns}),{...f(e,tp.defaultOptions),type:"Grid"}}destroy(){this.sync.stop(),this.grid?.destroy(),super.destroy()}setOptions(){let e=this.options,t=e.gridClassName,i=e.gridID;t&&(this.contentElement.classList.value=td.gridClassName+" "+t),i&&(this.contentElement.id=i)}finalizeGridRender(){let{grid:e}=this;e&&(e.initialContainerHeight=C(this.parentElement,"height",!0)||0,this.sync.start(),this.emit({type:"afterRender"}))}getGridOptionsSnapshot(e){let t=M(e.getOptions());return this.options.connector&&(delete t.dataTable,t.data?.providerType==="local"&&(delete t.data.dataTable,delete t.data.columns,1===Object.keys(t.data).length&&"local"===t.data.providerType&&delete t.data)),t}getGridOptionsWithConnectorData(){let e=M(this.options.gridOptions)??{};if(!this.options.connector)return e;delete e.dataTable,e.data?.providerType==="local"&&(delete e.data.dataTable,delete e.data.columns,1===Object.keys(e.data).length&&"local"===e.data.providerType&&delete e.data);let t=this.getDataTable();return t&&(e.data=M(e.data?.providerType==="local"?e.data:{},{providerType:"local",dataTable:t.getModified()})),e}recreateGrid(e){(this.sync.stop(),this.grid?.destroy(),delete this.grid,e)?this.render():(this.grid=this.constructGrid(),this.finalizeGridRender())}getGridDataTable(e=!1){let t=this.grid?.dataProvider;return ta(t)?t.getDataTable(e):void 0}constructGrid(){let e=tp.GridNamespace;if(!e)throw Error("Grid not connected.");let t=this.getGridOptionsWithConnectorData(),i=new e.Grid(this.contentElement,t??{});return this.options.gridOptions=this.getGridOptionsSnapshot(i),i}}tp.predefinedSyncConfig=tc,tp.defaultOptions=M(ti.defaultOptions,td);let tm={custom:{connectGrid:function(e){tp.GridNamespace=e}},name:"Grid.DashboardsPlugin",onRegister:function(e){let{ComponentRegistry:t}=e;t.registerComponent("Grid",tp)},onUnregister:function(e){}},tg={defaultOptions:{},syncPair:{emitter:function(){if("Highcharts"!==this.type)return;let e=this,t=[],{chart:i,board:n}=e,s=e.connectorHandlers?.[0]?.connector,o=s&&s.getTable(),r=this.sync.syncConfig.extremes,a=r.group?":"+r.group:"",{dataCursor:l}=n;if(o&&i){let n=t=>{let n=!!t.resetSelection;if((!t.trigger||t.trigger&&"dashboards-sync"!==t.trigger)&&!n){let n=t.target,s=Object.keys(e.seriesFromConnector),r=s.length>0?i.get(s[0]):n.series[0];if(r){let i=r.points.filter(e=>e.isInside||!1),h={type:"position",state:`${n.coll}.extremes.min${a}`},c={type:"position",state:`${n.coll}.extremes.max${a}`};if(s.length>0&&"xAxis"===n.coll&&i.length){let t,s=(e.connectorHandlers[0]?.options).columnAssignment;if(s){let e=s.find(e=>e.seriesId===r.options.id);if(e){let i=e.data;t=T(i)?i:Array.isArray(i)?i[i.length-1]:i.y}}t||(t=n.dateTime&&(o.hasColumns(["x"])?"x":r.options.id??r.name)),h.row=i[0].index,h.column=t,c.row=i[i.length-1].index,c.column=t}l.emitCursor(o,h,t,!0).emitCursor(o,c,t,!0)}}},s=()=>i.axes.map(e=>c(e,"afterSetExtremes",n)),r=s(),h=()=>{r.forEach(e=>{e()}),r=[]};t.push(c(i,"selection",e=>{e.resetSelection&&(h(),l.emitCursor(o,{type:"position",state:"chart.zoomOut"+a},e),r.push(...s()))})),t.push(()=>{l.remitCursor(o.id,{type:"position",state:"xAxis.extremes.min"+a}),l.remitCursor(o.id,{type:"position",state:"xAxis.extremes.max"+a}),h()})}return function(){t.forEach(e=>{e()})}},handler:function(){if("Highcharts"!==this.type)return;let e=this,t=this.sync.syncConfig.extremes,i=t.group?":"+t.group:"",{chart:n,board:s}=e;if(n&&s&&n.zooming?.type){let t=n.zooming.type.split("").map(e=>e+"Axis"),o=[];return t.forEach(t=>{let r=e=>{let{cursor:i,event:s}=e;if("position"===i.type){let e=s?.target;if(e&&n){let i=n[t],s=!1;i.forEach(t=>{e.coll===t.coll&&e!==t&&null!==e.min&&null!==e.max&&(t.max!==e.max||t.min!==e.min)&&(t.setExtremes(e.min,e.max,!1,void 0,{trigger:"dashboards-sync"}),s=!0)}),s&&!n.resetZoomButton&&n.showResetZoom(),n.redraw()}}};s&&(()=>{let{dataCursor:a}=s,l=e.connectorHandlers?.[0]?.connector;if(l){let s=l.getTable();a.addListener(s.id,`${t}.extremes.min${i}`,r),a.addListener(s.id,`${t}.extremes.max${i}`,r);let h=()=>{n.zoomOut(),setTimeout(()=>{e.element.querySelectorAll(".highcharts-reset-zoom").forEach(e=>{e.remove()})})};a.addListener(s.id,"chart.zoomOut",h),o.push(()=>{a.removeListener(s.id,`${t}.extremes.min${i}`,r),a.removeListener(s.id,`${t}.extremes.max${i}`,r),a.removeListener(s.id,"chart.zoomOut"+i,h)})}})()}),function(){o.forEach(e=>{e()})}}}}},{error:tf}=e6,ty={defaultOptions:{affectedSeriesId:null,highlightPoint:!0,showTooltip:!0,showCrosshair:!0},syncPair:{emitter:function(){if("Highcharts"!==this.type)return;let e=this,{chart:t,board:i}=e,n=this.sync.syncConfig.highlight,s=n.group?":"+n.group:"";if(!n.enabled||!t)return;let{dataCursor:o}=i;for(let i=0,n=t.series?.length??0;i<n;++i){let n,r=t.series[i],a=r.options.id??"",l=e.seriesFromConnector[a],h=l?.options.id,c=this.getDataTable(h);if(!c)continue;let d=c?.getModified(),u=l?.columnAssignment?.find(e=>e.seriesId===a);if(u){let{data:e}=u;n="string"==typeof e?e:Array.isArray(e)?e[1]:e.y??e.value}n||(n=r.name),r.update({point:{events:{mouseOver:function(){o.emitCursor(c,{type:"position",row:d.getOriginalRowIndex(this.index),column:n,state:"point.mouseOver"+s,sourceId:e.id})},mouseOut:function(){o.emitCursor(c,{type:"position",row:d.getOriginalRowIndex(this.index),column:n,state:"point.mouseOut"+s,sourceId:e.id})}}}},!1)}return t.redraw(),function(){t&&t.series&&(t.series.forEach(e=>{e.update({point:{events:{mouseOver:void 0,mouseOut:void 0}}},!1)}),t.redraw())}},handler:function(){if("Highcharts"!==this.type)return;let e=this,t=this.sync.syncConfig.highlight.group?":"+this.sync.syncConfig.highlight.group:"",{chart:i,board:n}=e,s=t=>{let{table:n,cursor:s}=t,o=this.sync.syncConfig.highlight;if(i&&i.series?.length&&"position"===s.type){let t,r=o.affectedSeriesId;if(o.affectedSeriesId){let e=i.get(o.affectedSeriesId);e?.points?t=e:tf("No series with ID '"+r+"' found in the chart. Affected series will be selected according to the column assignment.")}if(!t){let o=Object.keys(e.seriesFromConnector);for(let r=0,a=o.length;r<a;++r){let a=o[r],l=e.seriesFromConnector[a],h=l?.options.dataTableKey;if(l?.connector?.getTable(h)!==n)continue;let c=l.columnAssignment;if(t=i.get(a),!c)break;let{data:d}=c.find(e=>e.seriesId===a)??{};if(!d||!s.column)break;if("string"==typeof d){if(d===s.column)break}else if(Array.isArray(d)){if(d.includes(s.column))break}else if(Object.keys(d).map(e=>d[e]).includes(s.column))break}}let a=s.row;if(t?.visible&&void 0!==a){let e=n.getModified().getLocalRowIndex(a);if(void 0===e)return;let i=t.data[e];if(i?.visible)return i}}},o=t=>{let n=this.sync.syncConfig.highlight;if(!n.enabled||t.cursor.sourceId===e.id)return;let o=s(t);if(!o||!i||!o.isInside&&o.series.isCartesian||o===i.hoverPoint)return;let r=i.tooltip;if(r&&n.showTooltip){let e=r.shared,t=i.hoverPoint,n=t?.series||i.hoverSeries,s=i.pointer?.getHoverData(o,n,i.series,!0,!0);i.tooltip&&s?.hoverPoints.length&&r.refresh(e?s.hoverPoints:o)}n.highlightPoint&&(!r?.shared&&n.showTooltip||!n.showTooltip)&&o.setState("hover"),n.showCrosshair&&(o.series.xAxis?.drawCrosshair(void 0,o),o.series.yAxis?.drawCrosshair(void 0,o))},r=t=>{let n=this.sync.syncConfig.highlight;if(!i||!i.series.length||!n.enabled||t.cursor.sourceId===e.id)return;let o=s(t);if(o&&(!o.isInside&&o.series.isCartesian||o===i.hoverPoint))return;let r=!1,a=()=>{let e=i.series.length;for(let t=0;t<e;t++){let e=i.series[t].points,n=e.length;for(let t=0;t<n;t++)e[t].setState()}},l=i.tooltip;if(l&&n.showTooltip&&(l.hide(),l.shared&&(a(),r=!0)),n.highlightPoint&&!r&&(o?o.setState():a()),n.showCrosshair)if(o)o.series.xAxis?.drawCrosshair(),o.series.yAxis?.drawCrosshair();else{let e=i.xAxis,t=i.yAxis;for(let t=0,i=e.length;t<i;t++)e[t].drawCrosshair();for(let e=0,i=t.length;e<i;e++)t[e].drawCrosshair()}},a=()=>{let{dataCursor:e}=n,{connectorHandlers:i}=this;if(e)for(let n=0,s=i.length;n<s;++n){let s=i[n]?.options.id,a=this.getDataTable(s);a&&(e.addListener(a.id,"point.mouseOver"+t,o),e.addListener(a.id,"point.mouseOut"+t,r))}},l=()=>{let{dataCursor:e}=n,{connectorHandlers:i}=this;if(e)for(let n=0,s=i.length;n<s;++n){let s=i[n]?.connector?.getTable();s&&(e.removeListener(s.id,"point.mouseOver"+t,o),e.removeListener(s.id,"point.mouseOut"+t,r))}};if(n)return a(),l}}},tb={defaultOptions:{},syncPair:{emitter:function(){if("Highcharts"!==this.type)return;let e=this.sync.syncConfig.visibility,t=e.group?":"+e.group:"",{chart:i,board:n}=this;if(!n||!i)return;let s=this.getDataTable();if(s){let{dataCursor:e}=n,{series:o}=i;o.forEach(i=>{i.update({events:{show:function(){e.emitCursor(s,{type:"position",state:"series.show"+t,column:this.name})},hide:function(){e.emitCursor(s,{type:"position",state:"series.hide"+t,column:this.name})}}},!1)}),i.redraw()}return function(){i&&i.series?.length&&(i.series.forEach(e=>{e.update({events:{show:void 0,hide:void 0}},!1)}),i.redraw())}},handler:function(){if("Highcharts"!==this.type)return;let e=this,t=this.sync.syncConfig.visibility,i=t.group?":"+t.group:"",{board:n}=e,s=(e,t)=>{for(let i of e)if(i.name===t)return i},o=t=>{let i=e.chart;if(i&&i.series?.length&&"position"===t.cursor.type&&void 0!==t.cursor.column){let e=s(i.series,t.cursor.column);e&&e.setVisible(!0,!0)}},r=t=>{let i=e.chart;if(i&&i.series?.length&&"position"===t.cursor.type&&void 0!==t.cursor.column){let e=s(i.series,t.cursor.column);e&&e.setVisible(!1,!0)}};if(n)return(()=>{let{dataCursor:t}=n;if(!t)return;let s=e.getDataTable();s&&(t.addListener(s.id,"series.show"+i,o),t.addListener(s.id,"series.hide"+i,r))})(),()=>{let t=e.getDataTable();t&&(n.dataCursor.removeListener(t.id,"series.show"+i,o),n.dataCursor.removeListener(t.id,"series.hide"+i,r))}}}},tC={defaultSyncPairs:{extremes:tg.syncPair,highlight:ty.syncPair,visibility:tb.syncPair},defaultSyncOptions:{extremes:tg.defaultOptions,highlight:ty.defaultOptions,visibility:tb.defaultOptions}},tw={allowConnectorUpdate:!0,className:[ti.defaultOptions.className,`${ti.defaultOptions.className}-highcharts`].join(" "),chartClassName:"chart-container",chartID:"chart-"+K(),chartOptions:{series:[]},chartConstructor:"chart",editableOptions:[{name:"connectorName",propertyPath:["connector","id"],type:"select"},...ti.defaultOptions.editableOptions||[],{name:"chartOptions",type:"nested",nestedOptions:[{name:"chart",options:[{name:"title",propertyPath:["chartOptions","title","text"],type:"input"},{name:"subtitle",propertyPath:["chartOptions","subtitle","text"],type:"input"},{name:"type",propertyPath:["chartOptions","chart","type"],type:"select",selectOptions:[{name:"column",iconURL:"series-types/icon-column.svg"},{name:"line",iconURL:"series-types/icon-line.svg"},{name:"scatter",iconURL:"series-types/icon-scatter.svg"},{name:"pie",iconURL:"series-types/icon-pie.svg"}]}]},{name:"xAxis",options:[{name:"title",propertyPath:["chartOptions","xAxis","title","text"],type:"input"},{name:"type",propertyPath:["chartOptions","xAxis","type"],type:"select",selectOptions:[{name:"linear"},{name:"datetime"},{name:"logarithmic"}]}]},{name:"yAxis",options:[{name:"title",propertyPath:["chartOptions","yAxis","title","text"],type:"input"},{name:"type",propertyPath:["chartOptions","yAxis","type"],type:"select",selectOptions:[{name:"linear"},{name:"datetime"},{name:"logarithmic"}]}]},{name:"legend",showToggle:!0,propertyPath:["chartOptions","legend","enabled"],options:[{name:"align",propertyPath:["chartOptions","legend","align"],type:"select",selectOptions:[{name:"left"},{name:"center"},{name:"right"}]}]},{name:"tooltip",showToggle:!0,propertyPath:["chartOptions","tooltip","enabled"],options:[{name:"split",propertyPath:["chartOptions","tooltip","split"],type:"toggle"}]},{name:"dataLabels",propertyPath:["chartOptions","plotOptions","series","dataLabels","enabled"],showToggle:!0,options:[{name:"align",propertyPath:["chartOptions","plotOptions","series","dataLabels","align"],type:"select",selectOptions:[{name:"left"},{name:"center"},{name:"right"}]}]},{name:"credits",showToggle:!0,propertyPath:["chartOptions","credits","enabled"],options:[{name:"name",propertyPath:["chartOptions","credits","text"],type:"input"},{name:"url",propertyPath:["chartOptions","credits","href"],type:"input"}]}]},{name:"chartConfig",propertyPath:["chartOptions"],type:"textarea"},{name:"chartClassName",propertyPath:["chartClassName"],type:"input"},{name:"chartID",propertyPath:["chartID"],type:"input"}],editableOptionsBindings:M(ti.defaultOptions.editableOptionsBindings,{skipRedraw:["chartOptions","chartConfig"]})},{deepClone:tv}=e6;class tO extends ti{constructor(e,t,i){super(e,t=M(tO.defaultOptions,t),i),this.seriesFromConnector={},this.options=t,this.chartConstructor=this.options.chartConstructor||"chart",this.type="Highcharts",this.chartContainer=p("figure",void 0,void 0,this.contentElement,!0),this.setOptions(),this.chartOptions=M(this.options.chartOptions||{chart:{}},{tooltip:{}}),this.innerResizeTimeouts=[]}onTableChanged(){this.updateSeries()}async load(){return this.emit({type:"load"}),await super.load(),this.emit({type:"afterLoad"}),this}render(){return super.render(),this.chart=this.getChart(),this.updateSeries(),this.emit({type:"afterRender"}),this.setupConnectorUpdate(),this.sync.start(),this}resize(e,t){for(this.resizeDynamicContent(e,t);this.innerResizeTimeouts.length;){let e=this.innerResizeTimeouts.pop();e&&clearTimeout(e)}return this.innerResizeTimeouts.push(setTimeout(()=>{if(this.chart&&this.chart.container){let e=this.contentElement.offsetHeight-this.chart?.container.offsetHeight;this.chart.setSize(null,Math.abs(e)>1?this.contentElement.offsetHeight:null,!1)}},33)),this}setupConnectorUpdate(){let{connectorHandlers:e,chart:t}=this;if(!t||!this.options.allowConnectorUpdate)return;let i=t.series.length;for(let n=0,s=e.length;n<s;n++){let s=e[n];for(let e=0;e<i;e++)t.series[e].update({point:{events:{update:e=>{this.onChartUpdate(e.target,s)}}}},!1)}}onChartUpdate(e,t){let i,n=t.dataTable,s=t.columnAssignment,o=e.series.options.id,r=new $,a=H(e.y,r.decimalRegExp);if(n){if(s&&o){let e=s.find(e=>e.seriesId===o)?.data;T(e)?i=e:Array.isArray(e)?i=e[1]:e&&(i=e.y??e.value)}i||(i=o??e.series.name),n.setCell(i,e.index,a)}}setOptions(){this.options.chartClassName&&(this.chartContainer.classList.value=tw.className+" "+this.options.chartClassName),this.options.chartID&&(this.chartContainer.id=this.options.chartID)}async update(e,t=!0){await super.update(e,!1),this.setOptions(),this.options.chartConstructor!==this.chartConstructor?(this.chartConstructor=this.options.chartConstructor||"chart",this.chartOptions=this.options.chartOptions||{},this.chart?.destroy(),delete this.chart):this.chart?.update(M(this.options.chartOptions)||{}),this.emit({type:"afterUpdate"}),t&&this.render()}updateSeries(){let{chart:e}=this,t=this.connectorHandlers;if(!e)return;let i=[];for(let e of t){let t=e.options.columnAssignment;if(!t&&e.dataTable&&(t=this.getDefaultColumnAssignment(e.dataTable.getColumnIds(),e.dataTable)),t)for(let{seriesId:n}of(e.columnAssignment=t,t))n&&i.push(n)}let n=Object.keys(this.seriesFromConnector);for(let t=0,s=n.length;t<s;++t){let s=n[t];if(i.some(e=>e===s))continue;let o=e.get(s);o&&o.destroy()}for(let e of(this.seriesFromConnector={},t))this.updateSeriesFromConnector(e);e.redraw()}updateSeriesFromConnector(e){let t=this.chart;if(!e.connector||!t||!e.dataTable)return;let i=e.dataTable.getModified(),n=e.dataTable.getModifier()?.options,s=e.columnAssignment??[];for(let o=0,r=s.length;o<r;++o){let r=s[o],a=r.data,l=t.get(r.seriesId),h={},c=e=>{n?.type==="Math"&&n.columnFormulas?.some(t=>e(t.column))&&(h.dragDrop={draggableY:!1})};if(T(a)){let e=i.getColumn(a);e&&(h.data=e.slice()),c(e=>e===a)}else if(Array.isArray(a))h.data=i.getRows(0,i.rowCount,a),c(e=>a.some(t=>t===e));else{let e=Object.keys(a),t=[];for(let i=0,n=e.length;i<n;++i)t.push(a[e[i]]);h.keys=e,h.data=i.getRows(0,i.rowCount,t),c(e=>t.some(t=>t===e))}l?l.update(h,!1):t.addSeries({name:r.seriesId,id:r.seriesId,...h},!1),this.seriesFromConnector[r.seriesId]=e}}getChart(){return this.chart||this.createChart()}destroy(){if(this.chart&&this.chart.renderTo&&this.chart.renderer){try{this.chart.destroy()}catch(e){console.warn("Error destroying chart:",e)}this.chart=void 0}super.destroy()}getDefaultColumnAssignment(e=[],t){let i=[],n=t.getColumn(e[0]);if(n&&T(n[0])){for(let t=1,n=e.length;t<n;++t)i.push({seriesId:e[t],data:[e[0],e[t]]});return i}for(let t=0,n=e.length;t<n;++t)i.push({seriesId:e[t],data:e[t]});return i}createChart(){let e=tO.charter||ej.win.Highcharts;this.chartConstructor||(this.chartConstructor="chart");let t=e[this.chartConstructor];if(t)try{if("chart"===this.chartConstructor)return e.Chart.chart(this.chartContainer,this.chartOptions);return new t(this.chartContainer,this.chartOptions)}catch(e){throw Error(`The Highcharts component in cell '${this.cell.id}' is misconfigured. 
____________
`+String(e))}if("function"!=typeof e.chart)throw Error("Chart constructor not found");return this.chart}getOptionsOnDrop(e){let t=e.editMode.board.dataPool.getConnectorIds(),i={type:"Highcharts",chartOptions:{chart:{animation:!1,type:"column",zooming:{}}}};return t.length&&(i={...i,connector:{id:t[0]}}),i}getOptions(){return{...f(this.options,tO.defaultOptions),type:"Highcharts"}}getEditableOptions(){let e=this.options,t=this.chart,i=t&&t.options,n=i?.chart?.type||"line";return tv(M({chartOptions:i},{chartOptions:{yAxis:I(t&&t.yAxis[0].options),xAxis:I(t&&t.xAxis[0].options),plotOptions:{series:(i&&i.plotOptions||{})[n]}}},e),["dataTable","points","series","data","editableOptions"])}getEditableOptionValue(e){if(e)return 1===e.length&&"chartOptions"===e[0]?JSON.stringify(this.options.chartOptions,null,2):super.getEditableOptionValue.call(this,e)}}tO.predefinedSyncConfig=tC,tO.defaultOptions=M(ti.defaultOptions,tw);let tT={defaultOptions:{},syncPair:{emitter:void 0,handler:function(){if("KPI"!==this.type)return;let e=this,t=this.sync.syncConfig.extremes,i=t.group?":"+t.group:"",{board:n}=this,s=t=>{let i=t.cursor;if("position"===i.type&&"number"==typeof i?.row&&g(i.column)&&e.connectorHandlers?.[0]?.connector&&!g(e.options.value)){let t=String(e.connectorHandlers[0].connector.getTable().getModified().getCell(i.column,i.row));e.setValue(t)}},o=()=>{let{dataCursor:e}=n;if(!e)return;let t=this.getDataTable();t&&e.addListener(t.id,"xAxis.extremes.max"+i,s)},r=()=>{let e=this.getDataTable(),{dataCursor:t}=n;e&&t.removeListener(e.id,"xAxis.extremes.max"+i,s)};if(n)return o(),r}}},tx={defaultSyncPairs:{extremes:tT.syncPair},defaultSyncOptions:{extremes:tT.defaultOptions}},tN={type:"KPI",className:[ti.defaultOptions.className,`${ti.defaultOptions.className}-kpi`].join(" "),minFontSize:20,thresholdColors:["#f45b5b","#90ed7d"],editableOptions:[{name:"connectorName",propertyPath:["connector","id"],type:"select"},...ti.defaultOptions.editableOptions||[],{name:"Value",type:"input",propertyPath:["value"]},{name:"Column name",type:"input",propertyPath:["columnId"]},{name:"Value format",type:"input",propertyPath:["valueFormat"]}],linkedValueTo:{enabled:!0,seriesIndex:0,pointIndex:0}},tE=["+","-","*","/","^","=","<","<=",">",">="],{isFormula:tM,isFunction:tS,isOperator:tR,isRange:tA,isReference:tP,isValue:tI}={isFormula:function(e){return Array.isArray(e)},isFunction:function(e){return"object"==typeof e&&!Array.isArray(e)&&"function"===e.type},isOperator:function(e){return"string"==typeof e&&tE.indexOf(e)>=0},isRange:function(e){return"object"==typeof e&&!Array.isArray(e)&&"range"===e.type},isReference:function(e){return"object"==typeof e&&!Array.isArray(e)&&"reference"===e.type},isValue:function(e){return"boolean"==typeof e||"number"==typeof e||"string"==typeof e}},tL=/ */,tD=Number.MAX_VALUE/1.000000000001,tk=Number.MAX_VALUE/1.000000000002,tH=Number.MAX_VALUE,tF={"^":3,"*":2,"/":2,"+":1,"-":1,"=":0,"<":0,"<=":0,">":0,">=":0},tj={},tz=/^[A-Z][A-Z\.]*$/;function tV(e){switch(typeof e){case"boolean":return e?tH:tD;case"string":return tk;case"number":return e;default:return NaN}}function t$(e){return"string"==typeof e?e.toLowerCase().replace(tL,"\0"):e}function tB(e){switch(typeof e){case"boolean":return+!!e;case"string":return parseFloat(e.replace(",","."));case"number":return e;default:return NaN}}function tG(e,t){return tI(e)?e:tA(e)?t&&tU(e,t)||[]:tS(e)?tJ(e,t):tW(tM(e)?e:[e],t)}function tU(e,t){let i=t.getColumnIds().slice(e.beginColumn,e.endColumn+1),n=[];for(let s=0,o=i.length,r;s<o;++s){let o=t.getColumn(i[s],!0)||[];for(let a=e.beginRow,l=e.endRow+1;a<l;++a)"string"==typeof(r=o[a])&&"="===r[0]&&t!==t.getModified()&&(r=t.getModified().getCell(i[s],a)),n.push(tI(r)?r:NaN)}return n}function tY(e,t){let i=t.getColumnIds()[e.column];if(i){let n=t.getCell(i,e.row);if("string"==typeof n&&"="===n[0]&&t!==t.getModified()){let n=t.getModified().getCell(i,e.row);return tI(n)?n:NaN}if(tI(n))return e.isNegative?-n:n}return NaN}function t_(e,t){(e.length<2||t.length<1)&&e.push(NaN);let i=e.pop(),n=e.pop(),s=t.pop();g(i)&&g(n)&&g(s)?e.push(function(e,t,i){let n;switch(e){case"=":return t$(t)===t$(i);case"<":if(typeof t==typeof i)return t$(t)<t$(i);return tV(t)<tV(i);case"<=":if(typeof t==typeof i)return t$(t)<=t$(i);return tV(t)<=tV(i);case">":if(typeof t==typeof i)return t$(t)>t$(i);return tV(t)>tV(i);case">=":if(typeof t==typeof i)return t$(t)>=t$(i);return tV(t)>=tV(i)}switch(t=tB(t),i=tB(i),e){case"+":n=t+i;break;case"-":n=t-i;break;case"*":n=t*i;break;case"/":n=t/i;break;case"^":n=Math.pow(t,i);break;default:return NaN}return n%1?Math.round(1e9*n)/1e9:n}(s,n,i)):e.push(NaN)}function tW(e,t){let i=[],n=[],s=!0;for(let o=0,r=e.length;o<r;++o){let r,a=e[o];if(tR(a)){if(s&&"-"===a)i.push(0),n.push("-"),s=!0;else{for(;n.length&&tF[n[n.length-1]]>=tF[a];)t_(i,n);n.push(a),s=!0}continue}if(tI(a))r=a;else if(tP(a))r=t?tY(a,t):NaN;else if(tS(a)){let e=tJ(a,t);r=tI(e)?e:NaN}else tM(a)&&(r=tW(a,t));if(void 0===r)return NaN;i.push(r),s=!1}for(;n.length;)t_(i,n);return 1!==i.length?NaN:i[0]}function tJ(e,t,i){let n=tj[e.name];if(n)try{return n(e.args,t)}catch{return NaN}let s=Error(`Function "${e.name}" not found.`);throw s.name="FormulaProcessError",s}let tZ={asNumber:tB,getArgumentValue:tG,getArgumentsValues:function(e,t){let i=[];for(let n=0,s=e.length;n<s;++n)i.push(tG(e[n],t));return i},getRangeValues:tU,getReferenceValue:tY,processFormula:tW,processorFunctions:tj,registerProcessorFunction:function(e,t){return tz.test(e)&&!tj[e]&&!!(tj[e]=t)},translateReferences:function e(t,i=0,n=0){for(let s=0,o=t.length,r;s<o;++s)Array.isArray(r=t[s])?e(r,i,n):tS(r)?e(r.args,i,n):tA(r)?(r.beginColumnRelative&&(r.beginColumn+=i),r.beginRowRelative&&(r.beginRow+=n),r.endColumnRelative&&(r.endColumn+=i),r.endRowRelative&&(r.endRow+=n)):tP(r)&&(r.columnRelative&&(r.column+=i),r.rowRelative&&(r.row+=n));return t}};function tK(e,t){let i=tZ.getArgumentsValues(e,t),n=0;for(let e=0,s=i.length,o;e<s;++e)switch(typeof(o=i[e])){case"number":isNaN(o)||(n+=o);break;case"object":n+=tK(o,t)}return n}tZ.registerProcessorFunction("SUM",tK);let{getArgumentsValues:tq}=tZ;function tX(e,t){let i=tq(e,t),n=0,s=0;for(let e=0,t=i.length,o;e<t;++e)switch(typeof(o=i[e])){case"number":isNaN(o)||(++n,s+=o);break;case"object":for(let e=0,t=o.length,i;e<t;++e)"number"!=typeof(i=o[e])||isNaN(i)||(++n,s+=i)}return n?s/n:0}function tQ(e,t){let i=[],n=tZ.getArgumentsValues(e,t);for(let e=0,t=n.length,s;e<t;++e)switch(typeof(s=n[e])){case"number":isNaN(s)||i.push(s);break;case"object":for(let e=0,t=s.length,n;e<t;++e)"number"!=typeof(n=s[e])||isNaN(n)||i.push(n)}let s=i.length;if(!s)return NaN;let o=Math.floor(s/2);return s%2?i[o]:(i[o-1]+i[o])/2}tZ.registerProcessorFunction("AVERAGE",tX),tZ.registerProcessorFunction("MEDIAN",tQ);let{getArgumentsValues:t0}=tZ;function t1(e,t){let i=t0(e,t),n=-1/0;for(let e=0,t=i.length,s;e<t;++e)switch(typeof(s=i[e])){case"number":s>n&&(n=s);break;case"object":(s=t1(s))>n&&(n=s)}return isFinite(n)?n:0}tZ.registerProcessorFunction("MAX",t1);let{getArgumentsValues:t2}=tZ;function t3(e,t){let i=t2(e,t),n=1/0;for(let e=0,t=i.length,s;e<t;++e)switch(typeof(s=i[e])){case"number":s<n&&(n=s);break;case"object":(s=t3(s))<n&&(n=s)}return isFinite(n)?n:0}function t4(e,t){let i=tZ.getArgumentsValues(e,t),n=0;for(let e=0,s=i.length,o;e<s;++e)switch(typeof(o=i[e])){case"number":!isNaN(o)&&++n;break;case"object":n+=t4(o,t)}return n}tZ.registerProcessorFunction("MIN",t3),tZ.registerProcessorFunction("COUNT",t4);let{getArgumentsValues:t5}=tZ;function t6(e,t){let i=t5(e,t),n=1,s=!1;for(let e=0,o=i.length,r;e<o;++e)switch(typeof(r=i[e])){case"number":isNaN(r)||(s=!0,n*=r);break;case"object":s=!0,n*=t6(r,t)}return s?n:0}tZ.registerProcessorFunction("PRODUCT",t6);let{pageLang:t8,win:t9}=a,t7=a.isSafari&&t9.Intl&&!t9.Intl.DateTimeFormat.prototype.formatRange,ie=class{constructor(e,t){this.options={timezone:"UTC"},this.variableTimezone=!1,this.Date=t9.Date,this.update(e),this.lang=t}update(e={}){this.dTLCache={},this.options=e=M(!0,this.options,e);let{timezoneOffset:t,useUTC:i,locale:n}=e;this.Date=e.Date||t9.Date||Date;let s=e.timezone;g(i)&&(s=i?"UTC":void 0),t&&t%60==0&&(s="Etc/GMT"+(t>0?"+":"")+t/60),this.variableTimezone="UTC"!==s&&s?.indexOf("Etc/GMT")!==0,this.timezone=s,this.lang&&n&&(this.lang.locale=n),["months","shortMonths","weekdays","shortWeekdays"].forEach(e=>{let t=/months/i.test(e),i=/short/.test(e),n={timeZone:"UTC"};n[t?"month":"weekday"]=i?"short":"long",this[e]=(t?[0,1,2,3,4,5,6,7,8,9,10,11]:[3,4,5,6,7,8,9]).map(e=>this.dateFormat(n,(t?31:1)*24*36e5*e))})}toParts(e){let[t,i,n,s,o,r,a]=this.dateTimeFormat({weekday:"narrow",day:"numeric",month:"numeric",year:"numeric",hour:"numeric",minute:"numeric",second:"numeric"},e,"es").split(/(?:, | |\/|:)/g);return[+s,n-1,+i,+o,+r,+a,Math.floor(Number(e)||0)%1e3,"DLMXJVS".indexOf(t)]}dateTimeFormat(e,t,i=this.options.locale||t8){let n=JSON.stringify(e)+i;T(e)&&(e=this.str2dtf(e));let s=this.dTLCache[n];if(!s){e.timeZone??(e.timeZone=this.timezone);try{s=new Intl.DateTimeFormat(i,e)}catch(t){/Invalid time zone/i.test(t.message)?(J(34),e.timeZone="UTC",s=new Intl.DateTimeFormat(i,e)):J(t.message,!1)}}return this.dTLCache[n]=s,s?.format(t)||""}str2dtf(e,t={}){let i={L:{fractionalSecondDigits:3},S:{second:"2-digit"},M:{minute:"numeric"},H:{hour:"2-digit"},k:{hour:"numeric"},E:{weekday:"narrow"},a:{weekday:"short"},A:{weekday:"long"},d:{day:"2-digit"},e:{day:"numeric"},b:{month:"short"},B:{month:"long"},m:{month:"2-digit"},o:{month:"numeric"},y:{year:"2-digit"},Y:{year:"numeric"}};return Object.keys(i).forEach(n=>{-1!==e.indexOf(n)&&y(t,i[n])}),t}makeTime(e,t,i=1,n=0,s,o,r){let a=this.Date.UTC(e,t,i,n,s||0,o||0,r||0);if("UTC"!==this.timezone){let e=this.getTimezoneOffset(a),i=(n-e/Z.hour+24)%24;if(a+=e,-1!==[2,3,8,9,10,11].indexOf(t)&&(i<5||i>20)){let t=this.getTimezoneOffset(a);e!==t?a+=t-e:e-36e5!==this.getTimezoneOffset(a-36e5)||t7||(a-=36e5)}}return a}parse(e){if(!T(e))return e??void 0;let t=(e=e.replace(/\//g,"-").replace(/(GMT|UTC)/,"")).indexOf("Z")>-1||/([+-][0-9]{2}):?[0-9]{2}$/.test(e),i=/^[0-9]{4}-[0-9]{2}(-[0-9]{2}|)$/.test(e);t||i||(e+="Z");let n=Date.parse(e);if(O(n))return n+(!t||i?this.getTimezoneOffset(n):0)}getTimezoneOffset(e){if("UTC"!==this.timezone){let[t,i,n,s,o=0]=this.dateTimeFormat({timeZoneName:"shortOffset"},e,"en").split(/(GMT|:)/).map(Number),r=-(60*(n+o/60)*6e4);if(O(r))return r}return 0}dateFormat(e,t,i){let n=this.lang;if(!g(t)||isNaN(t))return n?.invalidDate||"";if(T(e=e??"%Y-%m-%d %H:%M:%S")){let i,s=/%\[([a-zA-Z]+)\]/g;for(;i=s.exec(e);)e=e.replace(i[0],this.dateTimeFormat(i[1],t,n?.locale))}if(T(e)&&-1!==e.indexOf("%")){let i=this,[s,o,r,l,h,c,d,u]=this.toParts(t),p=n?.weekdays||this.weekdays,m=n?.shortWeekdays||this.shortWeekdays,g=n?.months||this.months,f=n?.shortMonths||this.shortMonths;S(y({a:m?m[u]:p[u].substr(0,3),A:p[u],d:R(r),e:R(r,2," "),w:u,v:n?.weekFrom??"",b:f[o],B:g[o],m:R(o+1),o:o+1,y:s.toString().substr(2,2),Y:s,H:R(l),k:l,I:R(l%12||12),l:l%12||12,M:R(h),p:l<12?"AM":"PM",P:l<12?"am":"pm",S:R(c),L:R(d,3)},a.dateFormats),function(n,s){if(T(e))for(;-1!==e.indexOf("%"+s);)e=e.replace("%"+s,"function"==typeof n?n.call(i,t,i):n)})}else if(E(e)){let i=(this.getTimezoneOffset(t)||0)/36e5,n=this.timezone||"Etc/GMT"+(i>=0?"+":"")+i,{prefix:s="",suffix:o=""}=e;e=s+this.dateTimeFormat(y({timeZone:n},e),t)+o}return i?L(e):e}resolveDTLFormat(e){return E(e,!0)?E(e,!0)&&void 0===e.main?{main:e}:e:{main:(e=I(e))[0],from:e[1],to:e[2]}}getDateFormat(e,t,i,n){let s=this.dateFormat("%m-%d %H:%M:%S.%L",t),o="01-01 00:00:00.000",r={millisecond:15,second:12,minute:9,hour:6,day:3},a="millisecond",l=a;for(a in Z){if(e&&e===Z.week&&+this.dateFormat("%w",t)===i&&s.substr(6)===o.substr(6)){a="week";break}if(e&&Z[a]>e){a=l;break}if(r[a]&&s.substr(r[a])!==o.substr(r[a]))break;"week"!==a&&(l=a)}return this.resolveDTLFormat(n[a]).main}},it=class extends ie{getBoundaryTicks(e,t,i,n){let s={};if(t===Z.year)return s;let o=g(i)&&g(n),r=t<Z.hour,a=t<Z.day,l=t<Z.month,h=t>=Z.hour?9e5:t>=Z.minute?6e4:t>=Z.second&&1e3;if(e.length<1e4){let c=!0;for(let d=0;d<e.length;d++){let u=e[d];if(o){if(u<i)continue;if(u>n)break}if(c){if(t===Z.month){s[u]="year",c=!1;continue}if(t===Z.hour){s[u]="day",c=!1;continue}}if(h&&u%h!=0){c=!1;continue}let[,p,m,g,f,y,b]=this.toParts(u),C=!g&&!f&&!y&&!b;r&&0===f&&(s[u]="hour"),a&&C&&(s[u]="day"),l&&1===m&&C&&(s[u]="month"),0===p&&1===m&&C&&(s[u]="year"),c=!1}}return s}getTimeTicks(e,t,i,n){let s=[],{count:o=1,unitRange:r}=e,a=t,[l,h,c,d,u,p]=this.toParts(t),m=(t||0)%1e3,f;if(n??(n=1),g(t)){if(m=r>=Z.second?0:o*Math.floor(m/o),r>=Z.second&&(p=r>=Z.minute?0:o*Math.floor(p/o)),r>=Z.minute&&(u=r>=Z.hour?0:o*Math.floor(u/o)),r>=Z.hour&&(d=r>=Z.day?0:o*Math.floor(d/o)),r>=Z.day&&(c=r>=Z.month?1:Math.max(1,o*Math.floor(c/o))),r>=Z.month&&(h=r>=Z.year?0:o*Math.floor(h/o)),r>=Z.year&&(l-=l%o),r===Z.week){o&&(t=this.makeTime(l,h,c,d,u,p,m));let e=this.dateTimeFormat({timeZone:this.timezone,weekday:"narrow"},t,"es"),i="DLMXJVS".indexOf(e);c+=-i+n+(i<n?-7:0)}t=this.makeTime(l,h,c,d,u,p,m),this.variableTimezone&&g(i)&&(f=i-t>4*Z.month||this.getTimezoneOffset(t)!==this.getTimezoneOffset(i));let e=t,a=1;for(;e<i;)s.push(e),r===Z.year?e=this.makeTime(l+a*o,0):r===Z.month?e=this.makeTime(l,h+a*o):f&&(r===Z.day||r===Z.week)?e=this.makeTime(l,h,c+a*o*(r===Z.day?1:7)):f&&r===Z.hour&&o>1?e=this.makeTime(l,h,c,d+a*o):e+=r*o,a++;s.push(e)}return s.info=y(e,{boundaryTicks:this.getBoundaryTicks(s,r,a,i),totalRange:r*o}),s}},{isTouchDevice:ii}=a,is={palette:{dark:{backgroundColor:"#141414",neutralColor:"#ffffff",highlightColor:"#2caffe"},light:{backgroundColor:"#ffffff",neutralColor:"#000000",highlightColor:"#0022ff",positiveColor:"#06b535",negativeColor:"#f21313"}},colors:Array(10).fill(1).map((e,t)=>`var(--highcharts-color-${t})`),symbols:["circle","diamond","square","triangle","triangle-down"],lang:{weekFrom:"week from",chartTitle:"Chart title",locale:void 0,loading:"Loading...",months:void 0,seriesName:"Series {add index 1}",shortMonths:void 0,weekdays:void 0,numericSymbols:["k","M","G","T","P","E"],pieSliceName:"Slice",resetZoom:"Reset zoom",yAxisTitle:"Values",resetZoomTitle:"Reset zoom level 1:1"},global:{buttonTheme:{fill:"var(--highcharts-neutral-color-3)",padding:8,r:2,stroke:"var(--highcharts-neutral-color-20)","stroke-width":1,style:{color:"var(--highcharts-neutral-color-80)",cursor:"pointer",fontSize:"0.8em",fontWeight:"normal"},states:{hover:{fill:"var(--highcharts-neutral-color-10)"},select:{fill:"var(--highcharts-highlight-color-10)",style:{color:"var(--highcharts-neutral-color-100)",fontWeight:"bold"}},disabled:{style:{color:"var(--highcharts-neutral-color-20)"}}}}},time:{Date:void 0,timezone:"UTC",timezoneOffset:0,useUTC:void 0},chart:{alignThresholds:!1,panning:{enabled:!1,type:"x"},styledMode:!1,borderRadius:0,colorCount:10,allowMutatingData:!0,ignoreHiddenSeries:!0,spacing:[10,10,15,10],resetZoomButton:{theme:{},position:{}},reflow:!0,selectionMarkerFill:"color-mix(in srgb, var(--highcharts-highlight-color-80) 25%, transparent)",type:"line",zooming:{singleTouch:!1,resetButton:{theme:{zIndex:6},position:{align:"right",x:-10,y:10}}},width:null,height:null,borderColor:"var(--highcharts-highlight-color-80)",backgroundColor:"var(--highcharts-background-color)",plotBorderColor:"var(--highcharts-neutral-color-20)"},title:{style:{color:"var(--highcharts-neutral-color-80)",fontWeight:"bold"},text:"Chart title",margin:15,minScale:.67},subtitle:{style:{color:"var(--highcharts-neutral-color-60)",fontSize:"0.8em"},text:""},caption:{margin:15,style:{color:"var(--highcharts-neutral-color-60)",fontSize:"0.8em"},text:"",align:"left",verticalAlign:"bottom"},plotOptions:{},legend:{enabled:!0,align:"center",alignColumns:!0,className:"highcharts-no-tooltip",events:{},layout:"horizontal",itemMarginBottom:2,itemMarginTop:2,labelFormatter:function(){return this.name},borderColor:"var(--highcharts-neutral-color-40)",borderRadius:0,navigation:{style:{fontSize:"0.8em"},activeColor:"var(--highcharts-highlight-color-100)",inactiveColor:"var(--highcharts-neutral-color-20)"},itemStyle:{color:"var(--highcharts-neutral-color-80)",cursor:"pointer",fontSize:"0.8em",textDecoration:"none",textOverflow:"ellipsis"},itemHoverStyle:{color:"var(--highcharts-neutral-color-100)"},itemHiddenStyle:{color:"var(--highcharts-neutral-color-60)",textDecoration:"line-through"},shadow:!1,itemCheckboxStyle:{position:"absolute",width:"13px",height:"13px"},squareSymbol:!0,symbolPadding:5,verticalAlign:"bottom",x:0,y:0,title:{style:{color:"var(--highcharts-neutral-color-80)",fontSize:"0.8em",fontWeight:"bold"}}},loading:{labelStyle:{fontWeight:"bold",position:"relative",top:"45%"},style:{position:"absolute",backgroundColor:"var(--highcharts-background-color)",opacity:.5,textAlign:"center"}},tooltip:{enabled:!0,animation:{duration:300,easing:e=>Math.sqrt(1-Math.pow(e-1,2))},borderColor:"light-dark(var(--highcharts-neutral-color-5), var(--highcharts-neutral-color-20))",borderRadius:5,dateTimeLabelFormats:{millisecond:"%[AebHMSL]",second:"%[AebHMS]",minute:"%[AebHM]",hour:"%[AebHM]",day:"%[AebY]",week:"%v %[AebY]",month:"%[BY]",year:"%[Y]"},footerFormat:"",header:{distance:5,shape:"callout",style:{fontSize:"1em"}},hideDelay:500,showDelay:0,padding:8,position:{x:0,y:3},shared:!1,snap:ii?25:10,headerFormat:'<span style="font-size: 0.8em">{ucfirst point.key}</span><br/>',pointFormat:'<span style="color:{point.color}">●</span> {series.name}: <b>{point.y}</b><br/>',backgroundColor:"var(--highcharts-background-color)",borderWidth:void 0,stickOnContact:!1,style:{color:"var(--highcharts-neutral-color-80)",cursor:"default",fontSize:"0.8em"},useHTML:!1},credits:{enabled:!0,href:"https://www.highcharts.com?credits",position:{align:"right",verticalAlign:"bottom",x:-10,y:-5},style:{cursor:"pointer",color:"var(--highcharts-neutral-color-40)",fontSize:"0.6em"},text:"Highcharts.com"}},io=new it(is.time,is.lang),{defaultOptions:ir,defaultTime:ia}={defaultOptions:is,defaultTime:io,getOptions:function(){return is},setOptions:function(e){return b(a,"setOptions",{options:e}),M(!0,is,e),e.time&&io.update(is.time),e.lang&&"locale"in e.lang&&io.update({locale:e.lang.locale}),e.lang?.chartTitle&&(is.title={...is.title,text:e.lang.chartTitle}),is}},{pageLang:il}=a,ih={add:(e,t)=>e+t,divide:(e,t)=>0!==t?u(e/t):"",eq:(e,t)=>e==t,each:function(e){let t=arguments[arguments.length-1];return!!x(e)&&e.map((i,n)=>id(t.body,y(E(i)?i:{"@this":i},{"@index":n,"@first":0===n,"@last":n===e.length-1}))).join("")},ge:(e,t)=>e>=t,gt:(e,t)=>e>t,if:e=>!!e,le:(e,t)=>e<=t,lt:(e,t)=>e<t,multiply:(e,t)=>u(e*t,15),ne:(e,t)=>e!=t,subtract:(e,t)=>e-t,ucfirst:L,unless:e=>!e},ic={};function id(e="",t,i){let n=/\{([^{}]+)\}/g,s=/\(([^()]+)\)/g,o=[],r=/f$/,a=/\.(\d)/,l=i?.options?.lang||ir.lang,c=i?.time||ia,d=i?.numberFormatter||iu.bind(i),u=(e="")=>{let i;if("true"===e)return!0;if("false"===e)return!1;if((i=Number(e)).toString()===e)return i;if(/^["'].+["']$/.test(e))return e.slice(1,-1);var n=t;let s=e.split(".");for(;s.length&&g(n);){let e=s.shift();if(void 0===e||"__proto__"===e)return;if("this"===e){let e;return E(n)&&(e=n["@this"]),e??n}let t=n[e.replace(/[\\'"]/g,"")];if(!g(t)||"function"==typeof t||"number"==typeof t.nodeType||t===h)return;n=t}return n},p,m,f=0,y;for(;null!==(p=n.exec(e));){let i=p,n=s.exec(p[1]);n&&(p=n,y=!0),m?.isBlock||(m={ctx:t,expression:p[1],find:p[0],isBlock:"#"===p[1].charAt(0),start:p.index,startInner:p.index+p[0].length,length:p[0].length});let r=(m.isBlock?i:p)[1].split(" ")[0].replace("#","");ih[r]&&(m.isBlock&&r===m.fn&&f++,m.fn||(m.fn=r));let a="else"===p[1];if(m.isBlock&&m.fn&&(p[1]===`/${m.fn}`||a))if(f)!a&&f--;else{let t=m.startInner,i=e.substr(t,p.index-t);void 0===m.body?(m.body=i,m.startInner=p.index+p[0].length):m.elseBody=i,m.find+=i+p[0],a||(o.push(m),m=void 0)}else m.isBlock||o.push(m);if(n&&!m?.isBlock)break}return o.forEach(n=>{let o,h,{body:p,elseBody:m,expression:g,fn:f}=n;if(f){let e=[n],s=[],r=g.length,a=0,l;for(h=0;h<=r;h++){let e=g.charAt(h);l||'"'!==e&&"'"!==e?l===e&&(l=""):l=e,l||" "!==e&&h!==r||(s.push(g.substr(a,h-a)),a=h+1)}for(h=ih[f].length;h--;)e.unshift(u(s[h+1]));o=ih[f].apply(t,e),n.isBlock&&"boolean"==typeof o&&(o=id(o?p:m,t,i))}else{let e=/^["'].+["']$/.test(g)?[g]:g.split(":");if(o=u(e.shift()||""),e.length&&"number"==typeof o){let t=e.join(":");if(r.test(t)){let e=parseInt((t.match(a)||["","-1"])[1],10);null!==o&&(o=d(o,e,l.decimalPoint,t.indexOf(",")>-1?l.thousandsSep:""))}else o=c.dateFormat(t,o)}s.lastIndex=0,s.test(n.find)&&T(o)&&(o=`"${o}"`)}e=e.replace(n.find,A(o,""))}),y?id(e,t,i):e}function iu(e,t,i,n){t*=1;let s,o,[r,a]=(e=+e||0).toString().split("e").map(Number),l=this?.options?.lang||ir.lang,h=(e.toString().split(".")[1]||"").split("e")[0].length,c=t,d={};i??(i=l.decimalPoint),n??(n=l.thousandsSep),-1===t?t=Math.min(h,20):O(t)?t&&a<0&&((o=t+a)>=0?(r=+r.toExponential(o).split("e")[0],t=o):(r=Math.floor(r),e=t<20?+(r*Math.pow(10,a)).toFixed(t):0,a=0)):t=2,a&&(t??(t=2),e=r),O(t)&&t>=0&&(d.minimumFractionDigits=t,d.maximumFractionDigits=t),""===n&&(d.useGrouping=!1);let u=n||i,p=u?"en":this?.locale||l.locale||il,m=JSON.stringify(d)+p;return s=(ic[m]??(ic[m]=new Intl.NumberFormat(p,d))).format(e),u&&(s=s.replace(/([,\.])/g,"_$1").replace(/_\,/g,n??",").replace("_.",i??".")),(t||0!=+s)&&(!(a<0)||c)||(s="0"),a&&0!=+s&&(s+="e"+(a<0?"":"+")+a),s}let{format:ip}={dateFormat:function(e,t,i){return ia.dateFormat(e,t,i)},format:id,helpers:ih,numberFormat:iu};class im extends ti{constructor(e,t,i){super(e,t=M(im.defaultOptions,t),i),this.options=t,this.type="KPI",this.value=p("span",{className:`${t.className}-value`},{},this.contentElement),this.subtitle=p("span",{className:this.getSubtitleClassName()},{},this.contentElement)}async load(){return await super.load(),this.linkValueToChart(),this}resize(e,t){return super.resize(e,t),this.chart&&this.chart.container&&this.chart.reflow(),this}render(){super.render(),this.updateElements();let e=im.charter?.Chart;return e&&this.options.chartOptions&&!this.chart?(this.chartContainer||(this.chartContainer=p("div",{className:`${this.options.className}-chart-container`},{padding:"0.1px"},this.contentElement)),this.chart=e.chart(this.chartContainer,M(im.defaultChartOptions,this.options.chartOptions))):this.chart&&!this.options.chartOptions&&"chartOptions"in this.options&&(this.chart.destroy(),this.chart=void 0),this.sync.start(),this.emit({type:"afterRender"}),this}async update(e,t=!0){await super.update(e),e.chartOptions&&this.chart&&this.chart.update(e.chartOptions),t&&this.render()}onTableChanged(){this.setValue()}destroy(){this.chart?.destroy(),super.destroy()}getFormulaValue(){let e=this.options.formula,t=this.getDataTable(),i=t?.getColumn(this.options.columnId);if(!i||!e)return;if(N(e))return e.call(this,i);let n=Array.isArray(i)?i.slice().filter(g):Array.from(i);("MIN"===e||"MAX"===e||"MEDIAN"===e)&&(n=n.filter(e=>""!==e&&!isNaN(Number(e)))),"MEDIAN"===e&&n.sort((e,t)=>Number(e)-Number(t));try{return im.formulaFunctions[e](n)}catch{console.warn("Invalid formula option provided.")}}getValue(){if(g(this.options.value))return this.options.value;let e=this.getDataTable()?.getModified();if(e&&this.options.columnId){if(g(this.options.formula))return this.getFormulaValue();let t=e.getColumn(this.options.columnId),i=t?.length||0;return String(e.getCell(this.options.columnId,i-1))}}setValue(e=this.getValue()){let{valueFormat:t,valueFormatter:i}=this.options;if(g(e)){let n;O(+e)&&(n=+e),i?e=i.call(this,e):t?e=ip(t,{value:e}):O(e)&&(e=e.toLocaleString()),eR.setElementHTML(this.value,""+e),this.linkValueToChart(n),this.prevValue=n}}linkValueToChart(e=this.getValue()){let t=this.chart,i=this.options.linkedValueTo;if(!t||!i.enabled||!g(e)||!O(+e))return;e*=1;let n=t.series[i.seriesIndex??0],s=n?.points[i.pointIndex??0];n?s?s.update({y:e}):n.addPoint({y:e}):t.addSeries({data:[{y:e}]})}updateElements(){let{style:e,subtitle:t}=this.options;this.setValue(),eR.setElementHTML(this.subtitle,this.getSubtitle()),e&&m(this.element,e),"object"==typeof t&&(t.style&&m(this.subtitle,t.style),this.subtitle.className=this.getSubtitleClassName()),this.chartContainer&&(this.chartContainer.style.flex=this.options.chartOptions?"1":"0"),this.chart&&this.chart.reflow(),this.value.style.color=this.getValueColor()}getSubtitle(){let{subtitle:e,value:t}=this.options;if("string"==typeof e)return e;if(e){if(O(this.prevValue)&&O(t)){let i=t-this.prevValue,n="";if(i>0)n='<span style="color:green">&#9650;</span> +';else{if(!(i<0))return this.subtitle.innerHTML;n='<span style="color:red">&#9660;</span> '}if("diff"===e.type)return n+i.toLocaleString();if("diffpercent"===e.type)return n+ip("{v:,.2f}%",{v:i/this.prevValue*100})}return e.text||""}return""}getSubtitleClassName(){let{subtitle:e}=this.options;return`${ti.defaultOptions.className}-subtitle`+("object"==typeof e&&e.className||"")}getValueColor(){let{threshold:e,thresholdColors:t,value:i}=this.options;if(t&&e&&O(i)){if(x(e)){for(let n=e.length-1;n>=0;n--)if(i>=e[n]){if(n+1<t.length)return t[n+1];return t[t.length-1]}}else if(i>=e)return t[1];return t[0]}return""}getOptionsOnDrop(e){let t=e.editMode.board.dataPool.getConnectorIds(),i={type:"KPI"};return t.length&&(i={...i,connector:{id:t[0]}}),i}getOptions(){return{...f(this.options,im.defaultOptions),type:"KPI"}}}im.defaultOptions=M(ti.defaultOptions,tN),im.predefinedSyncConfig=tx,im.defaultChartOptions={chart:{type:"spline",zooming:{mouseWheel:{enabled:!1}}},title:{text:void 0},xAxis:{visible:!1},yAxis:{visible:!1,title:{text:null}},legend:{enabled:!1},credits:{enabled:!1},tooltip:{outside:!0},plotOptions:{series:{marker:{enabled:!1}}}},im.formulaFunctions={SUM:tK,AVERAGE:tX,MEDIAN:tQ,MAX:t1,MIN:t3,COUNT:t4,PRODUCT:t6};let ig={type:"Navigator",className:[ti.defaultOptions.className,`${ti.defaultOptions.className}-navigator`].join(" "),chartOptions:{chart:{animation:!1,height:200,type:"column",zooming:{mouseWheel:{enabled:!1}}},credits:{enabled:!1},legend:{enabled:!1},navigator:{enabled:!0,outlineWidth:0,series:{animation:!1,lineWidth:0,colorIndex:0},xAxis:{endOnTick:!0,gridZIndex:4,labels:{x:1,y:22},opposite:!0,showFirstLabel:!0,showLastLabel:!0,startOnTick:!0,tickPosition:"inside"},yAxis:{maxPadding:.5}},plotOptions:{series:{borderRadius:0,marker:{enabled:!1},states:{hover:{enabled:!1}}}},scrollbar:{enabled:!0},title:{text:""},tooltip:{enabled:!1},xAxis:{visible:!1,minRange:5e-324},yAxis:{visible:!1}},editableOptions:(ti.defaultOptions.editableOptions||[]).concat()},iy=function(e,t,i,n){let s=!1,o=!1;("object"!=typeof e.condition||"and"!==e.condition.operator)&&(e.condition={operator:"and",conditions:[]});let{conditions:r}=e.condition;for(let e=0,a=r.length;e<a;++e){let a=r[e];if(a&&"object"==typeof a&&("<="===a.operator||">="===a.operator)&&a.columnId===t&&("<="===a.operator?(a.value=n,o=!0):(a.value=i,s=!0),s&&o))return}o||r.push({operator:"<=",columnId:t,value:n}),s||r.push({operator:">=",columnId:t,value:i})},ib=function(e){let t={};if("object"!=typeof e.condition||"and"!==e.condition.operator)return[];let{conditions:i}=e.condition;for(let e=0,n=i.length;e<n;++e){let n=i[e];if(!n||"object"!=typeof n||"<="!==n.operator&&">="!==n.operator||"string"!=typeof n.columnId||!g(n.value))continue;let s=n.columnId;t[s]||(t[s]={maxValue:1/0,minValue:-1/0,columnId:s}),"<="===n.operator?t[s].maxValue=n.value:t[s].minValue=n.value}return Object.values(t)},{Filter:iC}=U.types,iw={defaultOptions:{affectNavigator:!1},syncPair:{emitter:function(){let e;if("Navigator"!==this.type)return;let t=this,i=this.sync.syncConfig.crossfilter,n=i.group?":"+i.group:"",s=async e=>{if(t.connectorHandlers?.[0]?.connector){let i=t.connectorHandlers[0].connector.getTable(),s=t.board.dataCursor,o=t.getColumnAssignment()[0],[r,a]=t.getAxisExtremes(),l=i.getModifier();l instanceof iC?iy(l.options,o,r,a):l=new iC({condition:{operator:"and",conditions:[{columnId:o,operator:">=",value:r},{columnId:o,operator:"<=",value:a}]}}),await i.setModifier(l),s.emitCursor(i,{type:"position",column:o,row:i.getRowIndexBy(o,r),state:"crossfilter"+n},e),s.emitCursor(i,{type:"position",column:o,row:i.getRowIndexBy(o,a),state:"crossfilter"+n},e)}};return c(t.chart.xAxis[0],"afterSetExtremes",function(t){clearTimeout(e),e=setTimeout(s,50,this,t)})},handler:void 0}},{Filter:iv}=U.types,iO={defaultOptions:{},syncPair:{emitter:function(){let e;if("Navigator"!==this.type)return;let t=this,i=this.sync.syncConfig.extremes,n=i.group?":"+i.group:"",s=e=>{if(t.connectorHandlers?.[0]?.connector){let i=t.connectorHandlers[0].connector.getTable(),s=t.board.dataCursor,o=t.getColumnAssignment()[0],[r,a]=t.getAxisExtremes();s.emitCursor(i,{type:"position",column:o,row:i.getRowIndexBy(o,r),state:"xAxis.extremes.min"+n},e),s.emitCursor(i,{type:"position",column:o,row:i.getRowIndexBy(o,a),state:"xAxis.extremes.max"+n},e)}};return c(t.chart.xAxis[0],"afterSetExtremes",function(t){clearTimeout(e),e=setTimeout(s,50,this,t)})},handler:function(){let e;if("Navigator"!==this.type)return;let t=this,i=this.sync.syncConfig.extremes,n=i.group?":"+i.group:"",s=t.board.dataCursor,o=e=>{let i=e.cursor;if(!t.connectorHandlers?.[0]?.connector)return;let s=t.connectorHandlers[0].connector.getTable(),o=s.getColumnIds()[0],r=s.getRowCount(),a=0;"range"===i.type?(r=i.lastRow,a=i.firstRow,i.columns&&(o=A(i.columns[0],o))):i.state==="xAxis.extremes.max"+n?(o=A(i.column,o),r=A(i.row,r)):(o=A(i.column,o),a=A(i.row,a));let l=s.getModifier();if("string"==typeof o&&l instanceof iv){let e=s.getCell(o,a),t=s.getCell(o,r);g(t)&&g(e)&&(iy(l.options,o,e,t),s.setModifier(l))}};return(e=t.connectorHandlers?.[0]?.connector?.getTable())&&(s.addListener(e.id,"xAxis.extremes"+n,o),s.addListener(e.id,"xAxis.extremes.max"+n,o),s.addListener(e.id,"xAxis.extremes.min"+n,o)),()=>{let e=t.connectorHandlers?.[0]?.connector?.getTable();e&&(s.removeListener(e.id,"xAxis.extremes"+n,o),s.removeListener(e.id,"xAxis.extremes.max"+n,o),s.removeListener(e.id,"xAxis.extremes.min"+n,o))}}}},iT={defaultSyncPairs:{crossfilter:iw.syncPair,extremes:iO.syncPair},defaultSyncOptions:{crossfilter:iw.defaultOptions,extremes:iO.defaultOptions}};class ix extends ti{constructor(e,t){super(e,t),this.type="Navigator",this.options=M(ix.defaultOptions,t);const i=ix.charter.Chart||ej.win.Highcharts;this.chartContainer=ej.win.document.createElement("div"),this.chart=i.chart(this.chartContainer,this.options.chartOptions||{}),this.chartContainer.classList.add(ej.classNamePrefix+"navigator"),this.sync.syncConfig.crossfilter?.enabled&&this.chart.update(M({navigator:{xAxis:{labels:{format:"{value}"}}}},this.options.chartOptions||{}),!1)}adjustNavigator(){let e=this.chart,t=A(e.chartHeight,this.contentElement.clientHeight),i=this.contentElement.clientWidth,n={};if((e.chartHeight!==t||e.chartWidth!==i)&&(n.chart={height:t,width:i}),e.navigator){let i=e.navigator,s=i.top-e.plotTop+i.height;i.height!==s&&(n.navigator={handles:{height:Math.round(t/4)},height:s}),Object.keys(n).length&&e.update(n,!1),i.series&&i.series[0]&&i.series[0].update({type:e.series[0].type},!1)}else Object.keys(n).length&&e.update(n,!1)}getColumnAssignment(){let e,t=this.options.columnAssignment??{};for(let i of Object.keys(t))if(null!==(e=t[i]))return[i,e];let i=this.getDataTable();if(i){let e=i.getColumnIds();if(e.length)return[e[0],"y"]}return["","y"]}getOptions(){return{...f(this.options,ig),type:"Navigator"}}getAxisExtremes(){let e=this.chart.xAxis[0],t=e.getExtremes(),i=O(t.min)?t.min:t.dataMin,n=O(t.max)?t.max:t.dataMax;return this.categories?[this.categories[Math.max(0,Math.ceil(i))],this.categories[Math.min(this.categories.length-1,Math.floor(n))]]:e.hasNames?[e.names[Math.ceil(i)],e.names[Math.floor(n)]]:[i,n]}async load(){return await super.load(),this.contentElement.appendChild(this.chartContainer),this.parentElement.appendChild(this.element),this.adjustNavigator(),this.emit({type:"afterLoad"}),this}onTableChanged(){this.renderNavigator()}redrawNavigator(){let e=this.resizeTimeouts;for(let t=0,i=e.length;t<i;++t)clearTimeout(e[t]);e.length=0,e.push(setTimeout(()=>{this.adjustNavigator(),this.chart.redraw()},33))}render(){return super.render(),this.renderNavigator(),this.sync.start(),this.emit({type:"afterRender"}),this}renderNavigator(){let e=this.chart,t=this.getDataTable();if(t){let i,n=this.getColumnAssignment(),s=t.getColumn(n[0],!0)||[];i=this.sync.syncConfig.crossfilter?.enabled?this.generateCrossfilterData():s.slice(),e.series[0]?e.series[0].setData(i,!1):e.addSeries({id:t.id,data:i},!1)}this.redrawNavigator()}generateCrossfilterData(){let e,t=this.sync.syncConfig.crossfilter,i=this.getDataTable(),n=i?.getColumn(this.getColumnAssignment()[0],!0)||[];if(!i||n.length<1||!t)return[];let s=[],o=[];for(let e=0,t=n.length;e<t;e++){let t=n[e];if(null!==t){if(O(t)||(t=`${t}`),void 0===this.stringData)this.stringData=T(t);else if(this.stringData!==T(t))throw Error("Mixed data types in crossfilter navigator are not supported.");s.push(t),-1===o.indexOf(t)&&o.push(t)}}o.sort((e,t)=>A(e,NaN)<A(t,NaN)?-1:+(e!==t));let r=i.getModifier()?.options;if(t.affectNavigator&&r?.type==="Filter"){let t=[],n=[],o=ib(r);for(let e=0,s=o.length;e<s;e++)o[e].columnId!==this.getColumnAssignment()[0]&&(t.push(o[e]),n.push(i.getColumn(o[e].columnId,!0)||[]));e=[];let a=t.length;for(let i=0,o=s.length;i<o;i++){let o=s[i],r=!0;for(let e=0;e<a;e++){let s=t[e];if(!(n[e][i]>=(s.minValue??-1/0)&&n[e][i]<=(s.maxValue??1/0))){r=!1;break}}r&&e.push(o)}}else e=s;let a=[];if(this.stringData){this.categories=o;for(let e=0,t=o.length;e<t;e++)a.push([e,null])}else for(let e=0,t=o.length;e<t;e++)a.push([o[e],null]);for(let t=0,i=e.length;t<i;t++){let i=o.indexOf(e[t]);a[i][1]=(a[i][1]||0)+1}return a}resize(e,t){return super.resize(e,t),this.redrawNavigator(),this}async update(e,t=!0){let i=this.chart;await super.update(e,!1),e.chartOptions&&i.update(M(this.sync.syncConfig.crossfilter?.enabled?{navigator:{xAxis:{labels:{format:"{value}"}}}}:{},e.chartOptions),!1),this.emit({type:"afterUpdate"}),t&&this.render()}getOptionsOnDrop(){return{}}}ix.defaultOptions=M(ti.defaultOptions,ig),ix.predefinedSyncConfig=iT;let iN={custom:{connectHighcharts:function(e){tO.charter=e,im.charter=e,ix.charter=e}},name:"Highcharts.DashboardsPlugin",onRegister:function(e){let{ComponentRegistry:t}=e;t.registerComponent("Highcharts",tO),t.registerComponent("KPI",im),t.registerComponent("Navigator",ix)},onUnregister:function(e){}},iE={};ej.board=tr.board,ej.addEvent=c,ej.createElement=p,ej.css=m,ej.defined=g,ej.diffObjects=f,ej.error=e6.error,ej.find=w,ej.fireEvent=b,ej.getStyle=C,ej.isArray=x,ej.isFunction=N,ej.isNumber=O,ej.isObject=E,ej.isString=T,ej.merge=M,ej.objectEach=S,ej.pick=A,ej.removeEvent=P,ej.setOptions=function(e){M(!0,eW,e)},ej.splat=I,ej.uniqueKey=K,ej.AST=eR,ej.Board=tr,ej.Component=ti,ej.ComponentRegistry=eP,ej.GridComponent=tp,ej.HighchartsComponent=tO,ej.HTMLComponent=to,ej.KPIComponent=im,ej.NavigatorComponent=ix,ej.DataConnector=es,ej.DataConverter=$,ej.DataCursor=eT,ej.DataModifier=U,ej.DataPool=e_,ej.DataTable=ei,ej.defaultOptions=eW,ej.GridPlugin=tm,ej.HighchartsPlugin=iN,ej.PluginHandler={addPlugin:function(e,t=e.name){let{maxRevision:i,minRevision:n,onRegister:s}=e;if(iE[t]){if(t!==e.name)throw Error(`Plugin '${t}' already registered.`);return}if("number"==typeof n&&n>0||"number"==typeof i&&i<0)throw Error(`Plugin '${t}' does not support revision 0.`);s({Board:tr,ComponentRegistry:eP,Sync:e3,revision:0}),iE[t]=e},removePlugin:function(e){iE[e]&&(iE[e].onUnregister({ComponentRegistry:eP,Board:tr,Sync:e3,revision:0}),delete iE[e])},registry:iE,revision:0},ej.Sync=e3,ej.win.Dashboards||(ej.win.Dashboards=ej),ej.win.Grid&&(tm.custom.connectGrid(ej.win.Grid),ej.PluginHandler.addPlugin(tm)),ej.win.Highcharts&&(iN.custom.connectHighcharts(ej.win.Highcharts),ej.PluginHandler.addPlugin(iN));let iM=ej;return r.default})());