"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const _=require("./Colors.js"),h="#9F9F9F";class M extends _.default{constructor(r,p,c,f,y,b,n,a,o,t,s){super(c,f,y,b,n),this.colorMap={},this._colorBy=p=="line"?"id":c;const g=e=>e==null?void 0:e.map(u=>{const i=u.group.label;return u.label.includes(i)?u:{...u,label:`${i} - ${u.label}`}}),C=()=>{var e;return o&&o.size>0?o:((e=s==null?void 0:s.metadata)==null?void 0:e.measures.length)>0?(s.metadata.measures=g(s.metadata.measures),s.metadata.measures):[]};this._indexBy&&(a==null?void 0:a.size)>0&&[...a].forEach(e=>{e&&e.items&&e.items.forEach(l=>{t&&l.labels&&l.labels[t.toUpperCase()]?this.colorMap[l.labels[t.toUpperCase()]]=l.categoryStyle:this.colorMap[l.value]=l.categoryStyle})}),o&&(o=C(),[...o].forEach(e=>{e&&e.styles&&(t&&e.labels&&e.labels[t.toUpperCase()]?this.colorMap[e.labels[t.toUpperCase()]]=e.styles:this.colorMap[e.label]=e.styles)}))}getColor(r,p){return this._colorBy==="index"?this.colorMap[p[this._indexBy]]?this.colorMap[p[this._indexBy]].color:h:this.colorMap[r]?this.colorMap[r].color:h}getColorByIndex(r){return this.colorMap[r]?this.colorMap[r].color:h}getColorByKey(r){return this.colorMap[r]?this.colorMap[r].color:h}}exports.default=M;
