/**
 * Skipped minification because the original files appears to be already minified.
 * Original file: /npm/@highcharts/dashboards@4.2.3/dashboards.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
!/**
 * Highcharts Dashboards v4.2.3 (2026-09-20)
 * @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,o,s={};s.d=(e,t)=>{for(var i in t)s.o(t,i)&&!s.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);let r={};s.d(r,{default:()=>ix}),(t=e||(e={})).SVG_NS="http://www.w3.org/2000/svg",t.product="Highcharts",t.version="4.2.3",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={get passive(){return 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 o="function"==typeof e&&e.prototype||e;Object.hasOwnProperty.call(o,"hcEvents")||(o.hcEvents={});let s=o.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}),s[t]||(s[t]=[]);let l={fn:i,order:"number"==typeof n.order?n.order:1/0};return s[t].push(l),s[t].sort((e,t)=>e.order-t.order),function(){A(e,t,i)}}function d(e,t,i){let n,o=T(t)&&!g(i),s=(t,i)=>{g(t)?e.setAttribute(i,t):o?(n=e.getAttribute(i))||"class"!==i||(n=e.getAttribute(i+"Name")):e.removeAttribute(i)};return T(t)?s(i,t):R(t,s),n}function u(e,t){return e>1e14?e:parseFloat(e.toPrecision(t||14))}function p(e,t,i,n,o){let s=l.createElement(e);return t&&y(s,t),o&&m(s,{padding:"0",border:"none",margin:"0"}),i&&m(s,i),n&&n.appendChild(s),s}function m(e,t){y(e.style,t)}function g(e){return null!=e}function f(e,t,i,n){let o={};return!function e(t,o,s,r){let a=i?o:t;R(t,function(i,l){if(!r&&n&&n.indexOf(l)>-1&&o[l]){i=P(i),s[l]=[];for(let t=0;t<Math.max(i.length,o[l].length);t++)o[l][t]&&(void 0===i[t]?s[l][t]=o[l][t]:(s[l][t]={},e(i[t],o[l][t],s[l][t],r+1)))}else M(i,!0)&&!i.nodeType?(s[l]=x(i)?[]:{},e(i,o[l]||{},s[l],r+1),0===Object.keys(s[l]).length&&("colorAxis"!==l||0!==r)&&delete s[l]):(t[l]!==o[l]||l in t&&!(l in o))&&"__proto__"!==l&&"constructor"!==l&&(s[l]=a[l])})}(e,t,o,0),o}function y(e,t){let i;for(i in e||(e={}),t)"__proto__"!==i&&"constructor"!==i&&(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=[],o=e,s=!1;for(;o.hcEvents;)Object.hasOwnProperty.call(o,"hcEvents")&&o.hcEvents[t]&&(n.length&&(s=!0),n.unshift.apply(n,o.hcEvents[t])),o=Object.getPrototypeOf(o);s&&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 o=h.getComputedStyle(e,void 0);return o&&(n=o.getPropertyValue(t),(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 M(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 E(e){return"function"==typeof e}function M(e,t){return!!e&&"object"==typeof e&&(!t||!x(e))}function S(e,...t){let i,n=[e,...t],o={},s=function(e,t){return"object"!=typeof e&&(e={}),R(t,function(i,n){if("__proto__"!==n&&"constructor"!==n){let o;!M(i,!0)||(o=i?.constructor,M(i,!0)&&!v(i)&&o?.name&&"Object"!==o.name)||v(i)?e[n]=t[n]:e[n]=s(e[n]||{},i)}}),e};!0===e&&(o=n[1],n=Array.prototype.slice.call(n,2));let r=n.length;for(i=0;i<r;i++)o=s(o,n[i]);return o}function R(e,t,i){for(let n in e)Object.hasOwnProperty.call(e,n)&&t.call(i||e[n],e[n],n,e)}function N(e,t,i){return Array((t||2)+1-String(e).replace("-","").length).join(i||"0")+e}function A(e,t,i){function n(t,i){let n=e.removeEventListener;n&&n.call(e,t,i,!1)}function o(i){let o,s;e.nodeName&&(t?(o={})[t]=!0:o=i,R(o,function(e,t){if(i[t])for(s=i[t].length;s--;)n(t,i[t][s].fn)}))}let s="function"==typeof e&&e.prototype||e;if(Object.hasOwnProperty.call(s,"hcEvents")){let e=s.hcEvents;if(t){let s=e[t]||[];i?(e[t]=s.filter(function(e){return i!==e.fn}),n(t,i)):(o(e),e[t]=[])}else o(e),delete s.hcEvents}}function P(e){return x(e)?e:[e]}function I(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 L=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)},k=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 0/0;e=e.replace(t,"$1.$2")}return parseFloat(e)}return e instanceof Date?e.getDate():e?e.getRowCount():0/0},H=function(e){return""+e},F=function(e=[],t){let i={};for(let n=0,o=Math.max(t.length,e.length);n<o;++n)i[t[n]||`${n}`]=e[n]?e[n].slice():[];return i},j=function(e,t){let i="string";if("string"==typeof e){let n=D(`${e}`),o=t.decimalRegExp,s=D(n,!0);o&&(s=o.test(s)?s.replace(o,"$1.$2"):"");let r=parseFloat(s);+s===r?e=r:i=O(t.parseDate(e))?"Date":"string"}return"number"==typeof e&&(i=e>31536e6?"Date":"number"),i};class z{static registerType(e,t){return!!e&&!z.types[e]&&!!(z.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]):0/0}},"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]):0/0},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]):0/0}},"dd/mm/YY":{regex:/^(\d{1,2})([\-\.\/])(\d{1,2})\2(\d{2})$/,parser:function(e){let t=new Date;if(!e)return 0/0;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]):0/0}}};let t=S(z.defaultOptions,e),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=>k(e,t.decimalRegExp),Date:e=>L(e,t),string:H})[j(e,t)].call(t,e)}deduceDateFormat(e,t,i){let n=[],o=[],s="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(r=e[l].trim().replace(/[\-\.\/]/g," ").split(" "),a=["","",""],d=0;d<r.length;d++)d<a.length&&(c=parseInt(r[d],10))&&(o[d]=!o[d]||o[d]<c?c:o[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]?o[d]>12&&"YY"!==a[d]&&"YYYY"!==a[d]&&(a[d]="YY"):o[d]>12&&"mm"===a[d]&&(a[d]="dd");3===a.length&&"dd"===a[1]&&"dd"===a[2]&&(a[2]="YY"),s=a.join("/")}return i&&(this.options.dateFormat=s),s}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,o=0/0,s,r=null;if(i.parseDate)o=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))&&(o=i.parser(r))}else for(s in t){let i=t[s];if(r=e.match(i.regex)){n=s,o=i.parser(r);break}}if(!r){let t=Date.parse(e);!isNaN(t)&&(o=t-6e4*new Date(t).getTimezoneOffset(),e.includes("2001")||2001!==new Date(o).getFullYear()||(o=0/0))}}return o}}z.defaultOptions={dateFormat:"",firstRowAsNames:!0},z.types={};let V=z;class $ extends V{constructor(e){let t=S($.defaultOptions,e);super(t),this.headers=[],this.dataTypes=[],this.options=t}parse(e,t){let i=this.dataTypes,n=S(this.options,e),{beforeParse:o,lineDelimiter:s,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&&o&&(c=o(c)),c){if(l=c.replace(/\r\n|\r/g,"\n").split(s||"\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}),F(m,this.headers)}parseCSVRow(e,t,i){let n=this,o=n.dataTypes,{startColumn:s,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=>{o.length<p+1&&o.push([e]),o[p][o[p].length-1]!==e&&o[p].push(e)},f=()=>{if(s>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"!==j(d,n)&&l){let e=d;"number"!==j(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,o={",":0,";":0,"	":0},s=e.length;for(let n=0;n<s;n++){let s=!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(s){if('"'!==l&&'"'!==a){for(;" "===a&&e<c.length;)a=c[++e];void 0!==o[a]&&o[a]++,s=!1}}else s=!0;else void 0!==o[r]?(isNaN(Date.parse(h=h.trim()))?(isNaN(Number(h))||!isFinite(Number(h)))&&o[r]++:o[r]++,h=""):h+=r;","===r&&i++,"."===r&&t++}}return o[";"]>o[","]?n=";":(o[","]>o[";"],n=","),t>i?this.guessedDecimalPoint=".":this.guessedDecimalPoint=",",n}}$.defaultOptions={...V.defaultOptions,lineDelimiter:"\n",startColumn:0,endColumn:Number.MAX_VALUE,startRow:0,endRow:Number.MAX_VALUE},V.registerType("CSV",$);class B{static registerType(e,t){return!!e&&!B.types[e]&&!!(B.types[e]=t)}benchmark(e,t){let i=[],n=this,o=()=>{n.modifyTable(e),n.emit({type:"afterBenchmarkIteration"})},{iterations:s}=S({iterations:1},t);n.on("afterBenchmarkIteration",()=>{i.length===s?n.emit({type:"afterBenchmark",results:i}):o()});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)}),o(),i}emit(e){b(this,e.type,e)}modify(e,t){let i=this;return new Promise((n,o)=>{e.modified||(e.modified=e.clone(!1,t));try{n(i.modifyTable(e,t))}catch(n){i.emit({type:"error",detail:t,table:e}),o(n instanceof Error?n:Error(""+n))}})}on(e,t){return c(this,e,t)}}B.types={};let _=B,G={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,o=[]){if(Array.isArray(e))return Array.isArray(o)||(o=Array.from(o)),{removed:e.splice(t,i,...o),array:e};let s=Object.getPrototypeOf(e).constructor,r=e[n?"subarray":"slice"](t,t+i),a=new s(e.length-i+o.length);return a.set(e.subarray(0,t),0),a.set(o,t),a.set(e.subarray(t+i),t+o.length),{removed:r,array:a}}},{charts:U,win:Y}=a;function W(e,t,i,n){let o=t?"Highcharts error":"Highcharts warning";32===e&&(e=`${o}: Deprecated member`);let s=O(e),r=s?`${o} #${e}: www.highcharts.com/errors/${e}/`:e.toString();if(void 0!==n){let e="";s&&(r+="?"),R(n,function(t,i){e+=`
 - ${i}: ${t}`,s&&(r+=encodeURI(i)+"="+encodeURI(t))}),r+=e}b(a,"displayError",{chart:i,code:e,message:r,params:n},function(){if(t)throw Error(r);Y.console&&-1===W.messages.indexOf(r)&&console.warn(r)}),W.messages.push(r)}(W||(W={})).messages=[];let J={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)+"-",o=0,function(){return"highcharts-"+(i?"":n)+o++});Y.jQuery&&(Y.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):U[d(this[0],"data-highcharts-chart")]});let{setLength:Z,splice:q}=G,X=class{constructor(e={}){this.isDataTable=!0;let t=this.isPollutingKey(e.id)?void 0:e.id;this.autoId=!t,this.columns={},this.id=t||K(),this.rowCount=0,this.versionTag=K();let i=0;R(e.columns||{},(e,t)=>{"__proto__"!==t&&"constructor"!==t&&(this.columns[t]=e.slice(),i=Math.max(i,e.length))}),this.applyRowCount(i)}isPollutingKey(e){return"__proto__"===e||"constructor"===e}applyRowCount(e){this.rowCount=e,R(this.columns,(t,i)=>{t.length!==e&&(this.columns[i]=Z(t,e))})}deleteRows(e,t=1){if(t>0&&e<this.rowCount){let i=0;R(this.columns,(n,o)=>{this.columns[o]=q(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 o of(t??(t=Object.keys(this.columns)),t))i[o]=n[o]?.[e];return i}setColumn(e,t=[],i=0,n){this.setColumns({[e]:t},i,n)}setColumns(e,t,i){let n=this.rowCount;R(e,(e,t)=>{"__proto__"!==t&&"constructor"!==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){let{columns:o}=this,s=i?this.rowCount+1:t+1,r=Object.keys(e);if(n?.addColumns!==!1)for(let e=0,t=r.length;e<t;e++){let t=r[e];this.isPollutingKey(t)||Object.hasOwnProperty.call(o,t)||(o[t]=Array(this.rowCount))}R(o,(n,s)=>{n&&(i?n=q(n,t,0,!0,[e[s]]).array:n[t]=s in e?e[s]:n[t],o[s]=n)}),this.applyRowCount(Math.max(s,this.rowCount)),n?.silent||(b(this,"afterSetRows",{rowIndex:t}),this.versionTag=K())}getModified(){return this.modified||this}},{splice:Q,setLength:ee}=G,et=class e extends X{constructor(e={}){super(e),this.metadata=e.metadata}clone(t,i){let n={};this.emit({type:"cloneTable",detail:i}),t||(n.columns=this.columns),this.autoId||(n.id=this.id);let o=new e(n);return t||(o.versionTag=this.versionTag,o.originalRowIndexes=this.originalRowIndexes,o.localRowIndexes=this.localRowIndexes),o.metadata={...this.metadata},this.emit({type:"afterCloneTable",detail:i,tableClone:o}),o}deleteColumns(e,t){let i=this.columns,n={},o={},s=this.modifier,r=this.rowCount;if((e=e||Object.keys(i)).length){this.emit({type:"deleteColumns",columnIds:e,detail:t});for(let t=0,s=e.length,a,l;t<s;++t)(a=i[l=e[t]])&&(n[l]=a,o[l]=Array(r)),delete i[l];return Object.keys(i).length||(this.rowCount=0,this.deleteRowIndexReferences()),s&&s.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,o,{columns:s,modifier:r}=this,a=[];if(g(e)?Array.isArray(e)?o=(n=e.filter((e,t,i)=>e>=0&&e<this.rowCount&&i.indexOf(e)===t).sort((e,t)=>t-e)).length:(n=[e],o=t):(n=[0],o=this.rowCount),this.emit({type:"deleteRows",detail:i,rowCount:o,rowIndex:e??0}),o>0){let e=Object.keys(s);for(let t=0;t<e.length;++t){let i,r=e[t],l=s[r];if(1===n.length&&o>1){let e=Q(l,n[0],o);i=e.removed,s[r]=e.array}else{for(let e of(i=[],n))i.push(l[e]),Q(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:o,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,o={};e=e||Object.keys(n);for(let s=0,r=e.length,a,l;s<r;++s)(a=n[l=e[s]])&&(t?o[l]=a:i&&!Array.isArray(a)?o[l]=Array.from(a):o[l]=a.slice());return o}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,o=Array(t);i=i||Object.keys(n);for(let s=e,r=0,a=Math.min(this.rowCount,e+t),l,h;s<a;++s,++r)for(let e of(h=o[r]={},i))l=n[e],h[e]=l?l[s]:void 0;return o}getRows(e=0,t=this.rowCount-e,i){let n=this.columns,o=Array(t);i=i||Object.keys(n);for(let s=e,r=0,a=Math.min(this.rowCount,e+t),l,h;s<a;++s,++r)for(let e of(h=o[r]=[],i))l=n[e],h.push(l?l[s]:void 0);return o}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!!i&&(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){if("__proto__"===e||"constructor"===e||"__proto__"===t||"constructor"===t)return!1;let i=this.columns;return!!Object.hasOwnProperty.call(i,e)&&(e!==t&&(i[t]=i[e],delete i[e]),!0)}setCell(e,t,i,n){if("__proto__"===e||"constructor"===e)return;let o=this.columns,s=this.modifier,r=Object.hasOwnProperty.call(o,e)?o[e]:void 0;r&&r[t]===i||(this.emit({type:"setCell",cellValue:i,columnId:e,detail:n,rowIndex:t}),r||(r=o[e]=Array(this.rowCount)),t>=this.rowCount&&(this.rowCount=t+1),r[t]=i,s&&s.modifyTable(this),this.emit({type:"afterSetCell",cellValue:i,columnId:e,detail:n,rowIndex:t}))}setColumns(e,t,i,n){let o=this.columns,s=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,s=r.length,l,h,c,d;i<s;++i)if("__proto__"!==(c=r[i])&&"constructor"!==c){l=e[c],d=Object.getPrototypeOf((h=o[c])&&n?h:l).constructor,h?d===Array?Array.isArray(h)||(h=Array.from(h)):h.length<a&&(h=new d(a)).set(o[c]):h=new d(a),o[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}));s&&s.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,o;t<n;++t)g(o=e[t])&&(i[o]=t)}setRow(e,t,i,n){this.setRows([e],t,i,n)}setRows(e,t=this.rowCount,i,n){let o=this.columns,s=Object.keys(o),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=s.length;e<t;++e){let t=o[s[e]];i?o[s[e]]=Q(t,r,0,!0,[null]).array:t[r]=null}else if(Array.isArray(l))for(let e=0,t=s.length;e<t;++e)o[s[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=s.length;e<t;++e){let t=s[e];o[t]=ee(o[t],l)}}r&&r.modifyTable(this),this.emit({type:"afterSetRows",detail:n,rowCount:a,rowIndex:t,rows:e})}};class ei{static registerType(e,t){return!!e&&!ei.types[e]&&!!(ei.types[e]=t)}get polling(){return!!this._polling}constructor(e){this.dataTables={},this.loaded=!1,this.metadata=e.metadata||{columns:{}},this.options=e;let t=e?.dataTables,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){let n=t[e],o=n?.key;this.dataTables[o??i]=new et(n),!o&&i++}else this.dataTables[0]=new et({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]=S(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)=>(e[t].index??0)-(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"}),S(!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 o=n&&_.types[n.type];await i.setModifier(o?new o(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[o,s]of Object.entries(this.dataTables)){let r=t(o),a=i(r,e);s.deleteColumns(),s.setColumns(a),0===n&&(this.converter=r),n++}}}ei.types={};let en=ei;class eo extends en{constructor(e){let t=S(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:o,dataTables:s,decimalPoint:r}=i;return t.emit({type:"load",csv:n}),Promise.resolve(o?fetch(o,{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}=s?.find(t=>t.key===e)||{};return new $(S(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},en.registerType("CSV",eo);class es extends V{constructor(e){let t=S(es.defaultOptions,e);super(t),this.header=[],this.options=t}parse(e,t){let i,n=S(this.options,e),o=(n.json?.values||[]).map(e=>e.slice());if(0===o.length)return{};this.header=[],this.emit({type:"parse",columns:[],detail:t,headers:this.header});let{beforeParse:s,json:r}=n;s&&r&&(o=s(r.values));for(let e=0,t=o.length;e<t;e++){i=o[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()),o[e][t]=n}}return this.emit({type:"afterParse",columns:o,detail:t,headers:this.header}),F(o,this.header)}}es.defaultOptions={...V.defaultOptions},V.registerType("GoogleSheets",es);class er extends en{constructor(e){let t=S(er.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:o,googleAPIKey:s,googleSpreadsheetKey:r,dataTables:a}=i,l=function(e,t,i={}){let n=new URL(`https://sheets.googleapis.com/v4/spreadsheets/${t}/values/`),o=i.onlyColumnIds?"A1:Z1":function(e={}){let{endColumn:t,endRow:i,googleSpreadsheetRange:n,startColumn:o,startRow:s}=e;return n||(ea[o||0]||"A")+(Math.max(s||0,0)+1)+":"+(ea[t??25]||"Z")+(i?Math.max(i,0):"Z")}(i);n.pathname+=o;let s=n.searchParams;return s.set("alt","json"),i.onlyColumnIds||(s.set("dateTimeRenderOption","FORMATTED_STRING"),s.set("majorDimension","COLUMNS"),s.set("valueRenderOption","UNFORMATTED_VALUE")),s.set("prettyPrint","false"),s.set("key",e),n.href}(s,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 es({firstRowAsNames:t,beforeParse:n})},(e,t)=>e.parse({json:t})),t.applyTableModifiers()}).then(()=>(t.emit({type:"afterLoad",detail:e,url:l}),o&&setTimeout(()=>t.load(),1e3*Math.max(n||0,1)),t)).catch(i=>{throw t.emit({type:"loadError",detail:e,error:i}),i})}}er.defaultOptions={id:"google-sheets-connector",type:"GoogleSheets",googleAPIKey:"",googleSpreadsheetKey:"",enablePolling:!1,dataRefreshRate:2,firstRowAsNames:!0};let ea="ABCDEFGHIJKLMNOPQRSTUVWXYZ";en.registerType("GoogleSheets",er);class el extends V{constructor(e){let t=S(el.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,o=e.getSortedColumns(),s=Object.keys(o),r=[],a=s.length,l=[],h="";if(i){let e=[];if(n){for(let t of s){let i=o[t];Array.isArray(i)||(i=Array.from(i));let n=(i.shift()||"").toString();o[t]=i,e.push(n)}h=this.getTableHeaderHTML(s,e,t)}else h=this.getTableHeaderHTML(void 0,s,t)}for(let e=0;e<a;e++){let t=o[s[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,o){let s=n,r="text"+(t?" "+t:"");return"number"==typeof s?(s=s.toString(),","===o&&(s=s.replace(".",o)),r="number"):n||(s="",r="empty"),"<"+e+(i?" "+i:"")+' class="'+r+'">'+s+"</"+e+">"}getTableHeaderHTML(e=[],t=[],i=this.options){let{useMultiLevelHeaders:n,useRowspanHeaders:o}=i,s="<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(s+="<tr>";r<a;++r)(l=e[r])===e[r+1]?++h:h?(s+=this.getCellHTMLFromValue("th","highcharts-table-topheading",'scope="col" colspan="'+(h+1)+'"',l),h=0):(l===t[r]?o?(c=2,t.splice(r,1)):(c=1,t[r]=""):c=1,s+=this.getCellHTMLFromValue("th","highcharts-table-topheading",'scope="col"'+(c>1?' valign="top" rowspan="'+c+'"':""),l));s+="</tr>"}if(t){for(s+="<tr>",r=0,a=t.length;r<a;++r)void 0!==t[r]&&(s+=this.getCellHTMLFromValue("th",null,'scope="col"',t[r]));s+="</tr>"}return s+"</thead>"}parse(e,t){let i=[],n=[],o=S(this.options,e),{endRow:s,startColumn:r,endColumn:a,firstRowAsNames:l}=o,h=o.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}=o;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<=s){let e=c[u].children,t=e.length,n=0;for(;n<t;){let t=n-r,o=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===o[u-m-n];)o[u-m-n]=null,n++}n++}}u++}return this.headers=n,this.emit({type:"afterParse",columns:i,detail:t,headers:n}),F(i,this.headers)}}el.defaultOptions={...V.defaultOptions,useRowspanHeaders:!0,useMultiLevelHeaders:!0,startColumn:0,endColumn:Number.MAX_VALUE,startRow:0,endRow:Number.MAX_VALUE},V.registerType("HTMLTable",el);let{win:eh}=a;class ec extends en{constructor(e){let t=S(ec.defaultOptions,e);super(t),this.options=t,this.converter=new el(t)}async load(e){let t,i=this.options,n=this.converter,o=this.getTable(),s=i.htmlTable;if(this.emit({type:"load",detail:e}),"string"==typeof s?(this.tableID=s,t=eh.document.getElementById(s)):(t=s,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(S({tableElement:this.tableElement},i),e);return o.deleteColumns(),o.setColumns(r),await this.applyTableModifiers(),this.emit({type:"afterLoad",detail:e}),this}}ec.defaultOptions={id:"HTML-table-connector",type:"HTMLTable",htmlTable:""},en.registerType("HTMLTable",ec);class ed extends V{constructor(e){let t=S(ed.defaultOptions,e);super(t),this.headerColumnIds=[],this.headers=[],this.options=t}parse(e,t){let{beforeParse:i,orientation:n,firstRowAsNames:o,columnIds:s}=e=S(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,o,s):"rows"===n&&this.parseRowsOrientation(a,r,o,s),this.emit({type:"afterParse",columns:a,detail:t,headers:this.headers}),F(a,this.headers)}parseColumnsOrientation(e,t,i,n){for(let o=0,s=t.length;o<s;o++){let s=t[o];if(!Array.isArray(s))return;Array.isArray(this.headers)?(i?this.headers.push(`${s.shift()}`):n&&Array.isArray(n)&&this.headers.push(n[o]),e.push(s)):W("JSONConverter: Invalid `columnIds` option.",!1)}}parseRowsOrientation(e,t,i,n){i?this.headers=t.shift():n&&(this.headerColumnIds=n);for(let o=0,s=t.length;o<s;o++){let s=t[o];x(s)||(s=this.convertItemToRow(s,n));for(let t=0,n=s.length;t<n;t++)e.length<t+1&&e.push([]),e[t].push(s[t]),i||0!==o||(Array.isArray(this.headerColumnIds)?this.headers.push(this.headerColumnIds[t]||t.toString()):W("JSONConverter: Invalid `columnIds` option.",!1))}}convertItemToRow(e,t){let i=this;if(t&&!Array.isArray(t)){let n=[];return R(t,(t,o)=>{n.push(t.reduce((e,t)=>e[t],e)),0>i.headers.indexOf(o)&&i.headers.push(o)}),n}return i.headerColumnIds=Object.keys(e),Object.values(e)}}ed.defaultOptions={...V.defaultOptions,orientation:"rows"},V.registerType("JSON",ed);class eu extends en{constructor(e){let t=S(eu.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:o,dataTables:s}=i;return t.emit({type:"load",detail:e,data:n}),Promise.resolve(o?fetch(o,{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 ${o}.`)}):n||[]).then(async e=>(e&&this.initConverters(e,t=>{let{columnIds:n=i.columnIds,firstRowAsNames:o=i.firstRowAsNames,orientation:r=i.orientation,beforeParse:a=i.beforeParse}=s?.find(e=>e.key===t)||{};return new ed({data:e,columnIds:n,firstRowAsNames:o,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})}}eu.defaultOptions={type:"JSON",id:"json-connector",data:[],enablePolling:!1,dataRefreshRate:0,firstRowAsNames:!0,orientation:"rows"},en.registerType("JSON",eu);class ep extends _{constructor(e,...t){super(),this.chain=t,this.options=S(ep.defaultOptions,e);let i=this.options.chain||[];for(let e=0,n=i.length,o,s;e<n;++e)(o=i[e]).type&&(s=_.types[o.type])&&t.push(new s(o))}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 o=0,s=i.length;o<s;++o){try{await i[o].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,o=i.length;e<o;++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)}}ep.defaultOptions={type:"Chain"},_.registerType("Chain",ep);class em extends _{constructor(e){super(),this.options=S(em.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={},o=[];for(let e=0,i=t.length;e<i;++e)o.push(""+t[e]);for(let t=0,i=e.getRowCount(),s;t<i;++t)(s=e.getRow(t))&&(n[o[t]]=s);i.deleteColumns(),i.setColumns(n)}else{let t={};for(let i=0,n=e.getRowCount(),o;i<n;++i)(o=e.getRow(i))&&(t[`${i}`]=o);t.columnIds=e.getColumnIds(),i.deleteColumns(),i.setColumns(t)}return this.emit({type:"afterModify",detail:t,table:e}),e}}em.defaultOptions={type:"Invert"},_.registerType("Invert",em);class eg extends _{constructor(e){super(),this.options=S(eg.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 o=Math.max((n=Math.min(n||1/0,e.getRowCount()))-i,0),s=e.getModified();return s.deleteRows(),s.setRows(e.getRows(i,o)),s.setOriginalRowIndexes(Array.from({length:o},(t,n)=>e.getOriginalRowIndex(i+n))),this.emit({type:"afterModify",detail:t,table:e}),e}}eg.defaultOptions={type:"Range",start:0,end:1/0},_.registerType("Range",eg);class ef extends _{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?ef.ascending:ef.descending}constructor(e){super(),this.options=S(ef.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(),o=this.getRowReferences(e),{direction:s,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,o=n?t:t.column,r=i.indexOf(o);-1!==r&&c.push({columnIndex:r,compare:ef.compareFactory(n?s:t.direction||s,n?a:t.compare||a)})}if(c.length&&o.sort((e,t)=>{for(let i=0,n=c.length;i<n;++i){let{columnIndex:n,compare:o}=c[i],s=o(e.row[n],t.row[n]);if(s)return s}return e.index-t.index}),r){let e=[];for(let t=0;t<n;++t)e[o[t].index]=t;l.setColumns({[r]:e})}else{let t,i=[],s=[];for(let r=0;r<n;++r)t=o[r],i.push(e.getOriginalRowIndex(t.index)),s.push(t.row);l.setRows(s,0),l.setOriginalRowIndexes(i)}return this.emit({type:"afterModify",detail:t,table:e}),e}}ef.defaultOptions={type:"Sort",direction:"desc",orderByColumn:"y"},_.registerType("Sort",ef);class ey extends _{static compile(e){if(E(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:o}=e,s=e=>{let t=""+e;return o??!0?t.toLowerCase():t};return"contains"===t?e=>s(e[i]).includes(s(n)):e=>s(e[i])[t](s(n))}constructor(e){super(),this.options=S(ey.defaultOptions,e)}modifyTable(e,t){this.emit({type:"modify",detail:t,table:e});let{condition:i}=this.options;if(!i)return e;let n=ey.compile(i),o=e.getModified(),s=[],r=[];for(let t=0,i=e.getRowCount();t<i;++t){let i=e.getRowObject(t);i&&n(i,e,t)&&(s.push(i),r.push(e.getOriginalRowIndex(t)))}return o.deleteRows(),o.setRows(s),o.setOriginalRowIndexes(r),this.emit({type:"afterModify",detail:t,table:e}),e}}ey.defaultOptions={type:"Filter"},_.registerType("Filter",ey);let eb={},eC=function(e){if(eb[e.$class])throw Error("A serializer for '"+e.$class+"' is already registered.");eb[e.$class]=e},ew={$class:"Data.DataTable",fromJSON:function(e){return new et({columns:e.columns,id:e.id})},jsonSupportFor:function(e){return e instanceof et},toJSON:function(e){let t={$class:"Data.DataTable",columns:e.getColumns(void 0,!1,!0)};return e.autoId||(t.id=e.id),t}};function ev(e,t){if("position"===e.type){for(let i,n=0,o=t.length;n<o;++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,o=0,s=t.length;o<s;++o)if("range"===(n=t[o]).type&&n.state===e.state&&n.firstRow===e.firstRow&&n.lastRow===e.lastRow&&JSON.stringify(n.columns)===i)return o}return -1}eC(ew),eC({$class:"Data.CSVConnector",fromJSON:function(e){return new eo(e.options)},jsonSupportFor:function(e){return e instanceof eo},toJSON:function(e){let t=S(e.options);return t.dataTable=ew.toJSON(e.getTable()),{$class:"Data.CSVConnector",options:t}}}),eC({$class:"Data.DataConverter",fromJSON:function(e){return new V(e.options)},jsonSupportFor:function(e){return e instanceof V},toJSON:function(e){return{$class:"Data.DataConverter",options:S(e.options)}}});let eO=class{constructor(e=Object.create(null)){this.emittingRegister=[],this.listenerMap=Object.create(null),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 o=e.id,s=t.state,r=this.listenerMap[o]&&this.listenerMap[o][s];if(r){let s=this.stateMap[o]=this.stateMap[o]??{},a=s[t.state]||[];n&&(a.length||(s[t.state]=a),-1===ev(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=ev(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}};eC({$class:"Data.DataCursor",fromJSON:function(e){return new eO(e.stateMap)},jsonSupportFor:function(e){return e instanceof eO},toJSON:function(e){let t,i,n,o,s,r=e.stateMap,a={},l=Object.keys(e.stateMap);for(let e=0,h=l.length;e<h;++e){s=Object.keys(r[n=l[e]]),a[n]={};for(let e=0,l=s.length;e<l;++e){o=s[e],t=r[n][o],a[n][o]=i=[];for(let e=0,n=t.length;e<n;++e)i.push({...t[e]})}}return{$class:"Data.DataCursor",stateMap:a}}}),eC({$class:"Data.GoogleSheetsConnector",fromJSON:function(e){return new er(e.options||{googleAPIKey:"",googleSpreadsheetKey:""})},jsonSupportFor:function(e){return e instanceof er},toJSON:function(e){let t=S(e.options);return t.dataTable=ew.toJSON(e.getTable()),{$class:"Data.GoogleSheetsConnector",options:t}}}),eC({$class:"Data.HTMLTableConnector",fromJSON:function(e){return new ec(e.options)},jsonSupportFor:function(e){return e instanceof ec},toJSON:function(e){let t=S(e.options);return t.dataTable=ew.toJSON(e.getTable()),{$class:"Data.HTMLTableConnector",options:t}}});let{SVG_NS:eT,win:ex}=a,{trustedTypes:eE}=ex,eM=eE&&E(eE.createPolicy)&&eE.createPolicy("highcharts",{createHTML:e=>e}),eS=eM?eM.createHTML(""):"";class eR{static filterUserAttributes(e){return R(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||(W(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 P(t).forEach(function(t){let o,s=t.tagName,r=t.textContent?a.doc.createTextNode(t.textContent):void 0,l=eR.bypassHTMLFiltering;if(s)if("#text"===s)o=r;else if(-1!==eR.allowedTags.indexOf(s)||l){let n="svg"===s?eT:i.namespaceURI||eT,h=a.doc.createElementNS(n,s),c=t.attributes||{};R(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),o=h}else W(33,!1,void 0,{"Invalid tagName in config":s});o&&i.appendChild(o),n=o}),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{try{t=new DOMParser().parseFromString(e,"text/html")}catch{}}t||((t=a.doc.implementation.createHTMLDocument("")).body.innerHTML=e);let n=(e,t)=>{let i=e.localName||e.nodeName.toLowerCase(),o={tagName:i};"#text"===i&&(o.textContent=e.textContent||"");let s=e.attributes;if(s){let e={};[].forEach.call(s,t=>{"data-style"===t.name?o.style=eR.parseStyle(t.value):e[t.name]=t.value}),o.attributes=e}if(e.childNodes.length){let t=[];[].forEach.call(e.childNodes,e=>{n(e,t)}),t.length&&(o.children=t)}t.push(o)};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","sub","sup","svg","table","tbody","td","text","textPath","th","thead","title","tr","tspan","u","ul"],eR.emptyHTML=eS,eR.bypassHTMLFiltering=!1;let eN={},eA={registerComponent:function(e,t){return!!e&&!eN[e]&&!!(eN[e]=t)},types:eN},eP="highcharts-dashboards-",eI=window,eD=document,eL={boards:[],classNamePrefix:eP,classNames:{layout:eP+"layout",cell:eP+"cell",cellHover:eP+"cell-state-hover",cellActive:eP+"cell-state-active",cellLoading:eP+"cell-state-loading",row:eP+"row",layoutsWrapper:eP+"layouts-wrapper",boardContainer:eP+"wrapper"},doc:eD,guiElementType:{row:"row",cell:"cell",layout:"layout"},isMS:/(edge|msie|trident)/i.test(eI.navigator&&eI.navigator.userAgent||"")&&!eI.opera,noop:function(){},version:"4.2.3",win:eI},ek=eL.classNamePrefix+"edit-",eH={classNames:{resizeSnap:ek+"resize-snap",resizeSnapX:ek+"resize-snap-x",resizeSnapY:ek+"resize-snap-y",separator:ek+"separator",contextMenuBtn:ek+"context-menu-btn",contextMenuBtnText:ek+"context-menu-btn-text",contextMenu:ek+"context-menu",contextMenuItem:ek+"context-menu-item",editModeEnabled:ek+"enabled",editToolbar:ek+"toolbar",editToolbarCellOutline:ek+"toolbar-cell-outline",editToolbarRowOutline:ek+"toolbar-row-outline",editToolbarItem:ek+"toolbar-item",editToolbarRow:ek+"toolbar-row",editToolbarCell:ek+"toolbar-cell",editSidebar:ek+"sidebar",editSidebarShow:ek+"sidebar-show",editSidebarHide:ek+"sidebar-hide",editSidebarHeader:ek+"sidebar-header",editSidebarTitle:ek+"sidebar-title",editSidebarMenuItem:ek+"sidebar-item",rowContextHighlight:ek+"row-context-highlight",cellEditHighlight:ek+"cell-highlight",dashboardCellEditHighlightActive:ek+"cell-highlight-active",dragMock:ek+"drag-mock",dropPointer:ek+"drop-pointer",contextDetectionPointer:ek+"ctx-detection-pointer",resizePointer:ek+"resize-pointer",currentEditedElement:ek+"unmask",maskElement:ek+"mask",menuItem:ek+"menu-item",menu:ek+"menu",menuVerticalSeparator:ek+"menu-vertical-separator",menuHorizontalSeparator:ek+"menu-horizontal-separator",menuDestroy:ek+"menu-destroy",editSidebarWrapper:ek+"sidebar-wrapper",customSelect:ek+"custom-select",customSelectButton:ek+"custom-option-button",toggleContainer:ek+"toggle-container",toggleWrapper:ek+"toggle-wrapper",toggleSlider:ek+"toggle-slider",toggleWrapperColored:ek+"toggle-wrapper-colored",toggleLabels:ek+"toggle-labels",labeledToggleWrapper:ek+"labeled-toggle-wrapper",button:ek+"button",sidebarNavButton:ek+"sidebar-button-nav",labelText:ek+"label-text",editSidebarTabBtn:ek+"sidebar-tab-btn",editToolsBtn:ek+"tools-btn",editTools:ek+"tools",editGridItems:ek+"grid-items",editStandaloneToggle:ek+"standalone-toggle",confirmationPopup:ek+"confirmation-popup",popupButtonContainer:ek+"confirmation-popup-button-container",popupContentContainer:ek+"confirmation-popup-content",popupCancelBtn:ek+"confirmation-popup-cancel-btn",popupConfirmBtn:ek+"confirmation-popup-confirm-btn",popupCloseButton:ek+"popup-close",editOverlay:ek+"overlay",editOverlayActive:ek+"overlay-active",resizerMenuBtnActive:ek+"resizer-menu-btn-active",sidebarCloseButton:ek+"close-btn",editSidebarTabBtnWrapper:ek+"tabs-buttons-wrapper",editSidebarRight:ek+"sidebar-right",editSidebarRightShow:ek+"sidebar-right-show",viewFullscreen:ek+"view-fullscreen",accordionMenu:ek+"accordion-menu",accordionContainer:ek+"accordion",accordionHeader:ek+"accordion-header",accordionHeaderBtn:ek+"accordion-header-btn",accordionHeaderWrapper:ek+"accordion-header-wrapper",accordionHeaderIcon:ek+"accordion-header-icon",accordionContent:ek+"accordion-content",accordionNestedWrapper:ek+"accordion-nested",accordionMenuButtonsContainer:ek+"accordion-menu-buttons-container",accordionMenuButton:ek+"accordion-menu-button",accordionStandaloneWrapper:ek+"accordion-standalone-wrapper",hiddenElement:ek+"hidden-element",collapsableContentHeader:ek+"collapsable-content-header",standaloneElement:ek+"standalone-element",collapsedElement:ek+"collapsed-element",dropdown:ek+"dropdown",dropdownContent:ek+"dropdown-content",dropdownButton:ek+"dropdown-button",dropdownButtonContent:ek+"dropdown-button-content",dropdownIcon:ek+"pointer",icon:ek+"icon"}},eF=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(),o=t?t.getBoundingClientRect():{left:0,top:0};return i.left=n.left-o.left,i.top=n.top-o.top,i.right=n.right-o.left,i.bottom=n.bottom-o.top,i}static getDimFromOffsets(e){return{width:e.right-e.left,height:e.bottom-e.top}}static getElementId(e){return eL.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:W("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),R(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()}},ej=class extends eF{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(eH.classNames.cellEditHighlight),this.mountedComponent?.board.container.classList.toggle(eH.classNames.dashboardCellEditHighlightActive)}setActiveState(){this.container&&this.container.classList.add(eL.classNames.cellActive)}};function ez(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 eV={addComponent:async function e(e,t,i){let n=e.states,o=e.events,s=e.renderTo;if(!s)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===s).length>0)return void console.error(`A component has already been declared in the cell %c${s}%c use a different cell.`,"font-weight: bold","");i=i||eV.getCell(s,t.container);let r=i?.container||document.querySelector("#"+s);if(!r||!e.type)return void console.error(`The component is unable to find the HTML cell element %c${s}%c to render the content.`,"font-weight: bold","");let a=eA.types[e.type];!a&&(console.error(`The component's type %c${e.type}%c does not exist.`,"font-weight: bold",""),i&&(a=eA.types.HTML,e.title={text:t.editMode?.lang.errorMessage||"Something went wrong",className:eL.classNamePrefix+"component-title-error "+eL.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:eL.classNamePrefix+"component-title-error "+eL.classNamePrefix+"component-title"}})));return i&&(l.setCell(i),i.mountedComponent=l),t.mountedComponents.push({options:e,component:l,cell:i||new ej({id:s,container:r,mountedComponent:l})}),i&&n?.active?.enabled&&n?.active?.isActive&&(i.setActiveState(),l.isActive=!0),b(l,"mount"),c(r,"click",()=>{o&&o.click&&o.click.call(l),i&&l&&r&&n?.active?.enabled&&(i.setActiveState(),l.isActive=!0)}),n?.hover?.enabled&&r.classList.add(eL.classNames.cellHover),b(l,"afterLoad"),h},getCell:function(e,t){let i=ez(e,t);if(i&&"cell"===i.getType())return i}},e$=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 eB{constructor(e){this.options=S(eB.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=en.types[e.type];if(!n)throw Error(`Connector type not found. (${e.type})`);let o=this.connectors[e.id]=new n(e);o.load().then(({converter:i})=>{o.converter=i,o.loaded=!0,this.emit({type:"afterLoad",options:e}),t(o)}).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 o=n[e.id];o&&(t?await o.update(e,!0):(o.stopPolling(),o=void 0,delete n[e.id])),o||i.push(e),this.emit({type:"afterSetConnectorOptions",options:e})}}eB.defaultOptions={connectors:[]};let e_={gui:{enabled:!0,layoutOptions:{rowClassName:void 0,cellClassName:void 0},layouts:[]},components:[]};function eG(e){return!!e&&"row"in e&&"cell"===e.type}let eU=class extends eF{constructor(e,t,i){super(),this.type=eL.guiElementType.cell,this.id=t.id,this.options=t,this.row=e,this.isVisible=!0;let n=document.getElementById(t.parentContainerId||"")||e.container,o=e.layout.options||{},s=e.options||{},r=o.cellClassName||"",a=t.style||{},l=S(o.style,s.style,a);this.applySizeOptions(t,a,l),this.container=this.getElementContainer({render:e.layout.board.guiEnabled,parentContainer:n,attribs:{id:t.id,className:eL.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,S({},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,o=[this.row.layout.level];if(n){let s=i||eF.getOffsets(this)[e],r=eF.getOffsets(n)[e];Math.abs(s-r)<t&&(o=[...o,...n.getOverlappingLevels(e,t,r)])}return o}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(eH.classNames.cellEditHighlight);e||i?e&&i&&(t.classList.remove(eH.classNames.cellEditHighlight),this.row.layout.board.container.classList.remove(eH.classNames.dashboardCellEditHighlightActive),this.isHighlighted=!1):(t.classList.add(eH.classNames.cellEditHighlight),this.row.layout.board.container.classList.add(eH.classNames.dashboardCellEditHighlightActive),this.isHighlighted=!0)}}setActiveState(){this.row.layout.board.mountedComponents.forEach(e=>{e.cell.container&&e.cell.container.classList.remove(eL.classNames.cellActive),e.component.isActive=!1}),this.container&&this.container.classList.add(eL.classNames.cellActive)}setLoadingState(e=!0){this.container?.classList?.toggle(eL.classNames.cellLoading,e)}convertWidthToValue(e){return"number"==typeof e?e+"px":/px/.test(e)?e:eF.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 o=g(e.width)?e.width:t.flex;if(g(o)&&("string"==typeof o||"number"==typeof o)){let t;if("string"==typeof o&&-1!==o.indexOf(" "))t=o;else if("auto"===o)t="1 1 0%";else{let e=this.convertWidthToValue(o);e&&(t="0 0 "+e)}t&&(i.flex=t,e.width=t)}}},eY=class e extends eF{static setContainerHeight(e,t){t&&(e.style.height=t+"px")}constructor(e,t,i){super(),this.type=eL.guiElementType.row,this.layout=e,this.cells=[],this.options=t,this.isVisible=!0;let n=document.getElementById(t.parentContainerId||"")||e.container,o=e.options||{},s=o.rowClassName||"";this.container=this.getElementContainer({render:e.board.guiEnabled,parentContainer:n,attribs:{id:t.id,className:eL.classNames.row+" "+s},element:i,elementId:t.id,style:S(o.style,t.style)}),this.options.cells&&this.setCells()}setCells(){let e,t,i,n=(this.layout.options||{}).cellClassName||"",o=(this.options.cells??(this.container&&this.container.getElementsByClassName(n)))||[];for(t=0,i=o.length;t<i;++t)e=o[t],this.addCell(this.layout.board.guiEnabled?e:{id:""},e instanceof HTMLElement?e:void 0)}addCell(e,t,i){let n=new eU(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(t){e.setContainerHeight(this.container,t)}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],o=i.cells[t-1];e.container&&(n&&n.container?n.container.parentNode.insertBefore(e.container,n.container):o&&o.container?o.container.parentNode.insertBefore(e.container,o.container.nextSibling):o||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=eH.classNames.rowContextHighlight;!0===e?t.remove(i):t.toggle(i,!e)}getRowLevels(){let e,t,i={},n=[];for(let n=0,o=this.cells.length;n<o;++n)(e=this.cells[n]).isVisible&&(i[(t=eF.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 R(i,e=>{n.push(e)}),n}getRowLevelInfo(e){let t,i=this.getRowLevels();for(let n=0,o=i.length;n<o;++n)i[n].top<=e&&i[n].bottom>e&&(t={index:n,rowLevels:i,rowLevel:i[n]});return t}},eW=class extends eF{constructor(e,t,i){super(),this.type=eL.guiElementType.layout,this.board=e,this.rows=[],this.options=t,this.isVisible=!0;let 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);let o=(this.options||{}).rowClassName||"";this.container=this.getElementContainer({render:e.guiEnabled,parentContainer:n,attribs:{id:(t.id||"")+(this.copyId?"_"+this.copyId:""),className:eL.classNames.layout+" "+o},elementId:t.id,style:this.options.style}),this.options.rows&&this.setRows()}setRows(){let e,t,i,n=(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 eY(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}}},eJ=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}},eK=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))){eG(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=eL.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=eL.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 eZ{constructor(e,t=eZ.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}}eZ.defaultBindings={keyMap:{color:"colorPicker",title:"text",caption:"text",style:"textarea"},typeMap:{string:"text",number:"input",boolean:"toggle"},skipRedraw:[]},eZ.defaultTypeMap={string:"text",number:"input",boolean:"toggle"};class eq{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,eq.register(this)}create(e){this.callback=this.func.call(e)}remove(){this.callback&&this.callback()}}eq.registry={};class eX{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,eX.register(this)}register(e){let{func:t}=this;this.callback=t.call(e)}remove(){this.callback&&this.callback()}}eX.registry={};class eQ{constructor(e,t){this.component=e,this.predefinedSyncConfig=t,this.syncConfig=eQ.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,o)=>{if(o){let s=i[o],r=n[o],a=t[o],l=S(r||{},{enabled:M(a)?a.enabled:a},M(a)?a:{});if(s&&l.enabled)for(let e of["emitter","handler"])(!0===l[e]||void 0===l[e])&&(l[e]=s[e]);e[o]=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=eQ.prepareSyncConfig(this.predefinedSyncConfig,e.options.sync),Object.keys(this.syncConfig))){let i=this.syncConfig[t];if(!i)continue;let{emitter:n,handler:o}=i;if(o){!0===o&&(o=eQ.defaultHandlers[t].handler);let i=new eX(t,o);this.isRegisteredHandler(i.id)||(this.registerSyncHandler(i),i.register(e))}if(n){!0===n&&(n=eQ.defaultHandlers[t].emitter);let i=new eq(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 e0(e,t){let i=window.getComputedStyle(e);return t.map(e=>i[e])}function e1(e,t){return t&&(e+="number"==typeof t?t:parseFloat(t)),e}eQ.defaultHandlers={};let e2={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 o of Object.keys(t))i&&i.includes(o)?n[o]=t[o]:n[o]=e(t[o],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."):W(e,t)}},{classNamePrefix:e3}=eL,{getMargins:e4,getPaddings:e5}={getMargins:function(e,t=!0){return{y:e0(e,["marginTop","marginBottom",...t?["borderTop","borderBottom"]:[]]).reduce(e1,0),x:e0(e,["marginLeft","marginTop",...t?["borderLeft","borderRight"]:[]]).reduce(e1,0)}},getPaddings:function(e){return{x:e0(e,["paddingLeft","paddingRight"]).reduce(e1,0),y:e0(e,["paddingTop","paddingBottom"]).reduce(e1,0)}},getStyles:e0,sumPixels:e1},{deepClone:e6}=e2;class e8{static createTextElement(e,t,i){if("object"==typeof i){let{className:n,text:o,style:s}=i;return p(e,{className:n||`${e3}component-${t}`,textContent:o},s)}if("string"==typeof i)return p(e,{className:`${e3}component-${t}`,textContent:i},{})}constructor(e,t,i){this.connectorHandlers=[],this.callbackRegistry=new eJ,this.cellListeners=[],this.resizeTimeouts=[],this.innerResizeTimeouts=[];let n=t.renderTo;if(this.board=i||e?.row?.layout?.board||{},this.parentElement=e?.container||document.querySelector("#"+n),this.cell=e,this.options=S(e8.defaultOptions,t),this.id=this.options.id&&this.options.id.length?this.options.id:K(),this.options.connector)for(let e of x(this.options.connector)?this.options.connector:[this.options.connector])this.connectorHandlers.push(new eK(this,e));this.editableOptions=new eZ(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 eQ(this,this.constructor.predefinedSyncConfig),this.setupEventListeners(),e&&(this.attachCellListeners(),this.on("update",()=>{eG(this.cell)&&this.cell.setLoadingState()}),this.on("afterRender",()=>{eG(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&&eG(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+e4(this.titleElement).y:0)+(this.captionElement?this.captionElement.clientHeight+e4(this.captionElement).y:0)}resize(e,t){if(t){let e=e5(this.element).y+e4(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=e4(i).y,n=e5(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=e5(e),o=e4(e);this.resize(t-n.x-o.x,i-n.y-o.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=S(this.options,e);let n=this.options.connector?x(this.options.connector)?this.options.connector:[this.options.connector]:[],o=n.length!==this.connectorHandlers.length;if(!o)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){o=!0;break}this.connectorHandlers[e].updateOptions(i)}if(o){for(let e of this.connectorHandlers)e.destroy();for(let e of(this.connectorHandlers.length=0,n))this.connectorHandlers.push(new eK(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})}),R(e,(e,t)=>{E(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=e8.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=e8.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.resizeTimeouts.forEach(clearTimeout),this.sync.isSyncing&&this.sync.stop();this.element.firstChild;)this.element.firstChild.remove();for(let e of(b(this,"unmount"),this.connectorHandlers))e.destroy();A(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,e8.defaultOptions)}getEditableOptions(){return e6(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}}e8.Sync=eQ,e8.predefinedSyncConfig={defaultSyncOptions:{},defaultSyncPairs:{}},e8.defaultOptions={className:`${e3}component`,id:"",title:!1,caption:!1,sync:eQ.defaultHandlers,editableOptions:[{name:"title",propertyPath:["title"],type:"input"},{name:"caption",propertyPath:["caption"],type:"input"}]};let e9=e8,e7={type:"HTML",className:[e9.defaultOptions.className,`${e9.defaultOptions.className}-html`].join(" "),elements:[],editableOptions:[...e9.defaultOptions.editableOptions||[],{name:"htmlInput",propertyPath:["html"],type:"textarea"}]},{deepClone:te}=e2;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 tt extends e9{constructor(e,t){t.className&&(t.className=`${tt.defaultOptions.className} ${t.className}`),super(e,t=S(tt.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,tt.defaultOptions),type:"HTML"}}getEditableOptions(){return te(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()}}tt.defaultOptions=S(e9.defaultOptions,e7),tt.predefinedSyncConfig={defaultSyncPairs:{},defaultSyncOptions:{}},eA.registerComponent("HTML",tt);let ti=class e{static board(t,i,n){return new e(t,i).init(n)}constructor(e,t){this.componentTypes=eA.types,this.options=S(e_,t),this.dataPool=new eB(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 eO,this.index=eL.boards.length,eL.boards.push(this),this.a11y=new e$(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||W(13,!0),this.container=e}initEditMode(){let{EditMode:e}=eL.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(eV.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(),R(e,function(t,i){delete e[i]}),eL.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){let t=this;for(let i of(t.options=S(t.options,e),e.dataPool&&(t.dataPool=new eB(t.options.dataPool)),void 0!==e.gui&&(t.guiEnabled=!!e.gui&&t.options?.gui?.enabled),void 0!==e.editMode&&(t.editModeEnabled=!!e.editMode&&t.options?.editMode?.enabled),t.mountedComponents))i.component.destroy();if(t.mountedComponents=[],t.guiEnabled&&t.layouts){for(let e of t.layouts.slice())e.destroy();if(t.layouts=[],!t.layoutsWrapper&&t.container&&(t.layoutsWrapper=p("div",{className:eL.classNames.layoutsWrapper},{},t.container)),t.options.gui?.layouts){let e=t.options.gui;for(let i=0,n=e.layouts.length;i<n;++i)t.layouts.push(new eW(t,S({},e.layoutOptions,e.layouts[i])));if(t.editMode){let e=0,i=t.layouts.length;for(;e<i;++e)t.editMode.setLayoutEvents(t.layouts[e])}}}return Promise.all(t.options.components?t.setComponents(t.options.components):[]).then(()=>t)}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 tn(e){return!!(e&&"function"==typeof e.getDataTable)}let to={defaultOptions:{},syncPair:{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,o=t=>{let i=t.cursor;if("position"===i.type&&e.grid&&"number"==typeof i?.row){let{row:t}=i,n=e.grid.dataProvider,o=tn(n)?n.getDataTable(!0)?.getLocalRowIndex(t):void 0;void 0!==o&&e.grid.viewport?.scrollToRow(o)}};if(n)return(()=>{let{dataCursor:t}=n;if(!t)return;let s=e.connectorHandlers?.[0]?.connector?.getTable();s&&t.addListener(s.id,"xAxis.extremes.min"+i,o)})(),()=>{let t=e.connectorHandlers?.[0]?.connector?.getTable(),{dataCursor:s}=n;t&&s.removeListener(t.id,"xAxis.extremes.min"+i,o)}}}},ts={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:o}=t,s=this.getDataTable(),r=(t,i)=>{if(s){let r=t.row.index,a=e.dataProvider,l=tn(a)?a.getDataTable(!0):void 0,h=l?.getOriginalRowIndex(r);"number"==typeof h&&o.emitCursor(s,{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(){A(e,"cellMouseOver",a),A(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 o=e.getDataTable(),s=t=>{let n=t.cursor;if(n.sourceId===e.id||"position"!==n.type)return;let{row:o,column:s}=n,{grid:r}=e,a=r?.viewport,l=r?.dataProvider,h=tn(l)?l.getDataTable(!0):void 0;if(void 0===o||!a)return;let c=h?.getLocalRowIndex(o);void 0!==c&&(i.autoScroll&&a.scrollToRow(c),r.syncRow(c),r.syncColumn(s))},r=t=>{let{grid:i}=e;i&&t.cursor.sourceId!==e.id&&(i.syncColumn(),i.syncRow())};if(t)return(()=>{let{dataCursor:e}=t;!e||o&&(e.addListener(o.id,"point.mouseOver"+n,s),e.addListener(o.id,"point.mouseOut"+n,r))})(),()=>{if(!o)return;let e=t.dataCursor;e.removeListener(o.id,"point.mouseOver"+n,s),e.removeListener(o.id,"point.mouseOut"+n,r)}}}},tr={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,o=t=>{let n=t.cursor,o=e.grid;o&&"position"===n.type&&n.column&&o.updateColumn(n.column,{enabled:n.state!=="series.hide"+i})};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,o))})(),()=>{let t=e.getDataTable(),{dataCursor:s}=n;t&&(s.removeListener(t.id,"series.show"+i,o),s.removeListener(t.id,"series.hide"+i,o))}}}},ta={defaultSyncPairs:{extremes:to.syncPair,highlight:ts.syncPair,visibility:tr.syncPair},defaultSyncOptions:{extremes:to.defaultOptions,highlight:ts.defaultOptions,visibility:tr.defaultOptions}},tl={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 o=e.dataset.rowIndex,{columnId:s}=n.dataset;if(void 0!==o&&void 0!==s){let e=t.getTable();if(e){let t=new V().convertByType(i.value);t instanceof Date&&(t=t.toString()),e.setCell(s,Number(o),t)}}}}}},{deepClone:th}=e2;class tc extends e9{constructor(e,t,i){super(e,t=S(tc.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,o=this.getDataTable();if(n&&this.options.connector&&i!==o?.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||!tn(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:o}=e,s=0;for(let e of i)if(o.getIndividualColumnOptions(e)?.enabled!==!1){if(n?.[s]!==e)return void this.recreateGrid(!0);s++}}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:o}=e,s=0;for(let r of i)if(o.getIndividualColumnOptions(r)?.enabled!==!1){if(n?.[s]!==r)return void e.update({dataTable:t});s++}}e.dataTable=t,e.querying.shouldBeUpdated=!0,e.viewport?.updateRows()}getEditableOptions(){let e=this.options;return th(S({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=S(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,tc.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=tl.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=S(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=S(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=S(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 tn(t)?t.getDataTable(e):void 0}constructGrid(){let e=tc.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}}tc.predefinedSyncConfig=ta,tc.defaultOptions=S(e9.defaultOptions,tl);let td={custom:{connectGrid:function(e){tc.GridNamespace=e}},name:"Grid.DashboardsPlugin",onRegister:function(e){let{ComponentRegistry:t}=e;t.registerComponent("Grid",tc)},onUnregister:function(e){}},tu={defaultOptions:{},syncPair:{emitter:function(){if("Highcharts"!==this.type)return;let e=this,t=[],{chart:i,board:n}=e,o=e.connectorHandlers?.[0]?.connector,s=o&&o.getTable(),r=this.sync.syncConfig.extremes,a=r.group?":"+r.group:"",{dataCursor:l}=n;if(s&&i){let n=t=>{let n=!!t.resetSelection;if((!t.trigger||t.trigger&&"dashboards-sync"!==t.trigger)&&!n){let n=t.target,o=Object.keys(e.seriesFromConnector),r=o.length>0?i.get(o[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(o.length>0&&"xAxis"===n.coll&&i.length){let t,o=(e.connectorHandlers[0]?.options).columnAssignment;if(o){let e=o.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&&(s.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(s,h,t,!0).emitCursor(s,c,t,!0)}}},o=()=>i.axes.map(e=>c(e,"afterSetExtremes",n)),r=o(),h=()=>{r.forEach(e=>{e()}),r=[]};t.push(c(i,"selection",e=>{e.resetSelection&&(h(),l.emitCursor(s,{type:"position",state:"chart.zoomOut"+a},e),r.push(...o()))})),t.push(()=>{l.remitCursor(s.id,{type:"position",state:"xAxis.extremes.min"+a}),l.remitCursor(s.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:o}=e;if(n&&o&&n.zooming?.type){let t=n.zooming.type.split("").map(e=>e+"Axis"),s=[];return t.forEach(t=>{let r=e=>{let{cursor:i,event:o}=e;if("position"===i.type){let e=o?.target;if(e&&n){let i=n[t],o=!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"}),o=!0)}),o&&!n.resetZoomButton&&n.showResetZoom(),n.redraw()}}};o&&(()=>{let{dataCursor:a}=o,l=e.connectorHandlers?.[0]?.connector;if(l){let o=l.getTable();a.addListener(o.id,`${t}.extremes.min${i}`,r),a.addListener(o.id,`${t}.extremes.max${i}`,r);let h=()=>{n.zoomOut(),setTimeout(()=>{e.element.querySelectorAll(".highcharts-reset-zoom").forEach(e=>{e.remove()})})};a.addListener(o.id,"chart.zoomOut",h),s.push(()=>{a.removeListener(o.id,`${t}.extremes.min${i}`,r),a.removeListener(o.id,`${t}.extremes.max${i}`,r),a.removeListener(o.id,"chart.zoomOut"+i,h)})}})()}),function(){s.forEach(e=>{e()})}}}}},{error:tp}=e2,tm={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,o=n.group?":"+n.group:"";if(!n.enabled||!t)return;let{dataCursor:s}=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(){s.emitCursor(c,{type:"position",row:d.getOriginalRowIndex(this.index),column:n,state:"point.mouseOver"+o,sourceId:e.id})},mouseOut:function(){s.emitCursor(c,{type:"position",row:d.getOriginalRowIndex(this.index),column:n,state:"point.mouseOut"+o,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,o=t=>{let{table:n,cursor:o}=t,s=this.sync.syncConfig.highlight;if(i&&i.series?.length&&"position"===o.type){let t,r=s.affectedSeriesId;if(s.affectedSeriesId){let e=i.get(s.affectedSeriesId);e?.points?t=e:tp("No series with ID '"+r+"' found in the chart. Affected series will be selected according to the column assignment.")}if(!t){let s=Object.keys(e.seriesFromConnector);for(let r=0,a=s.length;r<a;++r){let a=s[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||!o.column)break;if("string"==typeof d){if(d===o.column)break}else if(Array.isArray(d)){if(d.includes(o.column))break}else if(Object.keys(d).map(e=>d[e]).includes(o.column))break}}let a=o.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}}},s=t=>{let n=this.sync.syncConfig.highlight;if(!n.enabled||t.cursor.sourceId===e.id)return;let s=o(t);if(!s||!i||!s.isInside&&s.series.isCartesian||s===i.hoverPoint)return;let r=i.tooltip;if(r&&n.showTooltip){let e=r.shared,t=i.hoverPoint,n=t?.series||i.hoverSeries,o=i.pointer?.getHoverData(s,n,i.series,!0,!0);i.tooltip&&o?.hoverPoints.length&&r.refresh(e?o.hoverPoints:s)}n.highlightPoint&&(!r?.shared&&n.showTooltip||!n.showTooltip)&&s.setState("hover"),n.showCrosshair&&(s.series.xAxis?.drawCrosshair(void 0,s),s.series.yAxis?.drawCrosshair(void 0,s))},r=t=>{let n=this.sync.syncConfig.highlight;if(!i||!i.series.length||!n.enabled||t.cursor.sourceId===e.id)return;let s=o(t);if(s&&(!s.isInside&&s.series.isCartesian||s===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&&(s?s.setState():a()),n.showCrosshair)if(s)s.series.xAxis?.drawCrosshair(),s.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,o=i.length;n<o;++n){let o=i[n]?.options.id,a=this.getDataTable(o);a&&(e.addListener(a.id,"point.mouseOver"+t,s),e.addListener(a.id,"point.mouseOut"+t,r))}},l=()=>{let{dataCursor:e}=n,{connectorHandlers:i}=this;if(e)for(let n=0,o=i.length;n<o;++n){let o=i[n]?.options.id,a=this.getDataTable(o);a&&(e.removeListener(a.id,"point.mouseOver"+t,s),e.removeListener(a.id,"point.mouseOut"+t,r))}};if(n)return a(),l}}},tg={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 o=this.getDataTable();if(o){let{dataCursor:e}=n,{series:s}=i;s.forEach(i=>{i.update({events:{show:function(){e.emitCursor(o,{type:"position",state:"series.show"+t,column:this.name})},hide:function(){e.emitCursor(o,{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,o=(e,t)=>{for(let i of e)if(i.name===t)return i},s=t=>{let i=e.chart;if(i&&i.series?.length&&"position"===t.cursor.type&&void 0!==t.cursor.column){let e=o(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=o(i.series,t.cursor.column);e&&e.setVisible(!1,!0)}};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,r))})(),()=>{let t=e.getDataTable();t&&(n.dataCursor.removeListener(t.id,"series.show"+i,s),n.dataCursor.removeListener(t.id,"series.hide"+i,r))}}}},tf={defaultSyncPairs:{extremes:tu.syncPair,highlight:tm.syncPair,visibility:tg.syncPair},defaultSyncOptions:{extremes:tu.defaultOptions,highlight:tm.defaultOptions,visibility:tg.defaultOptions}},ty={allowConnectorUpdate:!0,className:[e9.defaultOptions.className,`${e9.defaultOptions.className}-highcharts`].join(" "),chartClassName:"chart-container",chartID:"chart-"+K(),chartOptions:{series:[]},chartConstructor:"chart",editableOptions:[{name:"connectorName",propertyPath:["connector","id"],type:"select"},...e9.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:S(e9.defaultOptions.editableOptionsBindings,{skipRedraw:["chartOptions","chartConfig"]})},{deepClone:tb}=e2;class tC extends e9{constructor(e,t,i){super(e,t=S(tC.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=S(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,o=e.length;n<o;n++){let o=e[n];for(let e=0;e<i;e++)t.series[e].update({point:{events:{update:e=>{this.onChartUpdate(e.target,o)}}}},!1)}}onChartUpdate(e,t){let i,n=t.dataTable,o=t.columnAssignment,s=e.series.options.id,r=new V,a=k(e.y,r.decimalRegExp);if(n){if(o&&s){let e=o.find(e=>e.seriesId===s)?.data;T(e)?i=e:Array.isArray(e)?i=e[1]:e&&(i=e.y??e.value)}i||(i=s??e.series.name),n.setCell(i,e.index,a)}}setOptions(){this.options.chartClassName&&(this.chartContainer.classList.value=ty.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(S(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,o=n.length;t<o;++t){let o=n[t];if(i.some(e=>e===o))continue;let s=e.get(o);s&&s.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,o=e.columnAssignment??[];for(let s=0,r=o.length;s<r;++s){let r=o[s],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=tC.charter||eL.win.Highcharts,t=this.chartConstructor=["chart","stockChart","mapChart","ganttChart"].indexOf(this.chartConstructor)>=0?this.chartConstructor:"chart",i=Object.hasOwnProperty.call(e,t)&&e[t];if(i)try{if("chart"===t)return e.Chart.chart(this.chartContainer,this.chartOptions);return new i(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,tC.defaultOptions),type:"Highcharts"}}getEditableOptions(){let e=this.options,t=this.chart,i=t&&t.options,n=i?.chart?.type||"line";return tb(S({chartOptions:i},{chartOptions:{yAxis:P(t&&t.yAxis[0].options),xAxis:P(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)}}tC.predefinedSyncConfig=tf,tC.defaultOptions=S(e9.defaultOptions,ty);let tw={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,o=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)}},s=()=>{let{dataCursor:e}=n;if(!e)return;let t=this.getDataTable();t&&e.addListener(t.id,"xAxis.extremes.max"+i,o)},r=()=>{let e=this.getDataTable(),{dataCursor:t}=n;e&&t.removeListener(e.id,"xAxis.extremes.max"+i,o)};if(n)return s(),r}}},tv={defaultSyncPairs:{extremes:tw.syncPair},defaultSyncOptions:{extremes:tw.defaultOptions}},tO={type:"KPI",className:[e9.defaultOptions.className,`${e9.defaultOptions.className}-kpi`].join(" "),minFontSize:20,thresholdColors:["#f45b5b","#90ed7d"],editableOptions:[{name:"connectorName",propertyPath:["connector","id"],type:"select"},...e9.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}},tT=["+","-","*","/","^","=","<","<=",">",">="],{isFormula:tx,isFunction:tE,isOperator:tM,isRange:tS,isReference:tR,isValue:tN}={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&&tT.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}},tA=/ */,tP=Number.MAX_VALUE/1.000000000001,tI=Number.MAX_VALUE/1.000000000002,tD=Number.MAX_VALUE,tL={"^":3,"*":2,"/":2,"+":1,"-":1,"=":0,"<":0,"<=":0,">":0,">=":0},tk={},tH=/^[A-Z][A-Z\.]*$/;function tF(e){switch(typeof e){case"boolean":return e?tD:tP;case"string":return tI;case"number":return e;default:return 0/0}}function tj(e){return"string"==typeof e?e.toLowerCase().replace(tA,"\0"):e}function tz(e){switch(typeof e){case"boolean":return+!!e;case"string":return parseFloat(e.replace(",","."));case"number":return e;default:return 0/0}}function tV(e,t){return tN(e)?e:tS(e)?t&&t$(e,t)||[]:tE(e)?tU(e,t):tG(tx(e)?e:[e],t)}function t$(e,t){let i=t.getColumnIds().slice(e.beginColumn,e.endColumn+1),n=[];for(let o=0,s=i.length,r;o<s;++o){let s=t.getColumn(i[o],!0)||[];for(let a=e.beginRow,l=e.endRow+1;a<l;++a)"string"==typeof(r=s[a])&&"="===r[0]&&t!==t.getModified()&&(r=t.getModified().getCell(i[o],a)),n.push(tN(r)?r:0/0)}return n}function tB(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 tN(n)?n:0/0}if(tN(n))return e.isNegative?-n:n}return 0/0}function t_(e,t){(e.length<2||t.length<1)&&e.push(0/0);let i=e.pop(),n=e.pop(),o=t.pop();g(i)&&g(n)&&g(o)?e.push(function(e,t,i){let n;switch(e){case"=":return tj(t)===tj(i);case"<":if(typeof t==typeof i)return tj(t)<tj(i);return tF(t)<tF(i);case"<=":if(typeof t==typeof i)return tj(t)<=tj(i);return tF(t)<=tF(i);case">":if(typeof t==typeof i)return tj(t)>tj(i);return tF(t)>tF(i);case">=":if(typeof t==typeof i)return tj(t)>=tj(i);return tF(t)>=tF(i)}switch(t=tz(t),i=tz(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 0/0}return n%1?Math.round(1e9*n)/1e9:n}(o,n,i)):e.push(0/0)}function tG(e,t){let i=[],n=[],o=!0;for(let s=0,r=e.length;s<r;++s){let r,a=e[s];if(tM(a)){if(o&&"-"===a)i.push(0),n.push("-"),o=!0;else{for(;n.length&&tL[n[n.length-1]]>=tL[a];)t_(i,n);n.push(a),o=!0}continue}if(tN(a))r=a;else if(tR(a))r=t?tB(a,t):0/0;else if(tE(a)){let e=tU(a,t);r=tN(e)?e:0/0}else tx(a)&&(r=tG(a,t));if(void 0===r)return 0/0;i.push(r),o=!1}for(;n.length;)t_(i,n);return 1!==i.length?0/0:i[0]}function tU(e,t,i){let n=tk[e.name];if(n)try{return n(e.args,t)}catch{return 0/0}let o=Error(`Function "${e.name}" not found.`);throw o.name="FormulaProcessError",o}let tY={asNumber:tz,getArgumentValue:tV,getArgumentsValues:function(e,t){let i=[];for(let n=0,o=e.length;n<o;++n)i.push(tV(e[n],t));return i},getRangeValues:t$,getReferenceValue:tB,processFormula:tG,processorFunctions:tk,registerProcessorFunction:function(e,t){return tH.test(e)&&!tk[e]&&!!(tk[e]=t)},translateReferences:function e(t,i=0,n=0){for(let o=0,s=t.length,r;o<s;++o)Array.isArray(r=t[o])?e(r,i,n):tE(r)?e(r.args,i,n):tS(r)?(r.beginColumnRelative&&(r.beginColumn+=i),r.beginRowRelative&&(r.beginRow+=n),r.endColumnRelative&&(r.endColumn+=i),r.endRowRelative&&(r.endRow+=n)):tR(r)&&(r.columnRelative&&(r.column+=i),r.rowRelative&&(r.row+=n));return t}};function tW(e,t){let i=tY.getArgumentsValues(e,t),n=0;for(let e=0,o=i.length,s;e<o;++e)switch(typeof(s=i[e])){case"number":isNaN(s)||(n+=s);break;case"object":n+=tW(s,t)}return n}tY.registerProcessorFunction("SUM",tW);let{getArgumentsValues:tJ}=tY;function tK(e,t){let i=tJ(e,t),n=0,o=0;for(let e=0,t=i.length,s;e<t;++e)switch(typeof(s=i[e])){case"number":isNaN(s)||(++n,o+=s);break;case"object":for(let e=0,t=s.length,i;e<t;++e)"number"!=typeof(i=s[e])||isNaN(i)||(++n,o+=i)}return n?o/n:0}function tZ(e,t){let i=[],n=tY.getArgumentsValues(e,t);for(let e=0,t=n.length,o;e<t;++e)switch(typeof(o=n[e])){case"number":isNaN(o)||i.push(o);break;case"object":for(let e=0,t=o.length,n;e<t;++e)"number"!=typeof(n=o[e])||isNaN(n)||i.push(n)}let o=i.length;if(!o)return 0/0;let s=Math.floor(o/2);return o%2?i[s]:(i[s-1]+i[s])/2}tY.registerProcessorFunction("AVERAGE",tK),tY.registerProcessorFunction("MEDIAN",tZ);let{getArgumentsValues:tq}=tY;function tX(e,t){let i=tq(e,t),n=-1/0;for(let e=0,t=i.length,o;e<t;++e)switch(typeof(o=i[e])){case"number":o>n&&(n=o);break;case"object":(o=tX(o))>n&&(n=o)}return isFinite(n)?n:0}tY.registerProcessorFunction("MAX",tX);let{getArgumentsValues:tQ}=tY;function t0(e,t){let i=tQ(e,t),n=1/0;for(let e=0,t=i.length,o;e<t;++e)switch(typeof(o=i[e])){case"number":o<n&&(n=o);break;case"object":(o=t0(o))<n&&(n=o)}return isFinite(n)?n:0}function t1(e,t){let i=tY.getArgumentsValues(e,t),n=0;for(let e=0,o=i.length,s;e<o;++e)switch(typeof(s=i[e])){case"number":!isNaN(s)&&++n;break;case"object":n+=t1(s,t)}return n}tY.registerProcessorFunction("MIN",t0),tY.registerProcessorFunction("COUNT",t1);let{getArgumentsValues:t2}=tY;function t3(e,t){let i=t2(e,t),n=1,o=!1;for(let e=0,s=i.length,r;e<s;++e)switch(typeof(r=i[e])){case"number":isNaN(r)||(o=!0,n*=r);break;case"object":o=!0,n*=t3(r,t)}return o?n:0}tY.registerProcessorFunction("PRODUCT",t3);let{pageLang:t4,win:t5}=a,t6=a.isSafari&&t5.Intl&&!t5.Intl.DateTimeFormat.prototype.formatRange,t8=class{constructor(e,t){this.options={timezone:"UTC"},this.variableTimezone=!1,this.Date=t5.Date,this.lang=t,this.update(e)}update(e={}){this.dTLCache={},this.options=e=S(!0,this.options,e);let{timezoneOffset:t,useUTC:i,locale:n}=e;this.Date=e.Date||t5.Date||Date;let o=e.timezone;g(i)&&(o=i?"UTC":void 0),t&&t%60==0&&(o="Etc/GMT"+(t>0?"+":"")+t/60),this.variableTimezone="UTC"!==o&&o?.indexOf("Etc/GMT")!==0,this.timezone=o,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)*864e5*e))})}toParts(e){let[t,i,n,o,s,r,a]=this.dateTimeFormat({weekday:"narrow",day:"numeric",month:"numeric",year:"numeric",hour:"numeric",minute:"numeric",second:"numeric"},e,"es").split(/(?:, | |\/|:)/g);return[+o,n-1,+i,+s,+r,+a,Math.floor(Number(e)||0)%1e3,"DLMXJVS".indexOf(t)]}dateTimeFormat(e,t,i=this.options.locale||this.lang?.locale||t4){let n=JSON.stringify(e)+i;T(e)&&(e=this.str2dtf(e));let o=this.dTLCache[n];if(!o){e.timeZone??(e.timeZone=this.timezone);try{o=new Intl.DateTimeFormat(i,e)}catch(t){/Invalid time zone/i.test(t.message)?(W(34),e.timeZone="UTC",o=new Intl.DateTimeFormat(i,e)):W(t.message,!1)}}return this.dTLCache[n]=o,o?.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,o,s,r){let a=this.Date.UTC(e,t,i,n,o||0,s||0,r||0);if("UTC"!==this.timezone){let e=this.getTimezoneOffset(a),i=(n-e/J.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)||t6||(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,o,s=0]=this.dateTimeFormat({timeZoneName:"shortOffset"},e,"en").split(/(GMT|:)/).map(Number),r=-(60*(n+s/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,o=/%\[([a-zA-Z]+)\]/g;for(;i=o.exec(e);)e=e.replace(i[0],this.dateTimeFormat(i[1],t,n?.locale))}if(T(e)&&-1!==e.indexOf("%")){let i=this,[o,s,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;R(y({a:m?m[u]:p[u].substr(0,3),A:p[u],d:N(r),e:N(r,2," "),w:u,v:n?.weekFrom??"",b:f[s],B:g[s],m:N(s+1),o:s+1,y:o.toString().substr(2,2),Y:o,H:N(l),k:l,I:N(l%12||12),l:l%12||12,M:N(h),p:l<12?"AM":"PM",P:l<12?"am":"pm",S:N(c),L:N(d,3)},a.dateFormats),function(n,o){if(T(e))for(;-1!==e.indexOf("%"+o);)e=e.replace("%"+o,"function"==typeof n?n.call(i,t,i):n)})}else if(M(e)){let i=(this.getTimezoneOffset(t)||0)/36e5,n=this.timezone||"Etc/GMT"+(i>=0?"+":"")+i,{prefix:o="",suffix:s=""}=e;e=o+this.dateTimeFormat(y({timeZone:n},e),t)+s}return i?I(e):e}resolveDTLFormat(e){return M(e,!0)?M(e,!0)&&void 0===e.main?{main:e}:e:{main:(e=P(e))[0],from:e[1],to:e[2]}}getDateFormat(e,t,i,n){let o=this.dateFormat("%m-%d %H:%M:%S.%L",t),s="01-01 00:00:00.000",r={millisecond:15,second:12,minute:9,hour:6,day:3},a="millisecond",l=a;for(a in J){if(e&&e===J.week&&+this.dateFormat("%w",t)===i&&o.substr(6)===s.substr(6)){a="week";break}if(e&&J[a]>e){a=l;break}if(r[a]&&o.substr(r[a])!==s.substr(r[a]))break;"week"!==a&&(l=a)}return this.resolveDTLFormat(n[a]).main}},t9=class extends t8{getBoundaryTicks(e,t,i,n){let o={};if(t===J.year)return o;let s=g(i)&&g(n),r=t<J.hour,a=t<J.day,l=t<J.month,h=t>=J.hour?9e5:t>=J.minute?6e4:t>=J.second&&1e3;if(e.length<1e4){let c=!0;for(let d=0;d<e.length;d++){let u=e[d];if(s){if(u<i)continue;if(u>n)break}if(c){if(t===J.month){o[u]="year",c=!1;continue}if(t===J.hour){o[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&&(o[u]="hour"),a&&C&&(o[u]="day"),l&&1===m&&C&&(o[u]="month"),0===p&&1===m&&C&&(o[u]="year"),c=!1}}return o}getTimeTicks(e,t,i,n){let o=[],{count:s=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>=J.second?0:s*Math.floor(m/s),r>=J.second&&(p=r>=J.minute?0:s*Math.floor(p/s)),r>=J.minute&&(u=r>=J.hour?0:s*Math.floor(u/s)),r>=J.hour&&(d=r>=J.day?0:s*Math.floor(d/s)),r>=J.day&&(c=r>=J.month?1:Math.max(1,s*Math.floor(c/s))),r>=J.month&&(h=r>=J.year?0:s*Math.floor(h/s)),r>=J.year&&(l-=l%s),r===J.week){s&&(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*J.month||this.getTimezoneOffset(t)!==this.getTimezoneOffset(i));let e=t,a=1;for(;e<i;)o.push(e),r===J.year?e=this.makeTime(l+a*s,0):r===J.month?e=this.makeTime(l,h+a*s):f&&(r===J.day||r===J.week)?e=this.makeTime(l,h,c+a*s*(r===J.day?1:7)):f&&r===J.hour&&s>1?e=this.makeTime(l,h,c,d+a*s):e+=r*s,a++;o.push(e)}return o.info=y(e,{boundaryTicks:this.getBoundaryTicks(o,r,a,i),totalRange:r*s}),o}},{isTouchDevice:t7}=a,ie={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:t7?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"}},it=new t9(ie.time,ie.lang),{defaultOptions:ii,defaultTime:io}={defaultOptions:ie,defaultTime:it,getOptions:function(){return ie},setOptions:function(e){return b(a,"setOptions",{options:e}),S(!0,ie,e),e.time&&it.update(ie.time),e.lang&&"locale"in e.lang&&it.update({locale:e.lang.locale}),e.lang?.chartTitle&&(ie.title={...ie.title,text:e.lang.chartTitle}),ie}},{pageLang:is}=a,ir={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)=>il(t.body,y(M(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:I,unless:e=>!e},ia={};function il(e="",t,i){let n=/\{([^{}]+)\}/g,o=/\(([^()]+)\)/g,s=[],r=/f$/,a=/\.(\d)/,l=i?.options?.lang||ii.lang,c=i?.time||io,d=i?.numberFormatter||ih.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 o=e.split(".");for(;o.length&&g(n);){let e=o.shift();if(void 0===e||"__proto__"===e)return;if("this"===e){let e;return M(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=o.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("#","");ir[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||(s.push(m),m=void 0)}else m.isBlock||s.push(m);if(n&&!m?.isBlock)break}return s.forEach(n=>{let s,h,{body:p,elseBody:m,expression:g,fn:f}=n;if(f){let e=[n],o=[],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||(o.push(g.substr(a,h-a)),a=h+1)}for(h=ir[f].length;h--;)e.unshift(u(o[h+1]));s=ir[f].apply(t,e),n.isBlock&&"boolean"==typeof s&&(s=il(s?p:m,t,i))}else{let e=/^["'].+["']$/.test(g)?[g]:g.split(":");if(s=u(e.shift()||""),e.length&&"number"==typeof s){let t=e.join(":");if(r.test(t)){let e=parseInt((t.match(a)||["","-1"])[1],10);null!==s&&(s=d(s,e,l.decimalPoint,t.indexOf(",")>-1?l.thousandsSep:""))}else s=c.dateFormat(t,s)}o.lastIndex=0,o.test(n.find)&&T(s)&&(s=`"${s}"`)}e=e.replace(n.find,s??"")}),y?il(e,t,i):e}function ih(e,t,i,n){t*=1;let o,s,[r,a]=(e=+e||0).toString().split("e").map(Number),l=this?.options?.lang||ii.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&&((s=t+a)>=0?(r=+r.toExponential(s).split("e")[0],t=s):(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||is,m=JSON.stringify(d)+p;return o=(ia[m]??(ia[m]=new Intl.NumberFormat(p,d))).format(e),u&&(o=o.replace(/([,\.])/g,"_$1").replace(/_\,/g,n??",").replace("_.",i??".")),(t||0!=+o)&&(!(a<0)||c)||(o="0"),a&&0!=+o&&(o+="e"+(a<0?"":"+")+a),o}let{format:ic}={dateFormat:function(e,t,i){return io.dateFormat(e,t,i)},format:il,helpers:ir,numberFormat:ih};class id extends e9{constructor(e,t,i){super(e,t=S(id.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=id.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,S(id.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(E(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 id.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=ic(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],o=n?.points[i.pointIndex??0];n?o?o.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+ic("{v:,.2f}%",{v:i/this.prevValue*100})}return e.text||""}return""}getSubtitleClassName(){let{subtitle:e}=this.options;return`${e9.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,id.defaultOptions),type:"KPI"}}}id.defaultOptions=S(e9.defaultOptions,tO),id.predefinedSyncConfig=tv,id.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}}}},id.formulaFunctions={SUM:tW,AVERAGE:tK,MEDIAN:tZ,MAX:tX,MIN:t0,COUNT:t1,PRODUCT:t3};let iu={type:"Navigator",className:[e9.defaultOptions.className,`${e9.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:(e9.defaultOptions.editableOptions||[]).concat()},ip=function(e,t,i,n){let o=!1,s=!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,s=!0):(a.value=i,o=!0),o&&s))return}s||r.push({operator:"<=",columnId:t,value:n}),o||r.push({operator:">=",columnId:t,value:i})},im=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 o=n.columnId;t[o]||(t[o]={maxValue:1/0,minValue:-1/0,columnId:o}),"<="===n.operator?t[o].maxValue=n.value:t[o].minValue=n.value}return Object.values(t)},{Filter:ig}=_.types,iy={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:"",o=async e=>{if(t.connectorHandlers?.[0]?.connector){let i=t.connectorHandlers[0].connector.getTable(),o=t.board.dataCursor,s=t.getColumnAssignment()[0],[r,a]=t.getAxisExtremes(),l=i.getModifier();l instanceof ig?ip(l.options,s,r,a):l=new ig({condition:{operator:"and",conditions:[{columnId:s,operator:">=",value:r},{columnId:s,operator:"<=",value:a}]}}),await i.setModifier(l),o.emitCursor(i,{type:"position",column:s,row:i.getRowIndexBy(s,r),state:"crossfilter"+n},e),o.emitCursor(i,{type:"position",column:s,row:i.getRowIndexBy(s,a),state:"crossfilter"+n},e)}};return c(t.chart.xAxis[0],"afterSetExtremes",function(t){clearTimeout(e),e=setTimeout(o,50,this,t)})},handler:void 0}},{Filter:ib}=_.types,iC={defaultOptions:{},syncPair:{emitter:function(){let e;if("Navigator"!==this.type)return;let t=this,i=this.sync.syncConfig.extremes,n=i.group?":"+i.group:"",o=e=>{if(t.connectorHandlers?.[0]?.connector){let i=t.connectorHandlers[0].connector.getTable(),o=t.board.dataCursor,s=t.getColumnAssignment()[0],[r,a]=t.getAxisExtremes();o.emitCursor(i,{type:"position",column:s,row:i.getRowIndexBy(s,r),state:"xAxis.extremes.min"+n},e),o.emitCursor(i,{type:"position",column:s,row:i.getRowIndexBy(s,a),state:"xAxis.extremes.max"+n},e)}};return c(t.chart.xAxis[0],"afterSetExtremes",function(t){clearTimeout(e),e=setTimeout(o,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:"",o=t.board.dataCursor,s=e=>{let i=e.cursor;if(!t.connectorHandlers?.[0]?.connector)return;let o=t.connectorHandlers[0].connector.getTable(),s=o.getColumnIds()[0],r=o.getRowCount(),a=0;"range"===i.type?(r=i.lastRow,a=i.firstRow,i.columns&&(s=i.columns[0]??s)):i.state==="xAxis.extremes.max"+n?(s=i.column??s,r=i.row??r):(s=i.column??s,a=i.row??a);let l=o.getModifier();if("string"==typeof s&&l instanceof ib){let e=o.getCell(s,a),t=o.getCell(s,r);g(t)&&g(e)&&(ip(l.options,s,e,t),o.setModifier(l))}};return(e=t.connectorHandlers?.[0]?.connector?.getTable())&&(o.addListener(e.id,"xAxis.extremes"+n,s),o.addListener(e.id,"xAxis.extremes.max"+n,s),o.addListener(e.id,"xAxis.extremes.min"+n,s)),()=>{let e=t.connectorHandlers?.[0]?.connector?.getTable();e&&(o.removeListener(e.id,"xAxis.extremes"+n,s),o.removeListener(e.id,"xAxis.extremes.max"+n,s),o.removeListener(e.id,"xAxis.extremes.min"+n,s))}}}},iw={defaultSyncPairs:{crossfilter:iy.syncPair,extremes:iC.syncPair},defaultSyncOptions:{crossfilter:iy.defaultOptions,extremes:iC.defaultOptions}};class iv extends e9{constructor(e,t){super(e,t),this.type="Navigator",this.options=S(iv.defaultOptions,t);let i=iv.charter.Chart||eL.win.Highcharts;this.chartContainer=eL.win.document.createElement("div"),this.chart=i.chart(this.chartContainer,this.options.chartOptions||{}),this.chartContainer.classList.add(eL.classNamePrefix+"navigator"),this.sync.syncConfig.crossfilter?.enabled&&this.chart.update(S({navigator:{xAxis:{labels:{format:"{value}"}}}},this.options.chartOptions||{}),!1)}adjustNavigator(){let e=this.chart,t=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,o=i.top-e.plotTop+i.height;i.height!==o&&(n.navigator={handles:{height:Math.round(t/4)},height:o}),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,iu),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.chart.container&&(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(),o=t.getColumn(n[0],!0)||[];i=this.sync.syncConfig.crossfilter?.enabled?this.generateCrossfilterData():o.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 o=[],s=[];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.");o.push(t),-1===s.indexOf(t)&&s.push(t)}}s.sort((e,t)=>(e??0/0)<(t??0/0)?-1:+(e!==t));let r=i.getModifier()?.options;if(t.affectNavigator&&r?.type==="Filter"){let t=[],n=[],s=im(r);for(let e=0,o=s.length;e<o;e++)s[e].columnId!==this.getColumnAssignment()[0]&&(t.push(s[e]),n.push(i.getColumn(s[e].columnId,!0)||[]));e=[];let a=t.length;for(let i=0,s=o.length;i<s;i++){let s=o[i],r=!0;for(let e=0;e<a;e++){let o=t[e];if(!(n[e][i]>=(o.minValue??-1/0)&&n[e][i]<=(o.maxValue??1/0))){r=!1;break}}r&&e.push(s)}}else e=o;let a=[];if(this.stringData){this.categories=s;for(let e=0,t=s.length;e<t;e++)a.push([e,null])}else for(let e=0,t=s.length;e<t;e++)a.push([s[e],null]);for(let t=0,i=e.length;t<i;t++){let i=s.indexOf(e[t]);a[i][1]=(a[i][1]||0)+1}return a}resize(e,t){return super.resize(e,t),this.redrawNavigator(),this}destroy(){this.chart.destroy(),super.destroy()}async update(e,t=!0){let i=this.chart;await super.update(e,!1),e.chartOptions&&i.update(S(this.sync.syncConfig.crossfilter?.enabled?{navigator:{xAxis:{labels:{format:"{value}"}}}}:{},e.chartOptions),!1),this.emit({type:"afterUpdate"}),t&&this.render()}getOptionsOnDrop(){return{}}}iv.defaultOptions=S(e9.defaultOptions,iu),iv.predefinedSyncConfig=iw;let iO={custom:{connectHighcharts:function(e){tC.charter=e,id.charter=e,iv.charter=e}},name:"Highcharts.DashboardsPlugin",onRegister:function(e){let{ComponentRegistry:t}=e;t.registerComponent("Highcharts",tC),t.registerComponent("KPI",id),t.registerComponent("Navigator",iv)},onUnregister:function(e){}},iT={};eL.board=ti.board,eL.addEvent=c,eL.createElement=p,eL.css=m,eL.defined=g,eL.diffObjects=f,eL.error=e2.error,eL.find=w,eL.fireEvent=b,eL.getStyle=C,eL.isArray=x,eL.isFunction=E,eL.isNumber=O,eL.isObject=M,eL.isString=T,eL.merge=S,eL.objectEach=R,eL.removeEvent=A,eL.setOptions=function(e){S(!0,e_,e)},eL.splat=P,eL.uniqueKey=K,eL.AST=eR,eL.Board=ti,eL.Component=e9,eL.ComponentRegistry=eA,eL.GridComponent=tc,eL.HighchartsComponent=tC,eL.HTMLComponent=tt,eL.KPIComponent=id,eL.NavigatorComponent=iv,eL.DataConnector=en,eL.DataConverter=V,eL.DataCursor=eO,eL.DataModifier=_,eL.DataPool=eB,eL.DataTable=et,eL.defaultOptions=e_,eL.GridPlugin=td,eL.HighchartsPlugin=iO,eL.PluginHandler={addPlugin:function(e,t=e.name){let{maxRevision:i,minRevision:n,onRegister:o}=e;if(iT[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.`);o({Board:ti,ComponentRegistry:eA,Sync:eQ,revision:0}),iT[t]=e},removePlugin:function(e){iT[e]&&(iT[e].onUnregister({ComponentRegistry:eA,Board:ti,Sync:eQ,revision:0}),delete iT[e])},registry:iT,revision:0},eL.Sync=eQ,eL.win.Dashboards||(eL.win.Dashboards=eL),eL.win.Grid&&(td.custom.connectGrid(eL.win.Grid),eL.PluginHandler.addPlugin(td)),eL.win.Highcharts&&(iO.custom.connectHighcharts(eL.win.Highcharts),eL.PluginHandler.addPlugin(iO));let ix=eL;return r.default})());