@nebula.js/sn-bar-chart
Version:
Bar chart supernova
9 lines (8 loc) • 742 kB
JavaScript
/*
* @nebula.js/sn-bar-chart v2.4.0
* Copyright (c) 2026 QlikTech International AB
* Released under the MIT license.
*/
import e from"picasso.js";import t from"picasso-plugin-q";import n from"picasso-plugin-hammer";import r from"hammerjs";import i,{useState as o,useEffect as a,useRef as s}from"react";import{styled as l,Button as u,ListItemButton as c,ListItemIcon as d,Divider as f,createTheme as p,SvgIcon as m,Popover as h,List as g,ListItemText as y,ThemeProvider as v}from"@mui/material";import b from"react-dom";import{useTranslator as x,useEmbed as q,useTheme as S,useState as M,useDeviceType as D,useAppLayout as C,useEffect as w,useElement as E,useOptions as O,useLayout as A,useAction as T,useStaleLayout as k,useModel as L,useApp as N,usePlugins as I,useSelections as P,useConstraints as R,useRect as F,usePromise as j,onTakeSnapshot as z,useImperativeHandle as H,useRenderState as V}from"@nebula.js/stardust";function B(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var _,U;var $=function(){if(U)return _;U=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===t.call(e)},o=function(n){if(!n||"[object Object]"!==t.call(n))return!1;var r,i=e.call(n,"constructor"),o=n.constructor&&n.constructor.prototype&&e.call(n.constructor.prototype,"isPrototypeOf");if(n.constructor&&!i&&!o)return!1;for(r in n);return void 0===r||e.call(n,r)},a=function(e,t){n&&"__proto__"===t.name?n(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},s=function(t,n){if("__proto__"===n){if(!e.call(t,n))return;if(r)return r(t,n).value}return t[n]};return _=function e(){var t,n,r,l,u,c,d=arguments[0],f=1,p=arguments.length,m=!1;for("boolean"==typeof d&&(m=d,d=arguments[1]||{},f=2),(null==d||"object"!=typeof d&&"function"!=typeof d)&&(d={});f<p;++f)if(null!=(t=arguments[f]))for(n in t)r=s(d,n),d!==(l=s(t,n))&&(m&&l&&(o(l)||(u=i(l)))?(u?(u=!1,c=r&&i(r)?r:[]):c=r&&o(r)?r:{},a(d,{name:n,newValue:e(m,c,l)})):void 0!==l&&a(d,{name:n,newValue:l}));return d},_}(),W=B($),K={MAX_NUM_POINTS:5e4,DEFAULT_NUM_POINTS:2e3,DEFAULT_NUM_LINES:12};const{DEFAULT_NUM_POINTS:G}=K;function Y({layoutService:e,largeDataService:t}){const{maxNumPoints:n=G}=t?.meta||{},{qHyperCube:r}=e.getLayout();return r.qSize.qcy*r.qMeasureInfo.length>n}const{DEFAULT_NUM_LINES:X}=K,J=({layoutService:e,largeDataService:t})=>{const{maxNumLines:n=X}=t?.meta||{},{qHyperCube:r}=e.getLayout();return r.qDimensionInfo.length>1&&!Y({layoutService:e,largeDataService:t})?e.meta.size.dimensions[1]+1:n},{DEFAULT_NUM_POINTS:Z}=K,{MAX_NUM_POINTS:Q,DEFAULT_NUM_POINTS:ee,DEFAULT_NUM_LINES:te}=K,{DEFAULT_NUM_POINTS:ne}=K,re=({layoutService:e,largeDataService:t})=>{if(!Y({layoutService:e,largeDataService:t})){const{maxNumPoints:e=ne}=t?.meta||{};return e}const{dimensionCount:n}=e.meta;return n>1?(({layoutService:e,largeDataService:t})=>{const{dimensions:n=[]}=e?.meta?.size||{},{maxNumLines:r=te,maxNumPoints:i=ee,hasInjectedData:o=!1}=t?.meta||{};if(J({layoutService:e,largeDataService:t})*n[0]<=i)return n[0];const a=Math.max(1,Math.min(r,n[1])),s=i/a,l=Math.floor(n[0]<=s?s:s/4),u=2*a*(a+1);return o&&(a>te||i>ee)?Math.min(l,Math.ceil(Q/u)):l})({layoutService:e,largeDataService:t}):(({layoutService:e,largeDataService:t})=>{const{maxNumPoints:n=Z}=t?.meta||{},{measureCount:r=1}=e?.meta||{},i=4+2*(r-1);return Math.floor(n/(r*i))})({layoutService:e,largeDataService:t})};function ie({model:e,layoutService:t,largeDataService:n,definitionPath:r="/qHyperCubeDef"}){return{shouldFetchReduced:()=>Y({layoutService:t,largeDataService:n}),computeNbrOfBins:()=>re({layoutService:t,largeDataService:n}),computeMaxNumberLines:()=>J({layoutService:t,largeDataService:n}),fetch:(i,o)=>(({start:e,end:t,model:n,layoutService:r,largeDataService:i,definitionPath:o})=>{const a={qStart:e,qEnd:t,qNbrPoints:re({layoutService:r,largeDataService:i}),qMaxNbrTicks:300,qMaxNumberLines:J({layoutService:r,largeDataService:i})};return n.getHyperCubeContinuousData(o,a,!1)})({start:i,end:o,model:e,layoutService:t,largeDataService:n,definitionPath:r})}}function oe(e={}){const{cache:t={}}=e;return{fetch:()=>Promise.resolve(t.merged)}}function ae({layoutService:e,viewCache:t}){return{fetch:()=>{const{qAxisData:t,qDataPages:n}=e.getHyperCube();return Promise.resolve({qAxisData:t,qDataPages:n})},getSnapshotData(){const n=e.getLayoutValue("snapshotData.content.chartData",{});return"zoom"in n&&"min"in n.zoom&&"max"in n.zoom?function({zoom:e}){return{zoom:e}}(n):function({scrollOffset:e=0,viewRange:t=0},n){let r=n+e,i=r+t;return 1===t&&0===e&&(r=n-.5,i=n+.5),{zoom:{min:r,max:i}}}(n,t.get("continuousMin"))}}}function se(){const e=()=>{},t=[],n={};return e.set=(e,r)=>{const i=t.indexOf(e);i>-1&&t.splice(i,1),t.push(e),n[e]=r},e.forEach=e=>{t.forEach((t,r)=>e(n[t],r))},e.has=e=>e in n,e}function le(e,t,n){return n[0]&&n[0][1]&&n[0][1].qElemNumber>-1?function({start:e,end:t,matrix:n}){const r=[],i=se(),o=se();for(let a=0;a<n.length;a++){const s=n[a],l=s[1].qElemNumber.toString();s[0].qNum<e?i.set(l,s):s[0].qNum>t&&(o.has(l)||o.set(l,s)),s[0].qNum>=e&&s[0].qNum<=t&&r.push(s)}return i.forEach((e,t)=>r.splice(t,0,e)),o.forEach(e=>r.push(e)),r}({start:e,end:t,matrix:n}):function({start:e,end:t,matrix:n}){const r=[];let i,o;for(let a=0;a<n.length;a++){const s=n[a];s[0].qNum<e?i=s:s[0].qNum>t&&(o||(o=s)),s[0].qNum>=e&&s[0].qNum<=t&&r.push(s)}return i&&r.unshift(i),o&&r.push(o),r}({start:e,end:t,matrix:n})}function ue(e,t){return{...e,qWidth:t[0]?t[0].length:0,qHeight:t.length}}function ce(e,t,n){const r={qDataPages:(n.qDataPages||[]).map(n=>{const r=le(e,t,n.qMatrix),i=ue(n.qArea,r);return{...n,qArea:i,qMatrix:r}})};return n.qAxisData&&n.qAxisData.qAxis&&(r.qAxisData=function(e,t,n){return{qAxis:n.qAxis.map(n=>({qName:n.qName,qTags:n.qTags,qTicks:n.qTicks.reduce((n,r)=>((r.qStart>=e&&r.qStart<=t||r.qEnd>=e&&r.qEnd<=t||r.qStart<e&&r.qEnd>t)&&n.push(r),n),[])}))}}(e,t,n.qAxisData)),r}const de=2**.5,fe=1/de,pe=fe**44;function me(e){return e.qIsOtherCell}function he({qDataPages:e=[]}={},t={}){const n=e.length?e[0].qMatrix:[];return t.isStackedByDimension?function(e){const t={};return e.forEach(e=>{if(!e.some(me)){const n=e[0].qElemNumber;t[n]=void 0}}),Object.keys(t).length}(n):function(e){let t=0;return e.forEach(e=>{e.some(me)||t++}),t}(n)}const ge={query:{getShouldProcess:()=>!1},command:{processDataPage:()=>{}}};function ye(e){return null!==e&&"object"==typeof e&&"r"in e&&"number"==typeof e.r&&"g"in e&&"number"==typeof e.g&&"b"in e&&"number"==typeof e.b&&("number"==typeof e.a||void 0===e.a)}function ve(e){if("object"==typeof e&&ye(e))return(e.r<<16)+(e.g<<8)+e.b;let t=0,n=0,r=0;if("string"==typeof e){let i;(i=/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i.exec(e))?(t=parseInt(i[1],10),n=parseInt(i[2],10),r=parseInt(i[3],10)):(i=/^#([A-Fa-f0-9]{2})([A-Fa-f0-9]{2})([A-Fa-f0-9]{2})$/i.exec(e))?(t=parseInt(i[1],16),n=parseInt(i[2],16),r=parseInt(i[3],16)):(i=/^#([A-Fa-f0-9])([A-Fa-f0-9])([A-Fa-f0-9])$/i.exec(e))&&(t=parseInt(i[1]+i[1],16),n=parseInt(i[2]+i[2],16),r=parseInt(i[3]+i[3],16))}return(t<<16)+(n<<8)+r}const be={aliceblue:{r:240,g:248,b:255},antiquewhite:{r:250,g:235,b:215},aqua:{r:0,g:255,b:255},aquamarine:{r:127,g:255,b:212},azure:{r:240,g:255,b:255},beige:{r:245,g:245,b:220},bisque:{r:255,g:228,b:196},black:{r:0,g:0,b:0},blanchedalmond:{r:255,g:235,b:205},blue:{r:0,g:0,b:255},blueviolet:{r:138,g:43,b:226},brown:{r:165,g:42,b:42},burlywood:{r:222,g:184,b:135},cadetblue:{r:95,g:158,b:160},chartreuse:{r:127,g:255,b:0},chocolate:{r:210,g:105,b:30},coral:{r:255,g:127,b:80},cornflowerblue:{r:100,g:149,b:237},cornsilk:{r:255,g:248,b:220},crimson:{r:220,g:20,b:60},cyan:{r:0,g:255,b:255},darkblue:{r:0,g:0,b:139},darkcyan:{r:0,g:139,b:139},darkgoldenrod:{r:184,g:134,b:11},darkgray:{r:169,g:169,b:169},darkgreen:{r:0,g:100,b:0},darkgrey:{r:169,g:169,b:169},darkkhaki:{r:189,g:183,b:107},darkmagenta:{r:139,g:0,b:139},darkolivegreen:{r:85,g:107,b:47},darkorange:{r:255,g:140,b:0},darkorchid:{r:153,g:50,b:204},darkred:{r:139,g:0,b:0},darksalmon:{r:233,g:150,b:122},darkseagreen:{r:143,g:188,b:143},darkslateblue:{r:72,g:61,b:139},darkslategray:{r:47,g:79,b:79},darkslategrey:{r:47,g:79,b:79},darkturquoise:{r:0,g:206,b:209},darkviolet:{r:148,g:0,b:211},deeppink:{r:255,g:20,b:147},deepskyblue:{r:0,g:191,b:255},dimgray:{r:105,g:105,b:105},dimgrey:{r:105,g:105,b:105},dodgerblue:{r:30,g:144,b:255},firebrick:{r:178,g:34,b:34},floralwhite:{r:255,g:250,b:240},forestgreen:{r:34,g:139,b:34},fuchsia:{r:255,g:0,b:255},gainsboro:{r:220,g:220,b:220},ghostwhite:{r:248,g:248,b:255},gold:{r:255,g:215,b:0},goldenrod:{r:218,g:165,b:32},gray:{r:128,g:128,b:128},green:{r:0,g:128,b:0},greenyellow:{r:173,g:255,b:47},grey:{r:128,g:128,b:128},honeydew:{r:240,g:255,b:240},hotpink:{r:255,g:105,b:180},indianred:{r:205,g:92,b:92},indigo:{r:75,g:0,b:130},ivory:{r:255,g:255,b:240},khaki:{r:240,g:230,b:140},lavender:{r:230,g:230,b:250},lavenderblush:{r:255,g:240,b:245},lawngreen:{r:124,g:252,b:0},lemonchiffon:{r:255,g:250,b:205},lightblue:{r:173,g:216,b:230},lightcoral:{r:240,g:128,b:128},lightcyan:{r:224,g:255,b:255},lightgoldenrodyellow:{r:250,g:250,b:210},lightgray:{r:211,g:211,b:211},lightgreen:{r:144,g:238,b:144},lightgrey:{r:211,g:211,b:211},lightpink:{r:255,g:182,b:193},lightsalmon:{r:255,g:160,b:122},lightseagreen:{r:32,g:178,b:170},lightskyblue:{r:135,g:206,b:250},lightslategray:{r:119,g:136,b:153},lightslategrey:{r:119,g:136,b:153},lightsteelblue:{r:176,g:196,b:222},lightyellow:{r:255,g:255,b:224},lime:{r:0,g:255,b:0},limegreen:{r:50,g:205,b:50},linen:{r:250,g:240,b:230},magenta:{r:255,g:0,b:255},maroon:{r:128,g:0,b:0},mediumaquamarine:{r:102,g:205,b:170},mediumblue:{r:0,g:0,b:205},mediumorchid:{r:186,g:85,b:211},mediumpurple:{r:147,g:112,b:219},mediumseagreen:{r:60,g:179,b:113},mediumslateblue:{r:123,g:104,b:238},mediumspringgreen:{r:0,g:250,b:154},mediumturquoise:{r:72,g:209,b:204},mediumvioletred:{r:199,g:21,b:133},midnightblue:{r:25,g:25,b:112},mintcream:{r:245,g:255,b:250},mistyrose:{r:255,g:228,b:225},moccasin:{r:255,g:228,b:181},navajowhite:{r:255,g:222,b:173},navy:{r:0,g:0,b:128},oldlace:{r:253,g:245,b:230},olive:{r:128,g:128,b:0},olivedrab:{r:107,g:142,b:35},orange:{r:255,g:165,b:0},orangered:{r:255,g:69,b:0},orchid:{r:218,g:112,b:214},palegoldenrod:{r:238,g:232,b:170},palegreen:{r:152,g:251,b:152},paleturquoise:{r:175,g:238,b:238},palevioletred:{r:219,g:112,b:147},papayawhip:{r:255,g:239,b:213},peachpuff:{r:255,g:218,b:185},peru:{r:205,g:133,b:63},pink:{r:255,g:192,b:203},plum:{r:221,g:160,b:221},powderblue:{r:176,g:224,b:230},purple:{r:128,g:0,b:128},red:{r:255,g:0,b:0},rosybrown:{r:188,g:143,b:143},royalblue:{r:65,g:105,b:225},saddlebrown:{r:139,g:69,b:19},salmon:{r:250,g:128,b:114},sandybrown:{r:244,g:164,b:96},seagreen:{r:46,g:139,b:87},seashell:{r:255,g:245,b:238},sienna:{r:160,g:82,b:45},silver:{r:192,g:192,b:192},skyblue:{r:135,g:206,b:235},slateblue:{r:106,g:90,b:205},slategray:{r:112,g:128,b:144},slategrey:{r:112,g:128,b:144},snow:{r:255,g:250,b:250},springgreen:{r:0,g:255,b:127},steelblue:{r:70,g:130,b:180},tan:{r:210,g:180,b:140},teal:{r:0,g:128,b:128},thistle:{r:216,g:191,b:216},tomato:{r:255,g:99,b:71},transparent:{r:0,g:0,b:0,a:0},turquoise:{r:64,g:224,b:208},violet:{r:238,g:130,b:238},wheat:{r:245,g:222,b:179},white:{r:255,g:255,b:255},whitesmoke:{r:245,g:245,b:245},yellow:{r:255,g:255,b:0},yellowgreen:{r:154,g:205,b:50}},xe="qcm-color";function qe(...e){const t={type:xe,r:0,g:0,b:0,a:1,invalid:!1,spaces:{}};let n=0,r=0,i=0,o=1;if(null!==(a=e[0])&&"object"==typeof a&&"type"in a&&a.type===xe)({r:n,g:r,b:i,a:o}=e[0]),t.invalid=e[0].invalid,t.spaces={...e[0].spaces};else if(ye(e[0]))({r:n,g:r,b:i}=e[0]),"a"in e[0]&&({a:o}=e[0]);else if(e.length<3)if("string"==typeof e[0]){const a=e[0];let s;if(s=/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i.exec(a))n=parseInt(s[1],10),r=parseInt(s[2],10),i=parseInt(s[3],10);else if(s=/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d(\.\d+)?)\s*\)$/i.exec(a))n=parseInt(s[1],10),r=parseInt(s[2],10),i=parseInt(s[3],10),o=parseFloat(s[4]);else if(s=/^ARGB\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i.exec(a))o=parseInt(s[1],10)/255,n=parseInt(s[2],10),r=parseInt(s[3],10),i=parseInt(s[4],10);else if(s=/^#([A-Fa-f0-9]{2})([A-Fa-f0-9]{2})([A-Fa-f0-9]{2})$/i.exec(a))n=parseInt(s[1],16),r=parseInt(s[2],16),i=parseInt(s[3],16),o=1;else if(s=/^#([A-Fa-f0-9])([A-Fa-f0-9])([A-Fa-f0-9])$/i.exec(a))n=parseInt(s[1]+s[1],16),r=parseInt(s[2]+s[2],16),i=parseInt(s[3]+s[3],16),o=1;else if(s=/^hsl\(\s*(\d+(\.\d+)?)\s*,\s*(\d+(\.\d+)?%?)\s*,\s*(\d+(\.\d+)?%?)\s*\)$/i.exec(a)){let e=parseFloat(s[1]),t=parseFloat(s[3]),a=parseFloat(s[5]);e%=360,t/=100,a/=100,e=e<0?0:e>360?360:e,t=t<0?0:t>1?1:t,a=a<0?0:a>1?1:a;const l=a<=.5?2*a*t:(2-2*a)*t;let u=e/60;const c=l*(1-Math.abs(u%2-1));let d=[];switch(u=Math.floor(u),u){case 0:d=[l,c,0];break;case 1:d=[c,l,0];break;case 2:d=[0,l,c];break;case 3:d=[0,c,l];break;case 4:d=[c,0,l];break;case 5:d=[l,0,c];break;default:d=[0,0,0]}const f=a-.5*l;n=d[0]+f,r=d[1]+f,i=d[2]+f,n=Math.round(255*n),r=Math.round(255*r),i=Math.round(255*i),o=1}else if(s=/^hsla\(\s*(\d+(\.\d+)?)\s*,\s*(\d+(\.\d+)?%?)\s*,\s*(\d+(\.\d+)?%?)\s*,\s*(\d(\.\d+)?)\s*\)$/i.exec(a)){let e=parseFloat(s[1]),t=parseFloat(s[3]),a=parseFloat(s[5]);o=parseFloat(s[7]),e%=360,t/=100,a/=100,e=e<0?0:e>360?360:e,t=t<0?0:t>1?1:t,a=a<0?0:a>1?1:a;const l=a<=.5?2*a*t:(2-2*a)*t;let u=e/60;const c=l*(1-Math.abs(u%2-1));let d=[];switch(u=Math.floor(u),u){case 0:d=[l,c,0];break;case 1:d=[c,l,0];break;case 2:d=[0,l,c];break;case 3:d=[0,c,l];break;case 4:d=[c,0,l];break;case 5:d=[l,0,c];break;default:d=[0,0,0]}const f=a-.5*l;n=d[0]+f,r=d[1]+f,i=d[2]+f,n=Math.round(255*n),r=Math.round(255*r),i=Math.round(255*i)}else if(s=/^hsv\(\s*(\d+(\.\d+)?)\s*,\s*(\d+(\.\d+)?%?)\s*,\s*(\d+(\.\d+)?%?)\s*\)$/i.exec(a)){let e=parseFloat(s[1]),t=parseFloat(s[3]),a=parseFloat(s[5]);e%=360,t/=100,a/=100,e=e<0?0:e>360?360:e,t=t<0?0:t>1?1:t,a=a<0?0:a>1?1:a;const l=a*t;let u=e/60;const c=l*(1-Math.abs(u%2-1));let d=[];switch(u=Math.floor(u),u){case 0:d=[l,c,0];break;case 1:d=[c,l,0];break;case 2:d=[0,l,c];break;case 3:d=[0,c,l];break;case 4:d=[c,0,l];break;case 5:d=[l,0,c];break;default:d=[0,0,0]}const f=a-l;n=d[0]+f,r=d[1]+f,i=d[2]+f,n=Math.round(255*n),r=Math.round(255*r),i=Math.round(255*i),o=1}else{const e=a.toLowerCase();if(function(e){return e in be}(e)){const t=be[e];({r:n,g:r,b:i}=t),o="a"in t?t.a:1}else t.invalid=!0}}else"number"==typeof e[0]&&e[0]>=0&&"argb"===e[1]?(o=(4278190080&e[0])>>>24,o/=255,n=(16711680&e[0])>>16,r=(65280&e[0])>>8,i=255&e[0]):"number"==typeof e[0]&&e[0]>=0?(n=(16711680&e[0])>>16,r=(65280&e[0])>>8,i=255&e[0]):t.invalid=!0;else 3===e.length||4===e.length?(n=e[0],r=e[1],i=e[2],o=4===e.length?e[3]:1):t.invalid=!0;var a;return Number.isNaN(+n+r+i+o)&&(t.invalid=!0),t.r=Math.floor(n),t.g=Math.floor(r),t.b=Math.floor(i),t.a=o,t}function Se(e){let t,n,r;if(ye(e))return t=e.r.toString(16),n=e.g.toString(16),r=e.b.toString(16),1===t.length&&(t=`0${t}`),1===n.length&&(n=`0${n}`),1===r.length&&(r=`0${r}`),`#${[t,n,r].join("")}`;const i="string"==typeof e?ve(e):e;return t=((16711680&i)>>16).toString(16),n=((65280&i)>>8).toString(16),r=(255&i).toString(16),1===t.length&&(t=`0${t}`),1===n.length&&(n=`0${n}`),1===r.length&&(r=`0${r}`),`#${t}${n}${r}`}function Me(e){let t,n,r=0;const i="string"==typeof e?qe(e):e,o=i.r/255,a=i.g/255,s=i.b/255,{a:l}=i,u=Math.max(o,a,s),c=Math.min(o,a,s),d=(u+c)/2;if(u===c)t=0,r=0;else{switch(n=u-c,t=d>.5?n/(2-u-c):n/(u+c),u){case o:r=(a-s)/n+(a<s?6:0);break;case a:r=(s-o)/n+2;break;case s:r=(o-a)/n+4}r/=6}return{h:360*r,s:100*t,l:100*d,a:l}}function De(e){let t,n,r=0;const i="string"==typeof e?qe(e):e,o=i.r/255,a=i.g/255,s=i.b/255,l=Math.max(o,a,s),u=Math.min(o,a,s),c=l;if(l===u)t=0,r=0;else{switch(n=l-u,t=0===n?0:n/c,l){case o:r=(a-s)/n+(a<s?6:0);break;case a:r=(s-o)/n+2;break;case s:r=(o-a)/n+4}r/=6}return{h:360*r%360,s:100*t,v:100*c}}function Ce(e){if(ye(e))return`rgb(${e.r}, ${e.g}, ${e.b})`;const t="string"==typeof e?ve(e):e;return`rgb(${(16711680&t)>>16}, ${(65280&t)>>8}, ${255&t})`}function we(e,t){return ye(e)?`rgba(${e.r}, ${e.g}, ${e.b}, ${e.a})`:we(qe(e))}function Ee(e){return ye(e)?1===e.a?Ce(e):we(e):Ee(qe(e))}const Oe=e=>{const t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};function Ae(...e){const t=qe(...e);return t.invalid||function(e){return.2126*Oe(e.r)+.7152*Oe(e.g)+.0722*Oe(e.b)}(t)<.4}function Te(...e){const t=qe(...e),n={type:t.type,r:t.r,g:t.g,b:t.b,a:t.a,invalid:t.invalid,spaces:t.spaces},r=()=>(n.spaces.hslaObject||(n.spaces.hslaObject=Me(n)),n.spaces.hslaObject),i=e=>{const t=r(),{h:n,s:i,l:o,a:a}=t;return`hsla(${n}, ${i}, ${Math.max(0,Math.min(o+e,100))}, ${a})`};return{get type(){return n.type},isInvalid:()=>n.invalid,get r(){return n.r},get g(){return n.g},get b(){return n.b},get a(){return n.a},getR:()=>n.r,getG:()=>n.g,getB:()=>n.b,getAlpha:()=>n.a,setAlpha:e=>{n.a=e,n.spaces={}},isEqualTo:e=>{let t;if("string"==typeof e)t=qe(e);else{if(e.type!==n.type)return!1;t=e}return t.r===n.r&&t.g===n.g&&t.b===n.b&&t.a===n.a},isDark:()=>Ae(n),getRGB:()=>(n.spaces.rgb||(n.spaces.rgb=Ce(n)),n.spaces.rgb),getRGBA:()=>(n.spaces.rgba||(n.spaces.rgba=we(n)),n.spaces.rgba),getString:()=>(n.spaces.string||(n.spaces.string=Ee(n)),n.spaces.string),getHex:()=>(n.spaces.hex||(n.spaces.hex=Se(n)),n.spaces.hex),getHSL:()=>(n.spaces.hsl||(n.spaces.hsl=function(e){let t,n,r=0;const i="string"==typeof e?qe(e):e,o=i.r/255,a=i.g/255,s=i.b/255,l=Math.max(o,a,s),u=Math.min(o,a,s),c=(l+u)/2;if(l===u)t=0,r=0;else{switch(n=l-u,t=c>.5?n/(2-l-u):n/(l+u),l){case o:r=(a-s)/n+(a<s?6:0);break;case a:r=(s-o)/n+2;break;case s:r=(o-a)/n+4}r/=6}return`hsl(${360*r}, ${100*t}, ${100*c})`}(n)),n.spaces.hsl),getHSLA:()=>(n.spaces.hsla||(n.spaces.hsla=function(e){const{h:t,s:n,l:r,a:i}=Me(e);return`hsla(${t}, ${n}, ${r}, ${i})`}(n)),n.spaces.hsla),getHSLAObject:r,getShiftedHSLA:i,getHSV:()=>(n.spaces.hsv||(n.spaces.hsv=function(e){const{h:t,s:n,v:r}=De(e);return`hsv(${t}, ${n}, ${r})`}(n)),n.spaces.hsv),getHSVObject:()=>(n.spaces.hsvObject||(n.spaces.hsvObject=De(n)),n.spaces.hsvObject),blend:(e,t)=>`rgba(${Math.floor(n.r+(e.r-n.r)*t)}, ${Math.floor(n.g+(e.g-n.g)*t)}, ${Math.floor(n.b+(e.b-n.b)*t)}, ${Math.floor(n.a+(e.getAlpha()-n.a)*t)})`,getBrightenedColor:(e=1)=>Te(i(18*e)),getDarkenedColor:(e=1)=>Te(i(18*-e))}}function ke(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Le(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function Ne(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){Le(o,r,i,a,s,"next",e)}function s(e){Le(o,r,i,a,s,"throw",e)}a(void 0)})}}function Ie(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Pe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Re(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Pe(Object(n),!0).forEach(function(t){Ie(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pe(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Fe(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function je(){
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var l=r&&r.prototype instanceof s?r:s,u=Object.create(l.prototype);return ze(u,"_invoke",function(n,r,i){var o,s,l,u=0,c=i||[],d=!1,f={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,a}};function p(n,r){for(s=n,l=r,t=0;!d&&u&&!i&&t<c.length;t++){var i,o=c[t],p=f.p,m=o[2];n>3?(i=m===r)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=p&&((i=n<2&&p<o[1])?(s=0,f.v=r,f.n=o[1]):p<m&&(i=n<3||o[0]>r||r>m)&&(o[4]=n,o[5]=r,f.n=m,s=0))}if(i||n>1)return a;throw d=!0,r}return function(i,c,m){if(u>1)throw TypeError("Generator is already running");for(d&&1===c&&p(c,m),s=c,l=m;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),p(s,l)):f.n=l:f.v=l);try{if(u=2,o){if(s||(i="next"),t=o[i]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(r,f))!==a)break}catch(t){o=e,s=1,l=t}finally{u=1}}return{value:t,done:d}}}(n,i,o),!0),u}var a={};function s(){}function l(){}function u(){}t=Object.getPrototypeOf;var c=[][r]?t(t([][r]())):(ze(t={},r,function(){return this}),t),d=u.prototype=s.prototype=Object.create(c);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,ze(e,i,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=u,ze(d,"constructor",u),ze(u,"constructor",l),l.displayName="GeneratorFunction",ze(u,i,"GeneratorFunction"),ze(d),ze(d,i,"Generator"),ze(d,r,function(){return this}),ze(d,"toString",function(){return"[object Generator]"}),(je=function(){return{w:o,m:f}})()}function ze(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}ze=function(e,t,n,r){function o(t,n){ze(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},ze(e,t,n,r)}function He(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){u=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}(e,t)||_e(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ve(e){return function(e){if(Array.isArray(e))return ke(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_e(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Be(e){return Be="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Be(e)}function _e(e,t){if(e){if("string"==typeof e)return ke(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ke(e,t):void 0}}var Ue="point-label-cross-placement",$e="unclassified",We="equal-equal",Ke="equal-higher",Ge="equal-lower",Ye="equal-void",Xe="higher-equal",Je="higher-higher-acute",Ze="higher-higher-obtuse",Qe="higher-lower-negative",et="higher-lower-positive",tt="higher-void",nt="lower-equal",rt="lower-higher-negative",it="lower-higher-positive",ot="lower-lower-acute",at="lower-lower-obtuse",st="lower-void",lt="void-equal",ut="void-higher",ct="void-lower",dt="void-void";function ft(e,t){return Math.atan2(t.y-e.y,t.x-e.x)*(180/Math.PI)}function pt(e,t,n){var r=Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)),i=Math.sqrt(Math.pow(t.x-n.x,2)+Math.pow(t.y-n.y,2)),o=Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2));return Math.acos((i*i+r*r-o*o)/(2*i*r))*(180/Math.PI)}function mt(e){var t=e.previous,n=e.current,r=e.next,i=t&&t.value,o=n&&n.value,a=r&&r.value;return t||r?t?r?i===o?o===a?We:o<a?Ke:Ge:o===a?i>o?Xe:nt:i>o?o<a?pt(t,n,r)>90?Ze:Je:ft(t,n)>ft(t,r)?et:Qe:o>a?pt(t,n,r)>90?at:ot:ft(t,n)>ft(t,r)?it:rt:i===o?Ye:i>o?tt:st:o===a?lt:o<a?ut:ct:dt}var ht,gt={TOP:"top",TOP_RIGHT:"top-right",RIGHT:"right",BOTTOM_RIGHT:"bottom-right",BOTTOM:"bottom",BOTTOM_LEFT:"bottom-left",LEFT:"left",TOP_LEFT:"top-left"};function yt(e){var t=e.bounds,n=e.size,r=t.x,i=t.y,o=t.width,a=t.height;return"center"===n.insideStrategy?Math.floor(r+o/2)>=0&&Math.ceil(r+o/2)<=n.width&&Math.floor(i+a/2)>=0&&Math.ceil(i+a/2)<=n.height:Math.floor(r+o)>0&&Math.ceil(r)<n.width&&Math.floor(i+a/2)>=0&&Math.ceil(i+a/2)<=n.height}function vt(){ht=ht||document.createElement("canvas").getContext("2d")}var bt,xt={measureTextWidth:function(e){return vt(),ht.measureText(e).width},lineWrap:function(e,t,n,r){var i,o;vt();var a,s,l=e?e.split(/\n+|\r+|\r\n/):[],u=[],c=e?e.split(/\s+/):[],d=l[0];if("number"!=typeof t||t<=0)return[e];if("number"==typeof r&&l.length>=r)return l.slice(0,r);for(n&&(ht.font=n),o=0;o<l.length;o++){for(d=He(c=(l[o]||"").split(/\s+/),1)[0],s="",i=1;i<c.length;i++)if(a="".concat(d," ").concat(c[i]),xt.measureTextWidth(a)>t&&("number"!=typeof r||r>u.length)?(u.push(d),d=c[i]):d=a,"number"==typeof r&&u.length>=r){s=c.slice(i+1).join(" ");break}"number"!=typeof r||u.length<r?u.push(d):u[Math.max(0,u.length-1)]="".concat(u[Math.max(0,u.length-1)]||""," ").concat(d," ").concat(s)}return u},wordWrap:function(e,t,n,r,i){if(vt(),!e||!e.length)return[];n&&(ht.font=n);var o,a,s,l,u=[],c=e.slice();if(c.filter(function(e){return!!e}),"number"!=typeof t||t<0)return e.slice();for(l=0;l<c.length;l++)a=null,(s=c[l])&&(s.length<=1||xt.measureTextWidth(s)<=t?u.push(s):(o=xt.splitWord(s,t,void 0,r-u.length)).length<=1?u.push(o[0]):(a=o.pop(),u=u.concat(o),c[l+1]?xt.measureTextWidth("".concat(a," ").concat(c[l+1]))>t&&u.length+c.length-l<=r?c.splice(l+1,0,a):c[l+1]="".concat(a," ").concat(c[l+1]):c.push(a)));return u.forEach(function(e,t,n){n[t]=e?e.trim():e}),u.length>r?(u=u.splice(0,r))[u.length-1]=xt.truncate(u[u.length-1],t,n,i).text:(s=u[u.length-1])&&s.length>1&&xt.measureTextWidth(s)>t&&(u[u.length-1]=xt.truncate(s,t,n,i).text),u},truncate:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"…";vt();var i,o,a,s=e,l=xt.measureTextWidth("i"),u=Math.ceil(t/l);if(n&&(ht.font=n),e&&t){if(xt.measureTextWidth(s)>t){for(i=Math.min(u,s.length);i>0;i--)if(o=s.substring(0,i-1).trim()+r,xt.measureTextWidth(o)<=t){a=s.substring(i-1),s=o;break}i||(a=s,s="…")}}else a=void 0;return{text:s,rest:a}},isNumber:function(e){return"number"==typeof e&&Number.isFinite(e)},explodeWord:function(e,t,n,r){var i;vt();var o=e,a="",s=[];if(xt.isNumber(n)&&n<=1)return[e];var l=Math.ceil(t/r);for(i=Math.min(e.length,l);i>0&&(o=e.substring(0,i)," "===e.substring(i-1,i)?o=e.substring(0,i-1):o+="-",a=e.substring(i),!(xt.measureTextWidth(o)<=t));i--);return(!i&&!o||xt.measureTextWidth(o)>t)&&(o=e.substring(0,1),a=e.substring(1)),s.push(o),a?(xt.measureTextWidth(a)>t?(a=xt.explodeWord(a,t,n-1,r),s=s.concat(a)):s.push(a),s.filter(function(e){return""!==e.trim()})):s},splitWord:function(e,t,n,r){return vt(),e&&t?(n&&(ht.font=n),xt.explodeWord(e,t,r,Math.max(1,xt.measureTextWidth("i")))):[]},wrapText:function(e,t,n,r,i){var o;return Number.isNaN(t)?[e]:(o=r>1?xt.lineWrap(e,t,n,r):[e],o=xt.wordWrap(o,t,n,r,i))},getFontHeight:function(e){return vt(),e&&(ht.font=e),1.5*xt.measureTextWidth("m")},tokenize:function(e,t,n,r,i,o){var a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1;vt(),t&&(ht.font=t);var s=xt.getFontHeight(),l=a*s,u=[],c=0,d=[];if(o<s)return[];var f=o?Math.max(1,Math.floor(o/l)):r||1;return Array.isArray(r)?(r.forEach(function(e){c+=Number.isNaN(e)||e<=0?0:e}),r.forEach(function(e){u.push(Number.isNaN(e)||e<=0?f-c:e)})):u=[Number.isNaN(r)||r<=0?f:Math.min(f,r)],Array.isArray(e)?e.forEach(function(e,n){d.length<f&&(d=d.concat(xt.wrapText(e,i,t,u[n])))}):d=xt.wrapText(e,i,t,u[0],n),d}};function qt(e){var t,n,r=e.config,i=e.crossPlacements,o=e.node,a=e.line,s=e.groupIndex,l=e.extract,u=e.style,c=e.measureText,d=e.size,f=e.horizontal,p=e.rtl,m=e.meta,h=e.showLabel,g=l.label(o.data);if("string"!=typeof g&&"number"!=typeof g||""===g)return!1;var y=function(){var e,t,n=c({fontFamily:u.fontFamily,fontSize:u.fontSize,text:g});if(null===(e=o.data)||void 0===e||null===(e=e.value)||void 0===e||!e.maxLabelWidth||n.width<=(null===(t=o.data)||void 0===t||null===(t=t.value)||void 0===t?void 0:t.maxLabelWidth))return n;var r="".concat(u.fontSize," ").concat(u.fontFamily),i=xt.tokenize(g,r,"…",3,o.data.value.maxLabelWidth);return n.lines=i.map(function(e){return{text:e,size:c({fontFamily:u.fontFamily,fontSize:u.fontSize,text:e})}}),n.width=Math.max.apply(Math,Ve(n.lines.map(function(e){return e.size.width}))),n.height*=i.length,n}(),v=o.localBounds,b=o.attrs["stroke-width"],x=l.pointValue(o.data),q=!(null===(t=o.data)||void 0===t||null===(t=t.value)||void 0===t||!t.hasBackground),S=q?{X:3,Y:2}:{X:1,Y:0},M=q?{X:2,Y:2}:{X:0,Y:0},D={x:v.x+v.width/2,y:v.y+v.height/2,width:y.width+2*S.X+2*M.X,height:y.height+2*S.Y+2*M.Y},C="".concat(D.x,"-").concat(D.y),w=!f&&!p,E=f?d.height:d.width,O=(f?D.y:D.x)/E,A=(w?1-O:O)<=(E<=200?.25:.1),T=null===(n=o.data)||void 0===n||null===(n=n.value)||void 0===n||null===(n=n.label)||void 0===n?void 0:n.placement,k=Object.keys(gt).map(function(e){return gt[e]}),L={key:C,config:r,node:o,line:a,group:s,value:x,labelMeasurements:y,bounds:D,inside:yt({bounds:v,size:d}),border:b?b/2:0,classification:$e,setClassification:function(e){L.classification=e},preferences:[],setPreferences:function(e){var t;(t=L.preferences).push.apply(t,Ve(e))},fixedPlacement:k.includes(T)?T:void 0,placement:void 0,setPlacement:function(e){L.placement=e,i.setPlacement(e)},duplicate:!1,setDuplicate:function(){L.duplicate=!0},extreme:m.getExtreme(C),elite:A,show:r.labels&&h(o)};return L}var St=(Ie(Ie(Ie(Ie(Ie(Ie(Ie(Ie(Ie(Ie(bt={},We,[gt.TOP,gt.BOTTOM]),Ke,[gt.BOTTOM,gt.BOTTOM_RIGHT]),Ge,[gt.TOP,gt.TOP_RIGHT]),Ye,[gt.TOP,gt.BOTTOM]),Xe,[gt.LEFT,gt.BOTTOM_LEFT,gt.TOP,gt.TOP_RIGHT]),Je,[gt.BOTTOM,gt.BOTTOM_LEFT,gt.LEFT,gt.TOP_RIGHT]),Ze,[gt.BOTTOM,gt.TOP]),Qe,[gt.TOP,gt.TOP_RIGHT,gt.RIGHT]),et,[gt.BOTTOM,gt.BOTTOM_LEFT,gt.LEFT]),tt,[gt.TOP]),Ie(Ie(Ie(Ie(Ie(Ie(Ie(Ie(Ie(Ie(bt,nt,[gt.TOP]),rt,[gt.TOP,gt.TOP_LEFT]),it,[gt.BOTTOM_RIGHT]),ot,[gt.TOP,gt.TOP_LEFT,gt.LEFT,gt.TOP_RIGHT,gt.RIGHT]),at,[gt.TOP,gt.BOTTOM]),st,[gt.TOP]),lt,[gt.TOP]),ut,[gt.TOP,gt.BOTTOM]),ct,[gt.TOP,gt.BOTTOM,gt.LEFT]),dt,[gt.TOP]),Ie(bt,$e,[gt.TOP,gt.BOTTOM,gt.RIGHT,gt.LEFT,gt.TOP_RIGHT,gt.BOTTOM_RIGHT,gt.BOTTOM_LEFT,gt.TOP_LEFT]));function Mt(e){var t=function(e){var t=e.configs,n=e.crossPlacements,r=e.nodes,i=e.extract,o=e.style,a=e.measureText,s=e.size,l=e.horizontal,u=e.rtl,c=e.showLabel,d=function(e){var t={top:[],right:[],bottom:[],left:[]},n=e.nodes.map(function(e){var t=e.localBounds,n={x:t.x+t.width/2,y:t.y+t.height/2};return{key:"".concat(n.x,"-").concat(n.y),center:n}}),r=n.reduce(function(e,t){return(!e.top||t.center.y<e.top.center.y)&&(e.top=t),(!e.right||t.center.x>e.right.center.x)&&(e.right=t),(!e.bottom||t.center.y>e.bottom.center.y)&&(e.bottom=t),(!e.left||t.center.x<e.left.center.x)&&(e.left=t),e},{});return t.top=n.filter(function(e){return e.center.y===r.top.center.y}).map(function(e){return e.key}),t.right=n.filter(function(e){return e.center.x===r.right.center.x}).map(function(e){return e.key}),t.bottom=n.filter(function(e){return e.center.y===r.bottom.center.y}).map(function(e){return e.key}),t.left=n.filter(function(e){return e.center.x===r.left.center.x}).map(function(e){return e.key}),{getExtrema:function(e){return{top:-1!==t.top.indexOf(e),right:-1!==t.right.indexOf(e),bottom:-1!==t.bottom.indexOf(e),left:-1!==t.left.indexOf(e)}},getExtreme:function(e){return[t.top,t.right,t.bottom,t.left].some(function(t){return-1!==t.indexOf(e)})}}}({nodes:r}),f=function(e){var t=e.by,n=e.lineId,r=e.nodes.reduce(function(e,r,i){var o=t(r.data);return e[o]||(e[o]={items:[],index:i}),e[o].items.push({node:r,line:n(r)}),e},{});return Object.keys(r).map(function(e){return r[e]}).sort(function(e,t){return e.index-t.index}).map(function(e){return e.items})}({nodes:r,by:i.majorValue,lineId:i.lineId}).map(function(e,r){return e.map(function(e){return{line:e.line,item:qt({config:t.get(e.node.key),crossPlacements:n,node:e.node,line:e.line,groupIndex:r,extract:i,style:o,measureText:a,size:s,horizontal:l,rtl:u,meta:d,showLabel:c})}}).filter(function(e){return e.item}).reduce(function(e,t){return e[t.line]=t.item,e},{})});return f.filter(function(e){return Object.keys(e).length})}({configs:e.configs,crossPlacements:e.crossPlacements,nodes:e.nodes,extract:e.extract,style:e.style,measureText:e.measureText,size:e.size,horizontal:e.horizontal,rtl:e.rtl,showLabel:e.showLabel}),n=Ve(t.reduce(function(e,t){return e.push.apply(e,Ve(Object.keys(t).map(function(e){return t[e]}))),e},[])),r=He(n,1)[0],i=function(e){for(var t=e.threshold,n=e.groups.map(function(e){return Object.keys(e).map(function(t){return e[t]})}),r={},i=0;i<=n.length;i++){var o=n[i];if(o)for(var a=0;a<o.length;a++){var s=o[a];if(s.config.lines){var l=s.line;r[l]||(r[l]=[]),r[l].push(s.bounds)}}}for(var u=Object.keys(r).map(function(e){return r[e]}),c=[],d=0;d<u.length;d++)for(var f=0;f<u[d].length-1;f++){var p=u[d][f],m=u[d][f+1],h={x1:p.x,y1:p.y,x2:m.x,y2:m.y},g=h.x1-h.x2,y=h.y1-h.y2;Math.sqrt(g*g+y*y)>t&&c.push(h)}return c}({groups:t,threshold:null==r?void 0:r.node.localBounds.height}),o={getItems:function(){return n},getLines:function(){return i}};return function(e){for(var t=e.groups,n=function(e){for(var n=Object.keys(t[e]).map(function(n){return t[e][n]}),r=0;r<n.length;r++){var i=n[r];if(!i.config.fixed){var o=mt({previous:t[e-1]&&t[e-1][i.line],current:i,next:t[e+1]&&t[e+1][i.line]});i.setClassification(o)}}},r=0;r<t.length;r++)n(r)}({groups:t}),o.getItems().forEach(function(e){e.setPreferences(St[e.classification])}),o}function Dt(e){var t=e.item,n=e.placement,r=e.size;return n.x>=0-r.edgeBleed.left&&n.x<=r.width-t.bounds.width+r.edgeBleed.right&&n.y>=0-r.edgeBleed.top&&n.y<=r.height-t.bounds.height}function Ct(e){var t=e.line1,n=e.line2,r=(n.y2-n.y1)*(t.x2-t.x1)-(n.x2-n.x1)*(t.y2-t.y1);if(0===r)return!1;var i=((n.x2-n.x1)*(t.y1-n.y1)-(n.y2-n.y1)*(t.x1-n.x1))/r,o=((t.x2-t.x1)*(t.y1-n.y1)-(t.y2-t.y1)*(t.x1-n.x1))/r;return i>=0&&i<=1&&o>=0&&o<=1}var wt={x:0,width:0,y:0,height:0},Et=function(e){var t=e.item;return{x:t.bounds.x-t.bounds.width/2,y:t.bounds.y-t.bounds.height-t.node.localBounds.height/2-t.border}},Ot=function(e){var t=e.item;return{x:t.bounds.x,y:t.bounds.y-t.bounds.height-t.node.localBounds.height/2-t.border}},At=function(e){var t=e.item;return{x:t.bounds.x+t.node.localBounds.width/2+t.border,y:t.bounds.y-t.bounds.height/2}},Tt=function(e){var t=e.item;return{x:t.bounds.x,y:t.bounds.y+t.node.localBounds.height/2+t.border}},kt=function(e){var t=e.item;return{x:t.bounds.x-t.bounds.width/2,y:t.bounds.y+t.node.localBounds.height/2+t.border}},Lt=function(e){var t=e.item;return{x:t.bounds.x-t.bounds.width,y:t.bounds.y+t.node.localBounds.height/2+t.border}},Nt=function(e){var t=e.item;return{x:t.bounds.x-t.bounds.width-t.node.localBounds.width/2-t.border,y:t.bounds.y-t.bounds.height/2}},It=function(e){var t=e.item;return{x:t.bounds.x-t.bounds.width,y:t.bounds.y-t.bounds.height-t.node.localBounds.height/2-t.border}},Pt=[gt.TOP,gt.TOP_LEFT,gt.TOP_RIGHT],Rt=[gt.BOTTOM,gt.BOTTOM_LEFT,gt.BOTTOM_RIGHT];function Ft(e){var t=e.position,n={x:2.5,width:-5,y:0,height:0},r=Pt.indexOf(t)>-1,i=Rt.indexOf(t)>-1;return r&&(n.y=4,n.height=-4),i&&(n.height=-4),n}function jt(e){var t=e.cx,n=e.cy,r=e.r,i=e.degrees*(Math.PI/180);return{x:Math.round(t+r*Math.sin(i)),y:Math.round(n+r*-Math.cos(i))}}function zt(e){var t=e.coordinates,n=e.degrees,r=e.item,i={x:t.x,y:t.y};return n<=90?i.y-=r.bounds.height:n>180&&n<=270?i.x-=r.bounds.width:n>270&&(i.y-=r.bounds.height,i.x-=r.bounds.width),i}var Ht=void 0;function Vt(e){var t=e.item,n=e.validator,r=e.force,i=void 0!==r&&r,o=Ie(Ie(Ie(Ie(Ie(Ie(Ie(Ie({},gt.TOP,Et),gt.TOP_RIGHT,Ot),gt.RIGHT,At),gt.BOTTOM_RIGHT,Tt),gt.BOTTOM,kt),gt.BOTTOM_LEFT,Lt),gt.LEFT,Nt),gt.TOP_LEFT,It);if(t.fixedPlacement)return o[t.fixedPlacement]({item:t});for(var a=[].concat(Ve(t.preferences),Ve(Object.keys(gt).map(function(e){return gt[e]}).filter(function(e){return-1===t.preferences.indexOf(e)}))),s=[],l=0;l<a.length;l++){var u=a[l],c=o[u]({item:t}),d=Ft({position:u}),f=n({item:t,placement:c,adjustment:d,ignoreLines:i});if(i&&f.inside&&s.push(c),f.valid)return c}var p=function(){return function(e){for(var t=e.item,n=e.validator,r=e.force,i=void 0!==r&&r,o=function(e){return[e.item.node.localBounds.height/2*Math.sqrt(2)]}({item:t}),a=t.bounds.x,s=t.bounds.y,l=0;l<o.length;l++){for(var u=o[l],c=40;c<=180;c+=15){var d=zt({coordinates:jt({cx:a,cy:s,r:u,degrees:c}),degrees:c,item:t});if(n({item:t,placement:d,ignoreLines:i}).valid)return d}for(var f=320;f>180;f-=15){var p=zt({coordinates:jt({cx:a,cy:s,r:u,degrees:f}),degrees:f,item:t});if(n({item:t,placement:p,ignoreLines:i}).valid)return p}}return!1}({item:t,validator:n,force:i})};return i?p()||s[0]||Ht:(t.extreme||t.elite)&&p()||Ht}function Bt(e){var t=e.configs,n=e.crossPlacements,r=e.model,i=e.size,o=e.all,a={},s=r.getItems(),l=[].concat(Ve(s.map(function(e){return{x:e.node.localBounds.x-e.border+1,y:e.node.localBounds.y-e.border+1,height:e.node.localBounds.height+2*e.border-2,width:e.node.localBounds.width+2*e.border-2}})),Ve(n.getPlacements({configs:t}))),u=[],c=r.getLines();s.forEach(function(e){var t=e.node.data;if(!(!e.show||!e.inside||t.null&&t.null.value||t.interpolated&&t.interpolated.value)){var n=e.key;if(!a[n]||e.config.duplicates){a[n]=!0;var r=function(e){var t=e.size,n=e.lines,r=e.placements;return function(e){var i=e.item,o=e.placement,a=e.adjustment,s=void 0===a?wt:a,l=e.ignoreLines,u=void 0!==l&&l,c={inside:Dt({item:i,placement:o,size:t}),collides:!0,valid:!1};return c.inside?(c.collides=function(e){var t=e.candidate,n=e.lines;return!!e.rects.some(function(e){return function(e){var t=e.rect1,n=e.rect2;return!(n.x>t.x+t.width||n.x+n.width<t.x||n.y>t.y+t.height||n.y+n.height<t.y)}({rect1:e,rect2:t})})||n.some(function(e){return function(e){var t=e.line,n=e.rect,r={x:n.x,y:n.y},i={x:n.x+n.width,y:n.y},o={x:n.x+n.width,y:n.y+n.height},a={x:n.x,y:n.y+n.height},s={x1:i.x,y1:i.y,x2:o.x,y2:o.y},l={x1:o.x,y1:o.y,x2:a.x,y2:a.y},u={x1:a.x,y1:a.y,x2:r.x,y2:r.y};return Ct({line1:t,line2:{x1:r.x,y1:r.y,x2:i.x,y2:i.y}})||Ct({line1:t,line2:s})||Ct({line1:t,line2:l})||Ct({line1:t,line2:u})}({line:e,rect:t})})}({candidate:{x:o.x+s.x,y:o.y+s.y,width:i.bounds.width+s.width,height:i.bounds.height+s.height},lines:u?[]:n,rects:r}),c.valid=!c.collides,c):c}}({size:i,lines:c,placements:l}),s=Vt({item:e,validator:r});s?(s.height=e.bounds.height,s.width=e.bounds.width,l.push(s),e.setPlacement(s)):o&&u.push({item:e,validator:r})}else e.setDuplicate()}}),u.forEach(function(e){var t=e.item,n=Vt({item:t,validator:e.validator,force:!0});n&&(n.height=t.bounds.height,n.width=t.bounds.width,l.push(n),t.setPlacement(n))})}var _t={require:["chart","renderer"],defaultSettings:{settings:{orientation:"horizontal",rtl:!1,all:!1,label:function(){},showLabel:function(){return!0},pointValue:function(){},majorValue:function(){},lineId:function(){},enabled:function(){return!0},configs:[],insideStrategy:"edge",labelSpace:{use:function(){return!1},size:10},cache:void 0},style:{fontFamily:'"Source Sans Pro", "Arial", "sans-serif"',fontSize:"12px",fill:"#333"}},created:function(){var e,t,n,r,i,o;this.crossPlacements=(e={cache:this.settings.settings.cache,key:this.settings.key},i=e.key,o={isPrimary:!1},null!=(r=e.cache)&&null!==(t=r.has)&&void 0!==t&&t.call(r,Ue)||(o.isPrimary=!0,null==r||null===(n=r.set)||void 0===n||n.call(r,Ue,{})),{reset:function(){var e,t=null==r||null===(e=r.get)||void 0===e?void 0:e.call(r,Ue);t&&(o.isPrimary&&Object.keys(t).forEach(function(e){return delete t[e]}),t[i]=[])},setPlacement:function(e){var t,n=null==r||null===(t=r.get)||void 0===t?void 0:t.call(r,Ue);n&&n[i].push(e)},getPlacements:function(e){var t,n=e.configs,o=null==r||null===(t=r.get)||void 0===t?void 0:t.call(r,Ue);if(!o)return[];var a=[],s=n.getCollection().filter(function(e){return!e.labels&&!!e.labelKeys.length}).reduce(function(e,t){return e.push.apply(e,Ve(t.labelKeys)),e},[]);return Object.keys(o).forEach(function(e){e!==i&&s.some(function(t){return t===e})&&a.push.apply(a,Ve(o[e]))}),a}})},preferredSize:function(){var e={edgeBleed:{top:0,right:0,left:0}},t=this.settings.settings,n=t.orientation,r=t.rtl,i=t.labelSpace,o=i.use,a=i.size;if(o()){var s="horizontal"===n;e.edgeBleed.top=s?a:0,e.edgeBleed[r?"left":"right"]=s?0:a}return e},render:function(){this.crossPlacements.reset();var e=this.settings.settings;if(!(0,e.enabled)())return[];var t=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).configs,t=void 0===e?[]:e,n={},r=[];return t.forEach(function(e){var t=e.key;n[t]={labels:void 0===e.labels||e.labels,labelKeys:Array.isArray(e.labelKeys)?e.labelKeys:[],lines:void 0===e.lines||e.lines,fixed:void 0!==e.fixed&&e.fixed,duplicates:void 0!==e.duplicates&&e.duplicates},r.push(n[t])}),{meta:{allKeys:t.map(function(e){return e.key})},getCollection:function(){return r},get:function(e){return n[e]},getFirstLabelKey:function(){var e;return null===(e=t.find(function(e){return e.labels}))||void 0===e?void 0:e.key}}}({configs:e.configs}),n=t.getFirstLabelKey();if(!n)return[];if(!this.chart.component(n))return[];var r=this.chart.findShapes("circle, path, rect").filter(function(e){return t.meta.allKeys.includes(e.key)});if(!r.length)return[];var i="horizontal"===e.orientation,o=i?"x":"y";r.sort(function(e,t){return e.localBounds[o]-t.localBounds[o]});var a={label:e.label,pointValue:e.pointValue,majorValue:e.majorValue,lineId:e.lineId},s=this.rect,l={height:s.height,width:s.width,edgeBleed:s.edgeBleed,insideStrategy:e.insideStrategy},u=this.crossPlacements,c=this.style,d=Mt({configs:t,crossPlacements:u,nodes:r,extract:a,style:c,measureText:this.renderer.measureText,size:l,horizontal:i,rtl:e.rtl,showLabel:e.showLabel});({model:d}).model.getItems().sort(function(e,t){return e.extreme===t.extreme?0:e.extreme&&!t.extreme?-1:1}),Bt({configs:t,crossPlacements:u,model:d,size:l,all:e.all});var f=d.getItems(),p=[];f.filter(function(e){return e.placement}).forEach(function(e){var t,n,r,i,o,s=null!==(t=e.node.data.value)&&void 0!==t&&t.hasBackground?2:0,l=null!==(n=e.node.data.value)&&void 0!==n&&n.hasBackground?2:0,u=(null===(r=e.node.data.value)||void 0===r||null===(r=r.style)||void 0===r||null===(r=r.label)||void 0===r?void 0:r.fontSize)||c.fontSize,d=(null===(i=e.node.data.value)||void 0===i||null===(i=i.style)||void 0===i||null===(i=i.label)||void 0===i?void 0:i.fontFamily)||c.fontFamily,f=(null===(o=e.node.data.value)||void 0===o?void 0:o.labelColor)||c.fill;e.labelMeasurements.lines?e.labelMeasurements.lines.forEach(function(t,n){p.push({type:"text",x:e.placement.x+e.placement.width/2,y:e.placement.y+(n+.5)*t.size.height+s+l,fontSize:u,fontFamily:d,fill:f,text:t.text,data:e.node.data.value,baseline:"central",anchor:"middle"})}):p.push({type:"text",x:e.placement.x+e.placement.width/2,y:e.placement.y+e.labelMeasurements.height/2+s+l,fontSize:u,fontFamily:d,fill:f,text:a.label(e.node.data),data:e.node.data.value,baseline:"central",anchor:"middle"})});var m=f.filter(function(e){var t;return e.placement&&(null===(t=e.node.data.value)||void 0===t?void 0:t.hasBackground)}).map(function(e){var t;return{type:"rect",x:e.placement.x+2,y:e.placement.y+2,rx:3,ry:3,fill:null===(t=e.node.data.value)||void 0===t?void 0:t.labelBackgroundColor,width:e.placement.width-4,height:e.placement.height-4,data:e.node.data.value}});return[].concat(Ve(m),p)}},Ut={ACTIONS:{select:{enabled:function(){return!1}}},COMPONENT_KEY:"area-range-component",COMPONENTS:[],DOCK:"bottom",ENABLE:function(){return!0},EVENT_KEY:"area-range",EVENTS:function(){},FILL_TARGETS:[],TARGETS:[]},$t={area:"area",continuous:"range"};function Wt(e){var t=e.config,n=e.type,r=void 0===n?"continuous":n,i=t.actions,o=t.componentKey,a=t.enable,s=t.eventKey,l=t.events,u=t.fillTargets;return{key:"event:".concat(o),type:"Pan",requireFailure:void 0,recognizeWith:void 0,options:{event:s,enable:function(e,t){if(!a())return!1;if(this.started===s||!t)return!0;if(!i.select.enabled())return!1;var n=this.chart.componentsFromPoint({x:t.center.x,y:t.center.y}).filter(function(e){return-1!==u.indexOf(e.key)}),r=0===n.length&&function(e,t){var n=e.srcEvent.target;return!(!n||0!==(n.getAttribute("data-key")||"").indexOf("".concat(t,"-")))}(t,o);return r?(this.started=s,!0):n.length>0}},events:Ie(Ie(Ie({},"".concat(s,"start"),function(e){void 0===this.chart.brushSelectionIncludeMax&&(this.chart.brushSelectionIncludeMax=!0,i.select.brushSelectionIncludeMax=!0),e.preventDefault(),i.select.emit("start",s),this.chart.component(o).emit("".concat($t[r],"Start"),e),this.started=s,l.onRangeStart({chart:this.chart})}),"".concat(s,"move"),function(e){e.preventDefault(),this.chart.component(o).emit("".concat($t[r],"Move"),e),l.onRangeMove({chart:this.chart})}),"".concat(s,"end"),function(e){void 0===this.chart.brushSelectionIncludeMax&&(this.chart.brushSelectionIncludeMax=!0,i.select.brushSelectionIncludeMax=!0),e.preventDefault(),this.chart.component(o).emit("".concat($t[r],"End"),e),i.select.emit("end",s),this.started=!1,l.onRangeEnd({chart:this.chart})})}}function Kt(e){return Wt({config:e,type:"continuous"})}var Gt={ACTIONS:{select:{enabled:function(){return!1}}},BUBBLES_PLACEMENT:"inside",COMPONENT_KEY:"continuous-range-component",DOCK:"bottom",ENABLE:function(){return!0},EVENT_KEY:"continuous-range",EVENTS:function(){},FILL_TARGETS:[],MULTIPLE:!1,OBSERVE_BRUSH:!1,SCALE:"scale",TARGETS:[]};function Yt(e){var t=e.actions,n=e.componentKey,r=e.eventKey;if(!e.onEdited)return!1;var i="".concat(n,"-").concat(r,"-tap");return{prio:1,key:"event:".concat(n,"-tap"),type:"Tap",requireFailure:void 0,recognizeWith:void 0,options:{event:i,interval:10,pointers:1,enable:function(e,r){var i,o;return!(!r||!t.select.enabled()||"INPUT"!==(null===(i=r.target)||void 0===i?void 0:i.nodeName)&&(null===(o=r.target)||void 0===o||!o.hasAttribute("data-other-value")||(r.target.getAttribute("data-key")||"").split("-bubble")[0]!==n))}},events:Ie({},i,function(e){(e.target.getAttribute("data-key")||"").split("-bubble")[0]&&(e.preventDefault(),this.chart.component(n).emit("bubbleStart",e))})}}function Xt(e){var t=function(){var e,t,n,r,i,o,a,s,l,u,c,d,f,p,m,h,g,y=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{actions:null!==(e=y.actions)&&void 0!==e?e:Gt.ACTIONS,bubblesPlacement:null!==(t=y.bubblesPlacement)&&void 0!==t?t:Gt.BUBBLES_PLACEMENT,componentKey:null!==(n=y.componentKey)&&void 0!==n?n:Gt.COMPONENT_KEY,dock:null!==(r=y.dock)&&void 0!==r?r:Gt.DOCK,enable:null!==(i=y.enable)&&void 0!==i?i:Gt.ENABLE,eventKey:null!==(o=y.eventKey)&&void 0!==o?o:Gt.EVENT_KEY,events:{onRangeStart:null!==(a=null===(s=y.events)||void 0===s?void 0:s.onRangeStart)&&void 0!==a?a:Gt.EVENTS,onRangeMove:null!==(l=null===(u=y.events)||void 0===u?void 0:u.onRangeMove)&&void 0!==l?l:Gt.EVENTS,onRangeEnd:null!==(c=null===(d=y.events)||void 0===d?void 0:d.onRangeEnd)&&void 0!==c?c:Gt.EVENTS},fillTargets:null!==(f=y.fillTargets)&&void 0!==f?f:Gt.FILL_TARGETS,multiple:null!==(p=y.multiple)&&void 0!==p?p:Gt.MULTIPLE,observeBrush:null!==(m=y.observeBrush)&&void 0!==m?m:Gt.OBSERVE_BRUSH,onEdited:y.onEdited,scale:null!==(h=y.scale)&&void 0!==h?h:Gt.SCALE,targetFillSelector:y.targetFillSelector,targetSelector:y.targetSelector,targets:null!==(g=y.targets)&&void 0!==g?g:Gt.TARGETS,toLabel:y.toLabel}}(e),n=[Kt(t),Yt(t)].filter(Boolean),r=function(e){var t=e.bubblesPlacement,n=e.componentKey,r=e.dock,i=e.fillTargets,o=e.multiple,a=e.observeBrush,s=e.onEdited,l=e.scale,u=e.targetFillSelector,c=e.targets,d=e.targetSelector,f=e.toLabel;return{key:n,type:"brush-range",layout:{dock:c.map(function(e){return"@".concat(e)}).join(",")},on:s?{bubbleEnd:function(){s()}}:{},settings:{brush:a?{context:"selection",observe:!0}:"selection",scale:l,multiple:o,direction:"left"===r||"right"===r?"vertical":"horizontal",bubbles:{align:"left"===r||"top"===r?"end":"start",placement:t,label:f},target:{components:i,selector:d,fillSelector:u,fill:"rgba(82,204,82,0.2)"}}}}(t);return{interactions:n,components:[r]}}var Jt={ACTIONS:{lasso:{enabled:function(){return!1},active:function(){return!1}},select:{enabled:function(){return!1}}},COMPONENT_KEY:"lasso",COMPONENTS:[],EVENTS:function(){},TARGET_KEYS:[]},Zt="lasso";var Qt={ACTIONS:{select:{enabled:function(){return!1}}},COMPONENTS:[],EVENTS:function(){},HIT_RADIUS:0,IS_LOCKED:function(){return!1},TARGETS:[]},en="tap";function tn(e){var t=e.actions,n=e.components,r=e.events,i=e.hitRadius,o=e.isLocked,a=e.shapesAt,s=e.targets,l={targetComponents:[]};return{key:"event:tap",type:"Tap",requireFailure:void 0,recognizeWith:void 0,options:{event:en,interval:10,pointers:1,enable:function(e,n){return!n||!!t.select.enabled()&&(l.targetComponents=this.chart.componentsFromPoint({x:n.center.x,y:n.