@nebula.js/sn-funnel-chart 1.4.1 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@
3
3
  "info": {
4
4
  "name": "@nebula.js/sn-funnel-chart:plugins",
5
5
  "description": "Funnel chart plugins API definitions",
6
- "version": "1.4.1",
6
+ "version": "1.4.2",
7
7
  "license": "MIT",
8
8
  "stability": "experimental",
9
9
  "x-qlik-visibility": "public"
@@ -3,7 +3,7 @@
3
3
  "info": {
4
4
  "name": "@nebula.js/sn-funnel-chart:properties",
5
5
  "description": "Funnel chart generic object definition",
6
- "version": "1.4.1",
6
+ "version": "1.4.2",
7
7
  "license": "MIT",
8
8
  "stability": "stable",
9
9
  "x-qlik-visibility": "public"
package/core/esm/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  /*
2
- * @nebula.js/sn-funnel-chart v1.4.1
2
+ * @nebula.js/sn-funnel-chart v1.4.2
3
3
  * Copyright (c) 2022 QlikTech International AB
4
4
  * Released under the MIT license.
5
5
  */
6
6
 
7
- import e from"picasso.js";import t from"picasso-plugin-q";import{useElement as n,useSelections as r,useModel as o,useApp as i,useTranslator as a,useOptions as l,useState as u,useEffect as s,useStaleLayout as c,useTheme as f,useConstraints as d,useRect as p,usePlugins as h,useAppLayout as m,usePromise as v,onTakeSnapshot as g}from"@nebula.js/stardust";const y={fill:"steelblue",num:1},b=(e,t,n)=>{let r=0,o=0,i=0,a={},l=0;if("labelCenter"===e)r=t.bottomLeft.x,o=t.topRight.y,i=t.bottomRight.x-t.bottomLeft.x,l=t.bottomRight.y-t.topRight.y,a={share:n.share,fill:n.fill};else{const e=180/Math.PI*Math.atan((t.bottomRight.y-t.topRight.y)/(t.topRight.x-t.bottomRight.x));r=e<15&&e>=0?t.topRight.x:e>-15&&e<0?t.bottomRight.x:e<-15?(t.bottomRight.x-t.topRight.x)/2+t.topRight.x+15:(t.topRight.x-t.bottomRight.x)/2+t.bottomRight.x+15,o=t.topRight.y,i=t.width-r,l=t.bottomRight.y-t.topRight.y,a={fill:n.fill}}return{tag:e,type:"rect",x:r,y:o,width:i,height:l,data:n.data,desc:a,fill:"none"}},x=(e,t)=>{const n=(e=>{const t=(e=>{let t=0;return e.forEach((e=>{e.num>t&&(t=e.num)})),t})(e);let n=0;return e.slice().reverse().map((e=>{const r={datum:e,s:n/t,e:e.num/t};return n=e.num,r})).reverse()})(e),r=.9*t.width,o=.9*t.height,i=(t.width-r)/2,a=(t.height-o)/2,l=r-(r>150&&o>150?100:0),u=(o-1*(n.length-1))/n.length,s=[];return n.forEach(((e,r)=>{const o=(c=e.e,f=r<n.length-1?e.s:e.e,[.5-.5*c,.5+.5*c,.5+.5*f,.5-.5*f]).map((e=>Math.round(e*l+i)));var c,f;const d=u*r+1*r+a,p={bottomRight:{x:o[2],y:Math.round(d+u)},bottomLeft:{x:o[3],y:Math.round(d+u)},topRight:{x:o[1],y:Math.round(d)},topLeft:{x:o[0],y:Math.round(d)},width:t.width},h=`M${p.topLeft.x},${p.topLeft.y} L${p.topRight.x},${p.topRight.y} ${p.bottomRight.x},${p.bottomRight.y} ${p.bottomLeft.x},${p.bottomLeft.y}Z`;s.push({tag:"section",type:"path",d:h,data:e.datum.data,fill:e.datum.fill});const m={share:e.e,fill:e.datum.fill,data:e.datum.data};u>12&&(p.bottomRight.x-p.bottomLeft.x>32&&s.push(b("labelCenter",p,m)),s.push(b("labelLeft",p,m)))})),s},q=(e,t,n,r)=>(r-e)/r*(t-n)+n,D=(e,t,n)=>{const r=e.filter((e=>"NaN"!==e.num&&e.num>0)),o=r.length,i=.9*n.width,a=.9*n.height,l=Math.round((n.width-i)/2),u=Math.round((n.height-a)/2),s=i-(i>150&&a>150?100:0),c=a-1*(o-1),f=[],d=r[0].data.num.value;let p=u;return r.forEach(((e,r)=>{const o=t[r]*c,i=Math.round(q(p-u,s,.2*s,a)/2),h=Math.round(q(p-u+o,s,.2*s,a)/2),m=l+Math.round(s/2),v={bottomRight:{x:m+h,y:Math.round(p+o)},bottomLeft:{x:m-h,y:Math.round(p+o)},topRight:{x:m+i,y:p},topLeft:{x:m-i,y:p},width:n.width},g=`M${v.topLeft.x},${v.topLeft.y} L${v.topRight.x},${v.topRight.y} ${v.bottomRight.x},${v.bottomRight.y} ${v.bottomLeft.x},${v.bottomLeft.y}Z`;f.push({tag:"section",type:"path",d:g,data:e.data,fill:e.fill});const y={share:e.data.num.value/d,fill:e.fill,data:e.data};o>2&&(v.bottomRight.x-v.bottomLeft.x>32&&f.push(b("labelCenter",v,y)),f.push(b("labelLeft",v,y))),p+=o+1})),f},w=(e,t,n)=>{const r=e.filter((e=>"NaN"!==e.num&&e.num>0));if(r&&r.length>0)switch(t){case"WIDTH":return x(r,n);case"ORDER":return D(r,r.map((()=>1/r.length)),n);case"HEIGHT":return D(r,(e=>{const t=e.reduce(((e,t)=>e+t.data.num.value),0);return e.map((e=>e.data.num.value/t))})(r),n);case"AREA":return D(r,((e,t,n)=>{const r=e.reduce(((e,t)=>e+t.data.num.value),0),o=.9*t.width,i=.9*t.height,a=o*n,l=i*(o+a)/2,u=(o-a)/2/i,s=[];let c=0;for(let t=e.length-1;t>=0;t--){const n=e[t].data.num.value/r,o=2*u*c+a,f=-o/(2*u)+Math.sqrt(o*o/(4*u*u)+n*l/u);s[t]=f/i,c+=f}return s})(r,n,.2),n);default:return x(r,n)}return[]};var M={require:["resolver"],defaultSettings:{settings:{},data:{},style:{item:"$shape"}},render({data:e}){const t=this.resolver.resolve({data:e,defaults:{...y,...this.style.item},settings:this.settings.settings});return w(t.items,this.settings.settings.mode,this.rect)}};const C={version:"1.4.1",color:{auto:!0,autoMinMax:!0,byDimDef:void 0,byMeasureDef:void 0,colorExpression:void 0,dimensionScheme:"12",expressionIsColor:!0,expressionLabel:"",measureMin:void 0,measureMax:void 0,measureScheme:"sg",mode:"primary",paletteColor:{index:6},persistent:!1,reverseScheme:!1,singleColor:void 0,useBaseColors:"off",useDimColVal:!0,useMeasureGradient:!0},dataPoint:{auto:!0,labelMode:"share"},footnote:"",funnel:{mode:"WIDTH"},qHyperCubeDef:{qDimensions:[],qMeasures:[],qInterColumnSortOrder:[],qInitialDataFetch:[{qWidth:2,qHeight:5e3}],qSuppressMissing:!0,qSuppressZero:!1},showDimensionTitle:!0,showTitles:!0,subtitle:"",title:""};var I={definition:{type:"items",component:"accordion",items:{data:{uses:"data",items:{dimensions:{uses:"dimensions",items:{others:{items:{suppressOther:{defaultValue:!0,show:!1}}}},disabledRef:""},measures:{uses:"measures",disabledRef:""}}},sorting:{uses:"sorting"},settings:{uses:"settings",items:{presentation:{type:"items",label:"Presentation",grouped:!0,items:{funnelmode:{ref:"funnel.mode",label:"Funnel Mode",type:"string",component:"dropdown",options:[{value:"AREA",label:"Area"},{value:"HEIGHT",label:"Height"},{value:"WIDTH",label:"Width"},{value:"ORDER",label:"Ordering"}],defaultValue:"WIDTH"},dimensionTitle:{ref:"showDimensionTitle",type:"boolean",component:"switch",label:"Dimension label",defaultValue:!0,options:[{value:!0,label:"Auto"},{value:!1,label:"Off"}]},valuesAuto:{ref:"dataPoint.auto",type:"boolean",label:"Value labels",component:"switch",defaultValue:!0,options:[{value:!0,label:"Auto"},{value:!1,label:"Custom"}]},labelMode:{ref:"dataPoint.labelMode",type:"string",component:"dropdown",options:[{value:"none",label:"None"},{value:"share",label:"Share"},{value:"value",label:"Values"}],defaultValue:"share",show:e=>!e.dataPoint.auto}}},colorsAndLegend:{uses:"colorsAndLegend",translation:"Colors",items:{colors:{items:{colorByLabel:{show:!1},expressionLabel:{show:!1}}},legend:{show:!1}}}}}}},support:{export:!0,exportData:!0,snapshot:!0,viewData:!1},importProperties:null,exportProperties:null};const k=[{path:"/qHyperCubeDef",dimensions:{min:1,max:1,description:()=>"Segments"},measures:{min:1,max:1,description(e){switch(e.funnel.mode){case"WIDTH":return"Width";case"AREA":return"Area";case"HEIGHT":return"Height";case"ORDER":return"Order";default:return""}},added(e,t){2===t.qHyperCubeDef.qInterColumnSortOrder.length&&1!==t.qHyperCubeDef.qInterColumnSortOrder[0]&&(t.qHyperCubeDef.qInterColumnSortOrder=[1,0])}}}];function S(e){return(S="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})(e)}function A(e,t,n,r,o,i,a){try{var l=e[i](a),u=l.value}catch(e){return void n(e)}l.done?t(u):Promise.resolve(u).then(r,o)}function O(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){A(i,r,o,a,l,"next",e)}function l(e){A(i,r,o,a,l,"throw",e)}a(void 0)}))}}function N(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function E(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 P(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?E(Object(n),!0).forEach((function(t){N(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):E(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function T(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function j(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,i=void 0;try{for(var a,l=e[Symbol.iterator]();!(r=(a=l.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==l.return||l.return()}finally{if(o)throw i}}return n}}(e,t)||R(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 L(e){return function(e){if(Array.isArray(e))return F(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||R(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 R(e,t){if(e){if("string"==typeof e)return F(e,t);var n=Object.prototype.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)?F(e,t):void 0}}function F(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var H=Object.prototype.hasOwnProperty,V=Object.prototype.toString,_=Object.defineProperty,z=Object.getOwnPropertyDescriptor,B=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===V.call(e)},U=function(e){if(!e||"[object Object]"!==V.call(e))return!1;var t,n=H.call(e,"constructor"),r=e.constructor&&e.constructor.prototype&&H.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!r)return!1;for(t in e);return void 0===t||H.call(e,t)},$=function(e,t){_&&"__proto__"===t.name?_(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},K=function(e,t){if("__proto__"===t){if(!H.call(e,t))return;if(z)return z(e,t).value}return e[t]},W=function e(){var t,n,r,o,i,a,l=arguments[0],u=1,s=arguments.length,c=!1;for("boolean"==typeof l&&(c=l,l=arguments[1]||{},u=2),(null==l||"object"!=typeof l&&"function"!=typeof l)&&(l={});u<s;++u)if(null!=(t=arguments[u]))for(n in t)r=K(l,n),l!==(o=K(t,n))&&(c&&o&&(U(o)||(i=B(o)))?(i?(i=!1,a=r&&B(r)?r:[]):a=r&&U(r)?r:{},$(l,{name:n,newValue:e(c,a,o)})):void 0!==o&&$(l,{name:n,newValue:o}));return l};function Y(e,t){return{range:function(e){var n=e.resources,r=e.data,o=n.theme.palette("categorical",0===t?r.items.length:t);return r.items.map((function(e){return o[e.value%o.length]}))},valueAccessor:e.value}}function G(e,t){return{range:function(e){var n=e.resources,r=e.data,o=n.theme.palette("categorical",0===t?r.items.length:t);return r.items.map((function(e){return o[e.row.value%o.length]}))},valueAccessor:e.value}}function Z(e,t,n,r,o){var i,a=o.byRow,l=o.byElemNo;if(r&&(t.input.persistent||e.hc.qDimensionInfo.length>1||void 0===n.activeDimensionIndex&&e.hc.qSize.qcy>((null===(i=e.hc.qDataPages[0])||void 0===i?void 0:i.qArea.qHeight)||0)))return l(r,r.raw().qCardinal);if(r){var u=t.pic.extract({field:r.key(),trackBy:r.value}).length;return a(r,u)}return{}}function J(e,t){var n=e.hc.qDimensionInfo,r=t.input.byDimDef||{activeDimensionIndex:n.length-1};if(r.activeDimensionIndex>=0){var o=n[r.activeDimensionIndex];r=o.coloring&&o.coloring.colorMapRef?{type:"libraryItem",key:o.coloring.colorMapRef,activeDimensionIndex:r.activeDimensionIndex}:{activeDimensionIndex:r.activeDimensionIndex}}return r}function Q(e,t){var n;return t.activeDimensionIndex>=0?n=e.pic.fields().filter((function(e){return"dimension"===e.type()}))[t.activeDimensionIndex]:"libraryItem"===t.type?!1===(n=t.key?e.pic.field((function(e){return e.raw().colorMapRef===t.key})):void 0)&&(n=e.pic.field((function(e){return"colorByAlternative"===e.raw().id}))):"expression"===t.type&&(n=e.pic.field((function(e){return"colorByAlternative"===e.raw().id}))),n}function X(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function ee(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function te(){}var ne=1/.7,re="\\s*([+-]?\\d+)\\s*",oe="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",ie="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ae=/^#([0-9a-f]{3,8})$/,le=new RegExp("^rgb\\("+[re,re,re]+"\\)$"),ue=new RegExp("^rgb\\("+[ie,ie,ie]+"\\)$"),se=new RegExp("^rgba\\("+[re,re,re,oe]+"\\)$"),ce=new RegExp("^rgba\\("+[ie,ie,ie,oe]+"\\)$"),fe=new RegExp("^hsl\\("+[oe,ie,ie]+"\\)$"),de=new RegExp("^hsla\\("+[oe,ie,ie,oe]+"\\)$"),pe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function he(){return this.rgb().formatHex()}function me(){return this.rgb().formatRgb()}function ve(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=ae.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?ge(t):3===n?new qe(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?ye(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?ye(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=le.exec(e))?new qe(t[1],t[2],t[3],1):(t=ue.exec(e))?new qe(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=se.exec(e))?ye(t[1],t[2],t[3],t[4]):(t=ce.exec(e))?ye(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=fe.exec(e))?Ce(t[1],t[2]/100,t[3]/100,1):(t=de.exec(e))?Ce(t[1],t[2]/100,t[3]/100,t[4]):pe.hasOwnProperty(e)?ge(pe[e]):"transparent"===e?new qe(NaN,NaN,NaN,0):null}function ge(e){return new qe(e>>16&255,e>>8&255,255&e,1)}function ye(e,t,n,r){return r<=0&&(e=t=n=NaN),new qe(e,t,n,r)}function be(e){return e instanceof te||(e=ve(e)),e?new qe((e=e.rgb()).r,e.g,e.b,e.opacity):new qe}function xe(e,t,n,r){return 1===arguments.length?be(e):new qe(e,t,n,null==r?1:r)}function qe(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function De(){return"#"+Me(this.r)+Me(this.g)+Me(this.b)}function we(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===e?")":", "+e+")")}function Me(e){return((e=Math.max(0,Math.min(255,Math.round(e)||0)))<16?"0":"")+e.toString(16)}function Ce(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ke(e,t,n,r)}function Ie(e){if(e instanceof ke)return new ke(e.h,e.s,e.l,e.opacity);if(e instanceof te||(e=ve(e)),!e)return new ke;if(e instanceof ke)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),i=Math.max(t,n,r),a=NaN,l=i-o,u=(i+o)/2;return l?(a=t===i?(n-r)/l+6*(n<r):n===i?(r-t)/l+2:(t-n)/l+4,l/=u<.5?i+o:2-i-o,a*=60):l=u>0&&u<1?0:a,new ke(a,l,u,e.opacity)}function ke(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function Se(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}X(te,ve,{copy:function(e){return Object.assign(new this.constructor,this,e)},displayable:function(){return this.rgb().displayable()},hex:he,formatHex:he,formatHsl:function(){return Ie(this).formatHsl()},formatRgb:me,toString:me}),X(qe,xe,ee(te,{brighter:function(e){return e=null==e?ne:Math.pow(ne,e),new qe(this.r*e,this.g*e,this.b*e,this.opacity)},darker:function(e){return e=null==e?.7:Math.pow(.7,e),new qe(this.r*e,this.g*e,this.b*e,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:De,formatHex:De,formatRgb:we,toString:we})),X(ke,(function(e,t,n,r){return 1===arguments.length?Ie(e):new ke(e,t,n,null==r?1:r)}),ee(te,{brighter:function(e){return e=null==e?ne:Math.pow(ne,e),new ke(this.h,this.s,this.l*e,this.opacity)},darker:function(e){return e=null==e?.7:Math.pow(.7,e),new ke(this.h,this.s,this.l*e,this.opacity)},rgb:function(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,o=2*n-r;return new qe(Se(e>=240?e-240:e+120,o,r),Se(e,o,r),Se(e<120?e+240:e-120,o,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===e?")":", "+e+")")}}));var Ae=Math.PI/180,Oe=180/Math.PI,Ne=4/29,Ee=6/29,Pe=3*Ee*Ee;function Te(e){if(e instanceof je)return new je(e.l,e.a,e.b,e.opacity);if(e instanceof _e)return ze(e);e instanceof qe||(e=be(e));var t,n,r=He(e.r),o=He(e.g),i=He(e.b),a=Le((.2225045*r+.7168786*o+.0606169*i)/1);return r===o&&o===i?t=n=a:(t=Le((.4360747*r+.3850649*o+.1430804*i)/.96422),n=Le((.0139322*r+.0971045*o+.7141733*i)/.82521)),new je(116*a-16,500*(t-a),200*(a-n),e.opacity)}function je(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}function Le(e){return e>.008856451679035631?Math.pow(e,1/3):e/Pe+Ne}function Re(e){return e>Ee?e*e*e:Pe*(e-Ne)}function Fe(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function He(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Ve(e){if(e instanceof _e)return new _e(e.h,e.c,e.l,e.opacity);if(e instanceof je||(e=Te(e)),0===e.a&&0===e.b)return new _e(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*Oe;return new _e(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function _e(e,t,n,r){this.h=+e,this.c=+t,this.l=+n,this.opacity=+r}function ze(e){if(isNaN(e.h))return new je(e.l,0,0,e.opacity);var t=e.h*Ae;return new je(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}function Be(e){return function(){return e}}function Ue(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):Be(isNaN(e)?t:e)}X(je,(function(e,t,n,r){return 1===arguments.length?Te(e):new je(e,t,n,null==r?1:r)}),ee(te,{brighter:function(e){return new je(this.l+18*(null==e?1:e),this.a,this.b,this.opacity)},darker:function(e){return new je(this.l-18*(null==e?1:e),this.a,this.b,this.opacity)},rgb:function(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,n=isNaN(this.b)?e:e-this.b/200;return new qe(Fe(3.1338561*(t=.96422*Re(t))-1.6168667*(e=1*Re(e))-.4906146*(n=.82521*Re(n))),Fe(-.9787684*t+1.9161415*e+.033454*n),Fe(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}})),X(_e,(function(e,t,n,r){return 1===arguments.length?Ve(e):new _e(e,t,n,null==r?1:r)}),ee(te,{brighter:function(e){return new _e(this.h,this.c,this.l+18*(null==e?1:e),this.opacity)},darker:function(e){return new _e(this.h,this.c,this.l-18*(null==e?1:e),this.opacity)},rgb:function(){return ze(this).rgb()}}));var $e=function e(t){var n=function(e){return 1==(e=+e)?Ue:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}(t,n,e):Be(isNaN(t)?n:t)}}(t);function r(e,t){var r=n((e=xe(e)).r,(t=xe(t)).r),o=n(e.g,t.g),i=n(e.b,t.b),a=Ue(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=o(t),e.b=i(t),e.opacity=a(t),e+""}}return r.gamma=e,r}(1),Ke=/^class(-pyramid)?/,We=function(e,t,n,r){var o=void 0!==n.min?n.min:r.min(),i=void 0!==n.max?n.max:r.max(),a=o,l=i,u=t.limits,s={},c="percent"===t.limitType?u.map((function(e){return o+(i-o)*e})):u,f=t.colors.map((function(t){return e.resolveUIColor(t)}));if(o=Math.min.apply(Math,[o].concat(L(c))),i=Math.max.apply(Math,[i].concat(L(c))),s.min=o,s.max=i,t.breakTypes&&-1===t.breakTypes.indexOf(!0))s.type="categorical",Object.assign(s,function(e){var t=e.min,n=e.max,r=e.limits,o=e.range,i=[],a=[];if(r.length)if(r[r.length-1]<t)a.push(t,n),i.push(o[o.length-1],o[o.length-1],o[o.length-1]);else if(r[0]>n)a.push(t,n),i.push(o[0],o[0],o[0]);else{if(r[0]>t)a.push(t),i.push(o[0]);else{a.push(t);for(var l=0;l<r.length;l++)if(t<r[l]){i.push(o[l]);break}}for(var u=0;u<r.length;u++)t<r[u]&&r[u]<n&&(a.push(r[u]),i.push(o[u]));if(r[r.length-1]<n)a.push(n),i.push(o[r.length]),i.push(o[r.length]);else{a.push(n);for(var s=0;s<r.length;s++)if(r[s]>n){i.push(o[s]),i.push(o[s]);break}}}else i.push(o[0]);return{min:t,max:n,range:i,domain:a}}({min:"percent"===t.limitType?o:a,max:"percent"===t.limitType?i:l,range:f,limits:"percent"===t.limitType?c:u}));else if(t.breakTypes){var d=t.breakTypes;s.type="continuous",s.domain=[o],s.range=[f[0]];for(var p=0;p<c.length;p+=1)if(d[p]){var h=f[p],m=f[p+1],v=$e(h,m)(.5);s.range.push(v),s.domain.push(c[p]),p<c.length-1&&d[p+1]&&(s.range.push(f[p+1]),s.domain.push((c[p]+c[p+1])/2))}else s.range.push(f[p]),s.range.push(f[p+1]),s.domain.push(c[p]),s.domain.push(c[p]+Math.min(1e-6,(i-o)/1e6));s.range.push(f[f.length-1]),s.domain.push(i)}else s.domain=c,s.range=f;return s};function Ye(e,t,n,r,o){var i,a,l,u=0,s=[],c=(e-t)/(r+1);if(0===c)return 1;for(i=0;i<n.length;i+=1)a=.99*(n[i]-t),l=n[i]>e?Math.floor(e/c):n[i]<t?0:Math.floor(a/c),Number.isNaN(l)||(s[l]?s[l]+=1:s[l]=1);for(i=0;i<s.length;i+=1)s[i]&&(u+=1);return u<=r||u>=o?Math.max(u,r):Ye(e,t,n,r+1,o)}var Ge=function(e,t,n,r){var o,i,a=t.theme,l=t.hc,u=r.f,s={mode:"field",fieldType:"measure",field:u?u.key():void 0,reverse:n.input.reverseScheme||!1,type:"continuous",range:function(e){return e.resources.theme.palette("quant")}},c=[],f=!0;if(u){if(Number.isNaN(+u.min())||Number.isNaN(+u.max()))return{invalid:!0};(f=!("S"===(o=n.pic.raw()).qMode&&(o.qDataPages[0]&&o.qSize.qcy>o.qDataPages[0].qArea.qHeight||!o.qDataPages.length&&o.qSize.qcy>0)||"K"===o.qMode&&o.qStackedDataPages[0]&&o.qSize.qcy>o.qStackedDataPages[0].qArea.qHeight||"T"===o.qMode&&o.qSize.qcy>o.qTreeDataPages[0].qGroupSize))&&(c=n.pic.extract({field:0,props:{num:{field:u.key()},exclude:{fields:l.qDimensionInfo.map((function(e,t){return{field:"qDimensionInfo/".concat(t)}})),value:function(e){return Math.min.apply(Math,L(e))<0}}}}).filter((function(e){return e.value>=0&&!e.exclude.value})).map((function(e){return e.num.value})).filter((function(e){return"number"==typeof e})))}if(!1===n.input.autoMinMax){if(s.min=n.input.measureMin,s.max=n.input.measureMax,s.max<s.min)return{invalid:!0}}else if(u&&!f)s.min=u.min(),s.max=u.max();else if(u){if(!c.length)return{invalid:!0};s.min=Math.min.apply(Math,L(c)),s.max=Math.max.apply(Math,L(c))}if(n.input.measureScheme&&(s.palettes={quant:n.input.measureScheme}),a){var d=a.getDataColorScales().filter((function(e){return e.key===n.input.measureScheme}))[0];s.type=d&&Ke.test(d.type)?"categorical":"continuous","categorical"===s.type&&(i=d.colors.some((function(e){return Array.isArray(e)}))?Math.max.apply(Math,L(d.colors.map((function(e){return e?e.length:0})))):d.colors.length)}if("categorical"===s.type){for(var p=f?Ye(s.max,s.min,c,1,i):i,h=(s.max-s.min)/p,m=[],v=0;v<p+1;v+=1)m.push(s.min+h*v);s.domain=m,s.range=function(e){for(var t=e.resources.theme.palette("quant",p),n=Math.max(1,Math.floor(t.length/p)),r=[],o=0;o<p;o+=1)r.push(t[o*n]);return[r[0]].concat(r,[r[r.length-1]])}}return s};function Ze(e,t){var n;return t.activeMeasureIndex>=0?n=e.pic.fields().filter((function(e){return"measure"===e.type()}))[t.activeMeasureIndex]:"libraryItem"===t.type?n=e.pic.field((function(e){return e.raw().colorMapRef===t.key&&void 0!==t.key})):"expression"===t.type&&(n=e.pic.field((function(e){return"colorByAlternative"===e.raw().id}))),n||(n=e.pic.field((function(e){return void 0!==e.raw().matchMeasure})))&&(n=e.pic.fields().filter((function(e){return"measure"===e.type()}))[n.raw().matchMeasure]),n}function Je(e){var t,n=e.cm,r=e.defaults,o=e.index,i=e.input,a=e.pic;if(!i||!i.on)return null;var l=null!==(t=i.mode)&&void 0!==t?t:"primary";return"primary"===l?function(e,t,n){var r=n.primary;return void 0!==t.paletteColor&&t.paletteColor&&(r=e.resolveUIColor(t.paletteColor)),P(P({},n),{},{mode:"constant",type:"constant",primary:r})}(n,i,r):"byExpression"===l?function(e,t,n){var r="qMeasureInfo/".concat(e,"/"),o=t.field((function(e){return e.id().startsWith(r)&&"colorByMeasureExpression"===e.raw().id})),i=o;return P(P({},n),{},i?{mode:"field",fieldType:"expression",field:o?o.key():void 0,type:"color"}:{mode:"constant",type:"constant",primary:n.nil})}(o,a,r):null}function Qe(e){e.measureOverrides.every((function(e){return!e}))&&(e.measureOverrides=null)}function Xe(e,t){for(var n=(null==t?void 0:t.domain)||[],r=(null==t?void 0:t.range)||[],o=[],i=0;i<e.length;++i){var a=e[i];if("constant"===(null==a?void 0:a.mode)){var l=n.indexOf(i);-1===l?(n.push(i),r.push(a.primary)):r[l]=a.primary,e[i]=null}else if(a){o.push(i);var u=n.indexOf(i);-1!==u&&(n.splice(u,1),r.splice(u,1))}}return{domain:n,range:r,exclude:o}}function et(e,t,n,r){var o,i=function(e,t,n,r){if(t.input&&!t.input.auto){if("byMeasure"===t.input.mode)return function(e,t,n){var r=t.theme,o=t.hc,i=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).getCField,a=void 0===i?Ze:i,l=n.input.byMeasureDef||{activeMeasureIndex:0},u=a(n,l),s=Ge(0,{theme:r,hc:o},n,{f:u});if(s.invalid)return s;("expression"===l.type||l.activeMeasureIndex<0)&&(s.label=l.label,u&&"color.altLabel"===u.raw().labelExpRef&&(s.label=n.input.altLabel)),!s.label&&u&&(s.label=u.title());var c=l.activeMeasureIndex>=0?u:null;if(!c&&u&&void 0!==u.raw().matchMeasure&&u.raw().matchMeasure>-1&&(c=n.pic.fields().filter((function(e){return"measure"===e.type()}))[u.raw().matchMeasure]),n.input.useMeasureGradient&&"libraryItem"===l.type)if(c){var f=c.raw().coloring;f&&f.gradient&&W(s,We(e,f.gradient,s,c))}else s.auxiliary=l;return s}(e,n,t);if("byDimension"===t.input.mode)return function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=r.getCDef,i=void 0===o?J:o,a=r.getCByField,l=void 0===a?Q:a,u=r.getPersistence,s=void 0===u?Z:u,c=i(t,n),f=l(n,c),d=f?f.raw():{},p=n&&n.pic?n.pic.raw():{};if(d.qError||d.qSize&&0===d.qSize.qcy&&!p.qHasOtherValues)return{invalid:!0};var h={mode:"field",fieldType:"dimension",type:"categorical",field:f?f.key():void 0,isFieldLocked:d.qLocked};return("expression"===c.type||c.activeDimensionIndex<0)&&(h.label=c.label,"color.altLabel"===d.labelExpRef&&(h.label=n.input.altLabel)),!h.label&&f&&(h.label=f.title()),n.input.dimensionScheme&&(h.palettes={categorical:n.input.dimensionScheme}),n.input.useDimColVal&&"libraryItem"===c.type&&(h.auxiliary=c),W(h,s(t,n,c,f,{byRow:G,byElemNo:Y})),h}(e,n,t);if("byExpression"===t.input.mode)return function(e,t,n,r){var o=t.hc,i=t.theme,a=t.translator,l=n.pic.field((function(e){return"colorByExpression"===e.raw().id}));if(!l||!l.raw().qFallbackTitle&&!n.input.colorExpression||!(Number.isFinite(l.raw().qMin)&&Number.isFinite(l.raw().qMax)||n.input.expressionIsColor))return{mode:"constant",type:"constant",primary:r.nil};if(n.input.expressionIsColor)return{mode:"field",fieldType:"expression",field:l?l.key():void 0,type:"color"};var u=Ge(0,{hc:o,theme:i},n,{f:l});return u.invalid||(u.label=n.input.expressionLabel||a.get("Object.ChartTooltip.ColorExpression")),u}(0,n,t,r);if("byMultiple"===t.input.mode||"primary"===t.input.mode)return function(e,t,n,r){var o=t.hc,i=t.theme,a=t.translator,l=n.input.useBaseColors;if(("byMultiple"===n.input.mode||"primary"===n.input.mode&&"measure"===n.input.useBaseColors)&&o.qMeasureInfo.length>1&&(l="measure"),"measure"===l){var u=[],s=[];"measure"===n.input.useBaseColors&&o.qMeasureInfo.forEach((function(t,n){if(t.baseColor||t.coloring&&t.coloring.baseColor){u.push(n);var o=e.resolveUIColor(t.baseColor||t.coloring.baseColor);"none"===o?s.push(r.primary):s.push(o)}}));var c=n.input.dimensionScheme?{categorical:n.input.dimensionScheme}:void 0,f=i?i.getDataColorPalettes()[0]:void 0;return"measure"===n.input.useBaseColors&&f&&(c={categorical:f.key}),{mode:"measure",type:"categorical",palettes:c,label:a?a.get("Common.Measures"):void 0,explicit:u.length?{domain:u,range:s}:void 0}}if("dimension"===l){var d=[],p=[];return o.qDimensionInfo.forEach((function(t,n){if(t.baseColor||t.coloring&&t.coloring.baseColor){d.push(n);var o=e.resolveUIColor(t.baseColor||t.coloring.baseColor);"none"===o?p.push(r.primary):p.push(o)}})),{mode:"dimension",type:"categorical",field:d.length?d[0]:void 0,explicit:d.length?{domain:d,range:p}:void 0}}var h=r.primary;if(void 0!==n.input.paletteColor)n.input.paletteColor&&(h=e.resolveUIColor(n.input.paletteColor));else{var m=n.input.singleColor;"number"!=typeof m||Number.isNaN(m)||(h=["#b0afae","#7b7a78","#545352","#4477aa","#7db8da","#b6d7ea","#46c646","#f93f17","#ffcf02","#276e27","#ffffff","#000000"][m])}return{mode:"constant",type:"constant",primary:h}}(e,n,t,r)}return{}}(e,t,n,r);return null!==(o=t.input)&&void 0!==o&&o.measureOverrides?(i.measureOverrides=t.input.measureOverrides.map((function(n,o){return Je({cm:e,input:n,defaults:r,index:o,pic:t.pic})})),function(e,t){var n,r,o,i=t.translator;if(Qe(e),1===(null===(n=e.measureOverrides)||void 0===n?void 0:n.length))return e.measureOverrides[0];if("measure"===e.mode&&e.measureOverrides&&(e.explicit=Xe(e.measureOverrides,e.explicit),Qe(e)),null!==(r=e.measureOverrides)&&void 0!==r&&r.every((function(e){return"constant"===(null==e?void 0:e.mode)}))){var a={mode:"measure",type:"categorical",label:null==i?void 0:i.get("Common.Measures")};return a.explicit=Xe(e.measureOverrides),a}return null!==(o=e.measureOverrides)&&void 0!==o&&o.every((function(e){return e}))?{invalid:!0,measureOverrides:e.measureOverrides}:e}(i,n)):i}function tt(e){var t=P({hc:null,colorProps:null,layout:null,theme:null},e),n={},r={auto:function(){return{mode:"primary"}},getDimensionColorMap:function(){return Promise.reject()},getMeasure:function(){return Promise.reject()},getAttributeDimension:function(){return Promise.reject()}},o={auto:function(e){return e?(r.auto=e,o):r.auto},getDimensionColorMap:function(e){return e?(r.getDimensionColorMap=e,o):r.getDimensionColorMap},getAttributeDimension:function(e){return e?(r.getAttributeDimension=e,o):r.getAttributeDimension},getMeasure:function(e){return e?(r.getMeasure=e,o):r.getMeasure},set:function(e){var o;if(!e.colorProps)throw new Error('Missing "colorProps"');if(W(t,e),(n={pic:t.picasso.data("q")({data:t.hc,config:{localeInfo:t.localeInfo}}),input:t.colorProps}).input.auto){var i=r.auto(e.layout);n.input=W(!0,{},n.input,i,{auto:!1});var a=t.theme?t.theme.getDataColorPalettes():[];a[0]&&(n.input.dimensionScheme=a[0].key);var l=0;n.input.byDimDef&&+n.input.byDimDef.activeDimensionIndex>=0&&(l=+n.input.byDimDef.activeDimensionIndex),t.hc&&t.hc.qDimensionInfo[l]&&t.hc.qDimensionInfo[l].coloring&&t.hc.qDimensionInfo[l].coloring.colorMapRef&&n.input.byDimDef&&(n.input.byDimDef.type="libraryItem",n.input.byDimDef.key=t.hc.qDimensionInfo[l].coloring.colorMapRef)}null!==(o=n.input.measureOverrides)&&void 0!==o&&o.every((function(e){return!e||!e.on}))&&(n.input=W(!1,{},n.input,{measureOverrides:null}))},palettes:function(){if(!n.palettes){var e=t.theme,r=[];(e&&e.getDataColorPickerPalettes()||[]).forEach((function(e){r.push({key:"ui",colors:e.colors})})),n.palettes=r}return n.palettes},getAuxiliaryData:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/qHyperCubeDef";if(!e.auxiliary&&!/qAttrDimInfo/.test(e.field))return Promise.resolve();var o=e.auxiliary||{},i=o.key;if("measure"===e.fieldType)return r.getMeasure(i,t).catch((function(){}));if("dimension"===e.fieldType){var a="".concat(n,"/").concat(e.field).replace("qDimensionInfo","qDimensions").replace("qAttrDimInfo","qAttributeDimensions");return Promise.all([/qAttrDimInfo/.test(e.field)?r.getAttributeDimension(a,t).catch((function(){})):Promise.resolve(),i?r.getDimensionColorMap(i,t).catch((function(){})):Promise.resolve()])}return Promise.resolve()},getAuxiliarySettings:function(e,r){var o=this;return e.auxiliary||/qAttrDimInfo/.test(e.field)?(this.palettes(),this.getAuxiliaryData(e,r).then((function(r){if(!r)return{};if("measure"===e.fieldType){if(r.coloring&&r.coloring.gradient){var i=n.pic.field(e.field);return We(o,r.coloring.gradient,e,i)}return{}}if("dimension"===e.fieldType){var a={nil:e.nil,others:e.others},l=r[0],u=r[1]?r[1].colorMap:null;if(l){var s=t.picasso.data("q")({data:{qDimensionInfo:[n.pic.field(e.field).raw(),n.pic.field(e.field).raw()],qMeasureInfo:[],qDataPages:l,qInterColumnSortOrder:[0,1],qMode:"S"}});a.legendDataset=s}return u?function(e,t,n,r){var o=r.external,i=r.field,a=P({},e);W(a,Y(i,i.raw().qCardinal));var l=o.theme?o.theme.getDataColorPalettes()[0]:null;return t.nul&&(a.nil=n.resolveUIColor(t.nul)),t.oth&&(a.others=n.resolveUIColor(t.oth)),t.usePal?(a.palettes={categorical:t.pal},l&&!t.pal&&(a.palettes.categorical=l.key,W(a,Y(i)))):!1===t.autoFill&&t.single?a.range=[n.resolveUIColor(t.single)]:t.autoFill&&(l&&(a.palettes={categorical:l.key}),W(a,Y(i))),t.colors&&t.colors.length&&(a.explicit=function(e,t,n){for(var r={},o=0;o<e.length;o+=1)r[e[o].value]=e[o].baseColor;var i=[];return{domain:function(e){var o=e.data,a=[];i=[];for(var l=0;l<o.items.length;l++){var u=o.items[l],s=(u.text||u).label;r[s]&&-1===a.indexOf(u.value)&&(a.push(u.value),i.push(t.resolveUIColor(r[s])))}return a.push(-3,-2),i.push(n.others),i.push(n.nil),a},range:function(){return i}}}(t.colors,n,a)),a}(a,u,o,{external:t,field:n.pic.field(e.field)}):a}return{}}))):Promise.resolve()},resolveUIColor:function(e){if(e.index<0||void 0===e.index)return e.color;if(void 0===n.uiPalette&&(n.uiPalette=this.palettes().filter((function(e){return"ui"===e.key}))[0]||!1),!n.uiPalette)return e.color;var t="none"===n.uiPalette.colors[0]?e.index:e.index-1;return void 0===n.uiPalette.colors[t]?e.color:n.uiPalette.colors[t]},settings:function(){if(this.palettes(),!n.settings){var e={primary:"steelblue",others:"#aaa",nil:"#ddd"},r=t.theme;r&&(e=P(P({},e),r.getDataColorSpecials())),n.settings=W(e,et(this,n,t,e))}return n.settings}};return o}var nt=function(e,t){var n=e.fieldType,r={};if(t)if("measure"===n){var o=t.coloring;o&&(r.measureGradient=o.gradient)}else if("dimension"===n){var i=t[0],a=t[1];i&&(r.legendDataPage=i),a&&(r.dimValsData=a.colorMap)}return r},rt=function(e){throw e.isHandled=!0,e},ot=function(e,t){var n=t.layout,r=t.app;return n&&n.snapshotData?n.snapshotData.content&&n.snapshotData.content.chartData&&n.snapshotData.content.chartData.dimValsData?Promise.resolve({colorMap:n.snapshotData.content.chartData.dimValsData}):Promise.reject():r&&r.getObject?r.getObject("ColorMapModel_".concat(e)).then((function(e){return e.getLayout()})):Promise.reject()},it=function(e,t){var n=t.layout,r=t.app;return n&&n.snapshotData?n.snapshotData.content&&n.snapshotData.content.chartData&&n.snapshotData.content.chartData.measureGradient?Promise.resolve({coloring:{gradient:n.snapshotData.content.chartData.measureGradient}}):Promise.reject():r&&r.getMeasure?r.getMeasure(e).then((function(e){return e.getMeasure()})):Promise.reject()},at=function(e,t){var n=t.layout,r=t.model,o=t.app;return n&&n.snapshotData?n.snapshotData.content&&n.snapshotData.content.chartData&&n.snapshotData.content.chartData.legendDataPage?Promise.resolve(n.snapshotData.content.chartData.legendDataPage):Promise.reject():r&&r.session&&o?r.getHyperCubeData(e,[{qHeight:100,qLeft:0,qTop:0,qWidth:2}]).catch(rt):Promise.reject()};function lt(e){var t=e.hc,n=e.source,r=e.coloring,o={data:{extract:[{source:"dummy",field:0,filter:function(){return o.expando=t.qDataPages[0]?t.qDataPages[0].qArea.qTop:0,!1}},{source:n,field:r.field,trackBy:r.valueAccessor,reduce:"first",props:{row:{reduce:function(){return o.expando++}},text:{value:function(e){return e.qText},reduce:"first"}}}]},expando:0};return o}function ut(e){return function(t){return"object"===S(t.datum[e])?t.datum[e].value:void 0}}function st(e){return"object"===S(e.datum.isNull)?e.datum.isNull.value:-2===e.datum.value}function ct(e){return-3===e.datum.value}var ft=function(e,t,n){var r=e&&e.dock||void 0;if("auto"!==r)return r||"right";if(t){var o=t.element.getBoundingClientRect();if(o.height>o.width)return"bottom"}return n?"left":"right"},dt=function(e,t,n){return!(n.invalid||"color"===n.type||"measure"===n.mode&&t.qMeasureInfo.length<=1||"dimension"===n.mode)&&("function"==typeof e.show?e.show():!1!==e.show)};function pt(e,t){var n=e.styleReference,r=e.chart,o=e.rtl,i=t.legendProps,a=t.coloring,l=t.theme,u=t.hc;return{layout:{minimumLayoutMode:"MEDIUM",dock:ft(i,r,o)},show:"function"==typeof i.show?function(){return dt(i,u,a)}:dt(i,u,a),renderer:"svg",mounted:function(e){e.childNodes[0].style.pointerEvents="none",e.style.overflow="hidden"},settings:{title:{show:!1!==i.showTitle,wordBreak:"break-word",maxLines:2,lineHeight:1.2,text:a.label||"",fill:l?l.getStyle(n,"legend.title","color"):void 0,fontSize:l?l.getStyle(n,"legend.title","fontSize"):"16px",fontFamily:l?l.getStyle(n,"legend.title","fontFamily"):"QlikView Sans, sans-serif"}}}}function ht(e,t,n){var r=[],o=[],i=function(e,t,n){return"categorical"===t.coloring.type?function(e,t,n){var r=pt(e,t);if(!r.show)return!1;var o=e.key,i=e.styleReference,a=e.viewState,l=e.rtl,u=e.settings,s=e.style,c=t.scaleKey,f=t.theme,d=t.scales,p={up:"M13.6,11 L2.4,11 C2.28954305,11 2.2,10.9104569 2.2,10.8 C2.2,10.756726 2.21403557,10.7146192 2.24,10.68 L7.84,3.21333333 C7.90627417,3.12496777 8.03163444,3.10705916 8.12,3.17333333 C8.13516113,3.18470418 8.14862915,3.1981722 8.16,3.21333333 L13.76,10.68 C13.8262742,10.7683656 13.8083656,10.8937258 13.72,10.96 C13.6853808,10.9859644 13.643274,11 13.6,11 Z",down:"M2.4,4 L13.6,4 C13.7104569,4 13.8,4.08954305 13.8,4.2 C13.8,4.24327404 13.7859644,4.28538077 13.76,4.32 L8.16,11.7866667 C8.09372583,11.8750322 7.96836556,11.8929408 7.88,11.8266667 C7.86483887,11.8152958 7.85137085,11.8018278 7.84,11.7866667 L2.24,4.32 C2.17372583,4.23163444 2.19163444,4.10627417 2.28,4.04 C2.31461923,4.01403557 2.35672596,4 2.4,4 Z",left:"M11,2.4 L11,13.6 C11,13.7104569 10.9104569,13.8 10.8,13.8 C10.756726,13.8 10.7146192,13.7859644 10.68,13.76 L3.21333333,8.16 C3.12496777,8.09372583 3.10705916,7.96836556 3.17333333,7.88 C3.18470418,7.86483887 3.1981722,7.85137085 3.21333333,7.84 L10.68,2.24 C10.7683656,2.17372583 10.8937258,2.19163444 10.96,2.28 C10.9859644,2.31461923 11,2.35672596 11,2.4 Z",right:"M4,13.6 L4,2.4 C4,2.28954305 4.08954305,2.2 4.2,2.2 C4.24327404,2.2 4.28538077,2.21403557 4.32,2.24 L11.7866667,7.84 C11.8750322,7.90627417 11.8929408,8.03163444 11.8266667,8.12 C11.8152958,8.13516113 11.8018278,8.14862915 11.7866667,8.16 L4.32,13.76 C4.23163444,13.8262742 4.10627417,13.8083656 4.04,13.72 C4.01403557,13.6853808 4,13.643274 4,13.6 Z"},h="".concat(c,"Legend");return W(!0,r,{type:"legend-cat",key:"".concat(o,"-cat"),scale:h in d?h:c,settings:{layout:{scrollOffset:function(){return a?a.get("legendScrollOffset"):void 0},size:-1!==["top","bottom"].indexOf(r.layout.dock)?2:1,direction:l?"rtl":"ltr",horizontal:20},item:{show:function(e){return-2!==e.datum.value},label:{fill:f?f.getStyle(i,"legend.label","color"):void 0,fontSize:f?f.getStyle(i,"legend.label","fontSize"):void 0,fontFamily:f?f.getStyle(i,"legend.label","fontFamily"):"QlikView Sans, sans-serif"}},navigation:{disabled:n,button:{content:function(e,t){var n=t.direction;return e("i",{style:{"pointer-events":"none",fontSize:"12px",display:"inline-block",fontStyle:"normal",lineHeight:"0",textAlign:"center",textTransform:"none",verticalAlign:"-0.125em",textRendering:"optimizelegibility",margin:"0px"}},[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 16 16",fill:"currentColor"},[e("path",{d:p[n]})])])}}}},brush:{consume:[{context:"selection",data:["",o],style:{inactive:{opacity:.3}}}]}},{settings:u,style:s})}(e,t,n):"continuous"===t.coloring.type&&function(e,t){var n=e.key,r=e.styleReference,o=e.rtl,i=e.settings,a=e.style,l=t.scaleKey,u=t.theme,s=pt(e,t);return!!s.show&&W(!0,s,{type:"legend-seq",key:"".concat(n,"-seq"),settings:{fill:l,major:"".concat(l,"Range"),length:1,tick:{fill:u?u.getStyle(r,"legend.label","color"):void 0,fontSize:u?u.getStyle(r,"legend.label","fontSize"):void 0,fontFamily:u?u.getStyle(r,"legend.label","fontFamily"):"QlikView Sans, sans-serif"},title:{anchor:!o||"top"!==s.layout.dock&&"bottom"!==s.layout.dock?void 0:"right",padding:parseFloat(s.settings.title.fontSize)||16}}},{settings:i,style:a})}(e,t)}(e,t,n&&n.navigationDisabled);return r.push(i),i&&"legend-cat"===i.type&&(o.push(function(e){var t=e.key,n=e.requireFailure,r=e.recognizeWith,o=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).actions;return{key:"event:tap-".concat(t),type:"Tap",requireFailure:n,recognizeWith:r,options:{event:"legendtap",interval:10,pointers:1,enable:function(e,n){var r;if(!n)return!0;if(null!=o&&null!==(r=o.interact)&&void 0!==r&&r.enabled&&!o.interact.enabled())return!1;if(!this.chart.componentsFromPoint({x:n.center.x,y:n.center.y}).some((function(e){return e.key==="".concat(t,"-cat")})))return!1;var i=n.srcEvent.target;return!!(i&&i.hasAttribute("data-action")&&i.hasAttribute("data-component-key"))||!(!i||!i.childNodes[0]||"BUTTON"!==i.childNodes[0].nodeName)}},events:{legendtap:function(e){e.preventDefault();var t=e.srcEvent.target;t&&t.hasAttribute("data-action")&&t.hasAttribute("data-component-key")&&this.chart.component(t.getAttribute("data-component-key")).emit(t.getAttribute("data-action"))}}}}(e,n)),o.push(function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.eventName,r=t.key,o=t.requireFailure,i=t.recognizeWith,a=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).actions;return{key:"event:pan-".concat(r),type:"Pan",requireFailure:o,recognizeWith:i,options:{event:n,pointers:1,threshold:10,enable:function(e,t){var o;return this.started===n||!t||!(null!=a&&null!==(o=a.interact)&&void 0!==o&&o.enabled&&!a.interact.enabled())&&this.chart.componentsFromPoint({x:t.center.x,y:t.center.y}).some((function(e){return e.key==="".concat(r,"-cat")}))}},events:(e={},N(e,"".concat(n,"start"),(function(e){e.preventDefault(),this.started!==n&&(this.started=n,this.chart.component("".concat(r,"-cat")).emit("panstart",e))})),N(e,"".concat(n,"move"),(function(e){e.preventDefault(),this.chart.component("".concat(r,"-cat")).emit("panmove",e)})),N(e,"".concat(n,"end"),(function(e){e.preventDefault(),this.chart.component("".concat(r,"-cat")).emit("panend",e),this.started=!1})),e)}}(e,n))),{interactions:o,components:r}}var mt=function(e){return"rgba(".concat([(16711680&e)>>16,(65280&e)>>8,255&e,((4278190080&e)>>>24)/255].join(","),")")};function vt(e){var t=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.auto,n=tt(e.resources).auto(t||function(){return{mode:"byDimension",persistent:!1,useDimColVal:!0,byDimDef:{activeDimensionIndex:0,type:"expression",label:""}}}).getDimensionColorMap((function(e,t){var n=t.layout,r=t.app;return ot(e,{layout:n,app:r})})).getMeasure((function(e,t){var n=t.layout,r=t.app;return it(e,{layout:n,app:r})})).getAttributeDimension((function(e,t){var n=t.layout,r=t.model,o=t.app;return at(e,{layout:n,model:r,app:o})}));return n.getSnapshotData=nt,n}({resources:e}),n={},r={},o=function(e){return r.settings||(e||console.warn("settings() called before auxiliarySettings()"),r.settings=t.settings()),r.settings},i={config:function(o){if(n=P({},o),r={},!n.key)throw new Error("Missing key");t.set(P(P({},e),n))},auto:function(e){return e?(t.auto(e),i):t.auto()},getAuxiliarySettings:function(e){return r.auxiliarySettings?Promise.resolve(r.auxiliarySettings):t.getAuxiliarySettings(o(!0),e).then((function(e){return r.auxiliarySettings=e||{},r.settings=P(P({},r.settings),r.auxiliarySettings),r.scales=void 0,r.color=void 0,r.auxiliarySettings}))},getAuxiliaryData:function(){return t.getAuxiliaryData(o())},getSnapshotData:function(e){var n=o();return t.getAuxiliaryData(n,e).then((function(e){return t.getSnapshotData(n,e)}))},resolveUIColor:function(e){return t.resolveUIColor(e)},settings:function(){var e=o();return{mode:e.mode,type:e.type,label:e.label,field:e.field,fieldType:e.fieldType,nil:e.nil,others:e.others,primary:e.primary}},settingsForMeasure:function(e){var t;return(null===(t=o().measureOverrides)||void 0===t?void 0:t[e])||this.settings()},isSelectionLocked:function(e){var t=e.isMeasureSelectionLocked;return function(e,t){var n=t.isMeasureSelectionLocked;return"field"!==e.mode||("dimension"===e.fieldType?e.isFieldLocked:"measure"!==e.fieldType||n)}(o(),{isMeasureSelectionLocked:t})},palettes:function(){return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.colorProps,n=e.coloring,r=e.theme,o=[];if(n&&n.palettes&&r){var i=n.palettes.categorical||t.dimensionScheme,a=r.getDataColorPalettes().filter((function(e){return e.key===i}))[0]||r.getDataColorPalettes()[0];i&&a&&o.push({key:"categorical",colors:a.colors});var l=n.palettes.metric||t.measureScheme,u=r.getDataColorScales().filter((function(e){return e.key===l}))[0];if(u){var s=u.colors[0]?u.colors:[[]].concat(L(u.colors.slice(1)));s=Array.isArray(s[0])?s.map((function(e){return e.slice().reverse()})):s.slice().reverse(),o.push({key:"quant",colors:s})}}return o}({coloring:o(),colorProps:n.colorProps,theme:n.theme})},scales:function(){return r.scales=r.scales||function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.hc,n=e.coloring,r=e.rtl,o=e.key,i=e.source,a=e.picasso,l={},u=o;if(n){var s={override:!0,domain:n.explicit&&"function"==typeof n.explicit.domain?n.explicit.domain:[].concat(L((n.explicit||{}).domain||[]),[-3,-2]),range:n.explicit&&"function"==typeof n.explicit.range?n.explicit.range:[].concat(L((n.explicit||{}).range||[]),[n.others,n.nil])};if("field"===n.mode){if("dimension"===n.fieldType){var c,f=lt({hc:t,source:i,coloring:n}).data;if(n.legendDataset){var d=0,p={};a.data("q")({data:t}).extract({field:n.field,trackBy:n.valueAccessor,reduce:function(e){var t=e[0];return p[t]=d++,e[0]}}),c={source:"attrDim",extract:{field:"qDimensionInfo/0",filter:function(e){return e.qElemNumber>=0},props:{row:{value:function(e){return p[e.qElemNumber]}}}}}}var h={data:f,range:n.range,domain:n.domain,explicit:s,type:"categorical-color",label:function(e){return e.datum.text&&e.datum.text.value?e.datum.text.value:e.datum.label}};l[u]=h,c&&(l["".concat(u,"Legend")]=P(P({},h),{},{data:c})),t&&t.qHasOtherValues&&c&&((c||h.data).amend=[{label:t.qDimensionInfo[0].othersLabel,source:{key:"qHyperCube",field:"qDimensionInfo/0"},row:{value:-3},value:-3}])}else if("measure"===n.fieldType){var m={data:{field:n.field},min:n.min,max:n.max};l[u]=W({},m,{type:"categorical"===n.type?"threshold-color":"sequential-color",range:n.range,domain:n.domain,invert:n.reverse}),"sequential-color"===l[u].type&&(l["".concat(u,"Range")]=W({},m,{invert:!!r}))}else if("color"!==n.type)throw new Error("UNUSED FIELD")}else if("dimension"===n.mode){var v={data:t.qDimensionInfo.map((function(e,t){return t})),label:function(e){return t.qDimensionInfo[e.datum.value].qFallbackTitle},explicit:s,type:"categorical-color"};l[u]=v}else if("measure"===n.mode){var g={data:t.qMeasureInfo.map((function(e,t){return t})).filter((function(e){var t,r;return!(null!==(t=n.explicit)&&void 0!==t&&null!==(r=t.exclude)&&void 0!==r&&r.includes(e))})),label:function(e){return t.qMeasureInfo[e.datum.value].qFallbackTitle},explicit:s,type:"categorical-color"};l[u]=g}}return l}({hc:n.hc,coloring:o(),key:n.key,source:n.source,picasso:e.picasso}),r.scales},color:function(){return r.color=r.color||function(e){var t=e.coloring,n=e.scales,r=e.key,o=ut(r),i=ut("".concat(r,"IsAnOther")),a=function(e,t){var r=e.fieldType,a=e.invalid,l=e.mode,u=e.nil,s=e.others,c=e.primary,f=e.type;return a?function(e){return ct(e)||i(e)?s:u}:n[t]?function(e){return ct(e)?s:st(e)||-2===o(e)&&"dimension"===r||"NaN"===o(e)?u:i(e)?s:e.resources.scale(t)(o(e))||s}:"constant"===l?function(e){return ct(e)||i(e)?s:st(e)?u:c}:"color"===f?function(e){return ct(e)||i(e)?s:st(e)?u:o(e)||s}:null},l=a(t,r);if(t.measureOverrides){var u=ut("".concat(r,"MeasureIdx")),s=t.measureOverrides.map((function(e){return e&&a(e)}));return function(e){var t=u(e);return s[t]?s[t](e):l(e)}}return l}({coloring:o(),scales:this.scales(),key:n.key}),r.color},datumProps:function(e){return function(e){var t,n,r=e.hc,o=e.coloring,i=e.scales,a=e.key,l=e.addMeasureIx,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=a,c=o.nil;"field"===o.mode&&o.field?t=o.field:i[a]&&"field"===o.mode&&(t=i[a].data.field||o.field),t?(n={field:t,reduce:"first"},"color"===o.type&&(n.value=function(e){return"NaN"!==e.qNum?mt(e.qNum):e.qText&&ve(e.qText)?e.qText:c})):"dimension"===o.mode?n=void 0!==o.field?o.field:r.qDimensionInfo.length-1:"measure"===o.mode&&(n=u);var f=N({},s,n);return r.qDimensionInfo.length>1&&(f["".concat(s,"IsAnOther")]={fields:r.qDimensionInfo.map((function(e,t){return{field:"qDimensionInfo/".concat(t)}})),value:function(e){return-1!==e.indexOf(-3)}}),l&&(f["".concat(s,"MeasureIdx")]=u),f}({coloring:this.settingsForMeasure(e),scales:this.scales(),key:n.key,hc:n.hc,addMeasureIx:o().measureOverrides},e)},data:function(){var e=o(),t={key:"dummy",data:[["field"],["a"]]};return e.legendDataset?[t,{type:"q",key:"attrDim",data:e.legendDataset.raw(),config:{localeInfo:n.localeInfo}}]:[t]},legend:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.eventName,r=e.key,i=e.viewState,a=e.chart,l=e.rtl,u=e.styleReference,s=void 0===u?"object.legend":u,c=e.settings,f=void 0===c?{}:c,d=e.style,p=void 0===d?{}:d,h=arguments.length>1?arguments[1]:void 0;return ht({eventName:t,key:r,rtl:l,viewState:i,chart:a,styleReference:s,settings:f,style:p},{legendProps:n.legendProps,scaleKey:n.key,coloring:o(),theme:n.theme,hc:n.hc,scales:this.scales()},h)}};return i}var gt=function(e){return e.baseColor||e.coloring&&e.coloring.baseColor};function yt(e){var t=e.qHyperCube,n=t.qDimensionInfo,r=t.qMeasureInfo,o=n.some(gt),i=r.some(gt),a=e.color.useBaseColors;return"measure"===a&&!i||"dimension"===a&&!o?"off":a}function bt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=P(P(P({},e),t),{},{colorProps:P(P({},e.colorProps),t.colorProps||{})});return n}var xt=function(e){return e.baseColor||e.coloring&&e.coloring.baseColor};function qt(e){var t,n=e.qHyperCube.qDimensionInfo.some(xt),r=e.qHyperCube.qMeasureInfo.some(xt),o=n?"dimension":void 0;return{mode:"primary",useBaseColors:null!==(t=null!=o?o:r?"measure":void 0)&&void 0!==t?t:"off",paletteColor:null}}var Dt=function(){};function wt(e){var t=e.originalArray,n=e.newArray,r=e.matchKey;return Array.isArray(t)&&t.length?(n.forEach((function(e){var n=-1;t.some((function(t,o){return t[r]&&t[r]===e[r]&&(n=o),n})),n>-1?t[n]=e:t.push(e)})),t):n}function Mt(e){return(Mt="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})(e)}function Ct(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function It(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function kt(e,t,n){return t&&It(e.prototype,t),n&&It(e,n),e}function St(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function At(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 Ot(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?At(Object(n),!0).forEach((function(t){St(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):At(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Nt(e,t){return(Nt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Et(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Pt(e,t,n){return(Pt=Et()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&Nt(o,n.prototype),o}).apply(null,arguments)}function Tt(e){return function(e){if(Array.isArray(e))return Lt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||jt(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 jt(e,t){if(e){if("string"==typeof e)return Lt(e,t);var n=Object.prototype.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)?Lt(e,t):void 0}}function Lt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Rt=Object.prototype.hasOwnProperty,Ft=Object.prototype.toString,Ht=Object.defineProperty,Vt=Object.getOwnPropertyDescriptor,_t=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===Ft.call(e)},zt=function(e){if(!e||"[object Object]"!==Ft.call(e))return!1;var t,n=Rt.call(e,"constructor"),r=e.constructor&&e.constructor.prototype&&Rt.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!r)return!1;for(t in e);return void 0===t||Rt.call(e,t)},Bt=function(e,t){Ht&&"__proto__"===t.name?Ht(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},Ut=function(e,t){if("__proto__"===t){if(!Rt.call(e,t))return;if(Vt)return Vt(e,t).value}return e[t]},$t=function e(){var t,n,r,o,i,a,l=arguments[0],u=1,s=arguments.length,c=!1;for("boolean"==typeof l&&(c=l,l=arguments[1]||{},u=2),(null==l||"object"!=typeof l&&"function"!=typeof l)&&(l={});u<s;++u)if(null!=(t=arguments[u]))for(n in t)r=Ut(l,n),l!==(o=Ut(t,n))&&(c&&o&&(zt(o)||(i=_t(o)))?(i?(i=!1,a=r&&_t(r)?r:[]):a=r&&zt(r)?r:{},Bt(l,{name:n,newValue:e(c,a,o)})):void 0!==o&&Bt(l,{name:n,newValue:o}));return l};function Kt(e,t,n){if(!e)return-1;var r=n.cache,o=e.origin?e.origin():null;o&&(e=o);var i=r.fields.indexOf(e),a=-1,l=-1;if(-1===i)for(var u=0;u<r.wrappedFields.length;u++)if(l=r.wrappedFields[u].attrDims.map((function(e){return e.instance})).indexOf(e),a=r.wrappedFields[u].attrExps.map((function(e){return e.instance})).indexOf(e),-1!==l||-1!==a){i=u;break}return(i-=t.qArea.qLeft)<0||i>=t.qArea.qWidth?-1:l>=0?function(e){return e[i].qAttrDims.qValues[l]}:a>=0?function(e){return e[i].qAttrExps.qValues[a]}:function(e){return e[i]}}function Wt(e,t,n){var r=n.key,o={value:"function"==typeof e.value?e.value(t):void 0!==e.value?e.value:t};return o.label="function"==typeof e.label?e.label(t):void 0!==e.label?String(e.label):String(o.value),e.field&&(o.source={key:r,field:e.field.key()}),o}function Yt(e){var t=e.cache,n=e.f,r=e.mainCell,o=e.p;e.prop;var i=e.page,a=e.rowIdx,l=e.row,u=e.sourceKey,s=e.target,c=e.targetProp,f=r;if(o.field&&o.field!==n){var d=Kt(o.field,i,{cache:t});if(-1===d)return;f=$t({qRow:a},d(l))}s[c]=Wt(o,f,{key:u})}function Gt(e,t,n,r){for(var o=Array.isArray(e)?e:[e],i=[],a=0;a<o.length;a++)if(void 0!==o[a].field){for(var l=t.raw(),u=t.key(),s="object"===Mt(o[a].field)?o[a].field:t.field(o[a].field),c=r.normalizeConfig(o[a],t),f=c.props,d=c.main,p=Object.keys(f),h=!!o[a].trackBy,m=Mt(o[a].trackBy),v={},g=[],y=[],b=0;b<l.qDataPages.length;b++){var x=Kt(s,l.qDataPages[b],{cache:n});if(-1!==x)for(var q=0;q<l.qDataPages[b].qMatrix.length;q++){var D=l.qDataPages[b].qArea.qTop+q,w=$t({qRow:D},x(l.qDataPages[b].qMatrix[q])),M=Wt(d,w,{key:u});if(!d.filter||d.filter(w)){for(var C=0;C<p.length;C++){var I=f[p[C]],k=I.fields||[I];I.fields&&(M[p[C]]=[]);for(var S=0;S<k.length;S++)Yt({cache:n,f:s,mainCell:w,p:k[S],prop:p[C],props:f,page:l.qDataPages[b],rowIdx:D,row:l.qDataPages[b].qMatrix[q],sourceKey:u,target:I.fields?M[p[C]]:M,targetProp:I.fields?S:p[C]});if(I.fields){var A=M[p[C]].map((function(e){return e.value})),O=M[p[C]].map((function(e){return e.label}));M[p[C]]={value:"function"==typeof I.value?I.value(A):void 0!==I.value?I.value:A,label:"function"==typeof I.label?I.label(O):void 0!==I.label?String(I.label):String(M[p[C]].value)}}}h&&r.track({cfg:o[a],itemData:w,obj:M,target:g,tracker:v,trackType:m}),y.push(M)}}}h?i.push.apply(i,Tt(r.collect(g,{main:d,propsArr:p,props:f}))):i.push.apply(i,y)}return i}function Zt(e){var t=0,n=e.children,r=n&&n.length;if(r)for(;--r>=0;)t+=n[r].value;else t=1;e.value=t}function Jt(e,t){var n,r,o,i,a,l=new tn(e),u=+e.value&&(l.value=e.value),s=[l];for(null==t&&(t=Qt);n=s.pop();)if(u&&(n.value=+n.data.value),(o=t(n.data))&&(a=o.length))for(n.children=new Array(a),i=a-1;i>=0;--i)s.push(r=n.children[i]=new tn(o[i])),r.parent=n,r.depth=n.depth+1;return l.eachBefore(en)}function Qt(e){return e.children}function Xt(e){e.data=e.data.data}function en(e){var t=0;do{e.height=t}while((e=e.parent)&&e.height<++t)}function tn(e){this.data=e,this.depth=this.height=0,this.parent=null}function nn(e){if("function"!=typeof e)throw new Error;return e}tn.prototype=Jt.prototype={constructor:tn,count:function(){return this.eachAfter(Zt)},each:function(e){var t,n,r,o,i=this,a=[i];do{for(t=a.reverse(),a=[];i=t.pop();)if(e(i),n=i.children)for(r=0,o=n.length;r<o;++r)a.push(n[r])}while(a.length);return this},eachAfter:function(e){for(var t,n,r,o=this,i=[o],a=[];o=i.pop();)if(a.push(o),t=o.children)for(n=0,r=t.length;n<r;++n)i.push(t[n]);for(;o=a.pop();)e(o);return this},eachBefore:function(e){for(var t,n,r=this,o=[r];r=o.pop();)if(e(r),t=r.children)for(n=t.length-1;n>=0;--n)o.push(t[n]);return this},sum:function(e){return this.eachAfter((function(t){for(var n=+e(t.data)||0,r=t.children,o=r&&r.length;--o>=0;)n+=r[o].value;t.value=n}))},sort:function(e){return this.eachBefore((function(t){t.children&&t.children.sort(e)}))},path:function(e){for(var t=this,n=function(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),o=null;for(e=n.pop(),t=r.pop();e===t;)o=e,e=n.pop(),t=r.pop();return o}(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var o=r.length;e!==n;)r.splice(o,0,e),e=e.parent;return r},ancestors:function(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t},descendants:function(){var e=[];return this.each((function(t){e.push(t)})),e},leaves:function(){var e=[];return this.eachBefore((function(t){t.children||e.push(t)})),e},links:function(){var e=this,t=[];return e.each((function(n){n!==e&&t.push({source:n.parent,target:n})})),t},copy:function(){return Jt(this).eachBefore(Xt)}};var rn={depth:-1},on={};function an(e){return e.id}function ln(e){return e.parentId}function un(e,t){"/"===e.charAt(0)&&(e=e.substring(1));for(var n,r=e.split("/"),o=t,i=0;i<r.length;i++){if("*"===r[i]&&Array.isArray(o)){var a=[];n=r.slice(i+1).join("/");for(var l=0;l<o.length;l++){var u=un(n,o[l]);Array.isArray(u)?a.push.apply(a,Tt(u)):a.push(u)}return a}if(!r[i]&&Array.isArray(o)){var s=new Array(o.length);n=r.slice(i+1).join("/");for(var c=0;c<o.length;c++)s[c]=un(n,o[c]);return s}r[i]in o&&(o=o[r[i]])}return o}function sn(e,t,n){var r=[];if(!e||!e.length)return r;if(t<=0){var o=n>=0?[e[n]]:e;r.push.apply(r,Tt(o))}else for(var i=0;i<e.length;i++)e[i].children&&e[i].children.length&&r.push.apply(r,Tt(sn(e[i].children,t-1,n)));return r}function cn(e,t,n){if(e===t)return function(e){return e};if(e>t){var r=Math.max(0,Math.min(100,e-t)),o=Tt(Array(r)).map(String.prototype.valueOf,"parent").join(".");return Function("node","return node.".concat(o,";"))}if(t>e){var i=Math.max(0,Math.min(100,t-e));return function(e){return sn(e.children,i-1,n)}}return!1}function fn(e,t){var n=t.cache;if("number"==typeof e)return n.fields[e];var r=n.allFields;if("function"==typeof e){for(var o=0;o<r.length;o++)if(e(r[o]))return r[o];return!1}if("string"==typeof e){for(var i=0;i<r.length;i++)if(r[i].key()===e||r[i].title()===e)return r[i]}else if(e&&-1!==r.indexOf(e))return e;throw Error("Field not found: ".concat(e))}var dn=/^qDimensionInfo(?:\/(\d+))?/,pn=/^\/?qMeasureInfo\/(\d+)/,hn=/\/qAttrExprInfo\/(\d+)/,mn=/\/qAttrDimInfo\/(\d+)/;function vn(e){return(e.qColumnOrder&&e.qColumnOrder.length?e.qColumnOrder:e.qDimensionInfo.map((function(e,t){return t}))).filter((function(t){return t<e.qDimensionInfo.length}))}function gn(e,t){var n=t.cube;if(!e)return-1;var r=e.origin&&e.origin()?e.origin().key():e.key(),o=!1,i=-1,a=-1,l=-1,u=-1,s=-1,c=r,f=n.qEffectiveInterColumnSortOrder,d=vn(n);return dn.test(c)&&(o=!0,i=+dn.exec(c)[1],c=r.replace(dn,"")),pn.test(c)&&("K"===n.qMode?u=+pn.exec(c)[1]:f&&-1!==f.indexOf(-1)?(u=+pn.exec(c)[1],s=0):s=+pn.exec(c)[1],c=c.replace(pn,"")),c&&(mn.exec(c)?l=+mn.exec(c)[1]:hn.exec(c)&&(a=+hn.exec(c)[1])),{fieldDepth:(o?"S"===n.qMode?d[i]:f?f.indexOf(i):i:f&&-1!==f.indexOf(-1)?f.indexOf(-1):n.qDimensionInfo.length-("K"===n.qMode?0:1))+1,pseudoMeasureIndex:u,measureIdx:s,attrDimIdx:l,attrIdx:a}}function yn(e,t){var n,r,o=cn(e.fieldDepth,t.fieldDepth,t.pseudoMeasureIndex);return n=t.measureIdx>=0?function(e){return e.data.qValues[t.measureIdx]}:function(e){return e.data},t.attrDimIdx>=0?r=function(e){var n;return null==e||null===(n=e.qAttrDims)||void 0===n?void 0:n.qValues[t.attrDimIdx]}:t.attrIdx>=0&&(r=function(e){var n;return null==e||null===(n=e.qAttrExps)||void 0===n?void 0:n.qValues[t.attrIdx]}),{nodeFn:o,attrFn:r,valueFn:n}}function bn(e,t,n){var r=n.key,o={value:"function"==typeof e.value?e.value(t):void 0!==e.value?e.value:t};return o.label="function"==typeof e.label?e.label(t):void 0!==e.label?String(e.label):String(o.value),e.field&&(o.source={key:r,field:e.field.key()}),o}function xn(e){for(var t=e.propsArr,n=e.props,r=e.item,o=e.itemData,i=e.ret,a=e.sourceKey,l=0;l<t.length;l++){var u=n[t[l]],s=u.fields||[u],c=void 0,f=void 0;u.fields&&(c=[],f=[]);for(var d=function(e){var n=s[e],d=void 0,p=void 0,h=void 0,m=void 0,v=void 0,g=void 0;if("primitive"===n.type?(h=n.value,g=String(n.value)):("function"==typeof n.value&&(d=function(e){return n.value(e,r)}),"function"==typeof n.label&&(p=function(e){return n.label(e,r)}),n.accessor?(m=n.accessor(r),Array.isArray(m)?(v=m.map(n.valueAccessor),n.attrAccessor&&(v=v.map(n.attrAccessor)),d&&(h=v.map(d),d=null),p&&(g=v.map(p),p=null),h=n.reduce?n.reduce(h):h,g=n.reduceLabel?n.reduceLabel(g,h):String(h)):g=h=n.attrAccessor?n.attrAccessor(n.valueAccessor(m)):n.valueAccessor(m)):(h=o,g=o)),u.fields){var y=d?d(h):h;c.push(y),f.push(p&&null!=g?p(g):null!=g?g:String(y))}else{var b=d?d(h):h;i[t[l]]={value:b,label:p?p(g):null!=g?g:String(b)},n.field&&(i[t[l]].source={field:n.field.key(),key:a})}},p=0;p<s.length;p++)d(p);c&&(i[t[l]]={value:"function"==typeof u.value?u.value(c,r):c,label:"function"==typeof u.label?u.label(f,r):f})}}var qn=function(e,t,n){var r="K"===e.qMode?"/qStackedDataPages/*/qData":"/qTreeDataPages/*",o="K"===e.qMode?"qSubNodes":"qNodes",i=un(r,e);return i&&i[0]?(t.tree=Jt(i[0],n.children||function(e){return e[o]}),t.tree):null};function Dn(e){for(var t=e.raw().qDataPages.length?e.raw().qDataPages[0].qMatrix:[],n=function(e){var t=e.raw().qColumnOrder,n=e.fields();return t&&t.length===n.length?t:n.map((function(e,t){return t}))}(e),r=e.fields(),o=e.fields().filter((function(e){return"dimension"===e.type()})).map((function(e){return n.indexOf(r.indexOf(e))})),i=e.fields().filter((function(e){return"measure"===e.type()})).map((function(e){return n.indexOf(r.indexOf(e))})),a={__root:{__id:"__root",qValues:[]}},l=0;l<t.length;l++){for(var u=t[l],s="__root",c=!1,f=0;f<o.length;f++){var d=u[o[f]],p="".concat(s,"__").concat(d.qText);a[p]||(a[p]=Ot({__id:p,__parent:s,qValues:[]},d),c=!0),s=p}if(c)for(var h=0;h<i.length;h++){var m=u[i[h]];a[s].qValues.push(m)}}var v=Object.keys(a).map((function(e){return a[e]}));return function(){var e=an,t=ln;function n(n){var r,o,i,a,l,u,s,c=n.length,f=new Array(c),d={};for(o=0;o<c;++o)r=n[o],l=f[o]=new tn(r),null!=(u=e(r,o,n))&&(u+="")&&(d[s="$"+(l.id=u)]=s in d?on:l);for(o=0;o<c;++o)if(l=f[o],null!=(u=t(n[o],o,n))&&(u+="")){if(!(a=d["$"+u]))throw new Error("missing: "+u);if(a===on)throw new Error("ambiguous: "+u);a.children?a.children.push(l):a.children=[l],l.parent=a}else{if(i)throw new Error("multiple roots");i=l}if(!i)throw new Error("no root");if(i.parent=rn,i.eachBefore((function(e){e.depth=e.parent.depth+1,--c})).eachBefore(en),i.parent=null,c>0)throw new Error("cycle");return i}return n.id=function(t){return arguments.length?(e=nn(t),n):e},n.parentId=function(e){return arguments.length?(t=nn(e),n):t},n}().id((function(e){return e.__id})).parentId((function(e){return e.__parent}))(v)}var wn=function(e){for(var t=e.propsArr,n=e.props,r=e.cube,o=e.cache,i=e.itemDepthObject,a=e.f,l=0;l<t.length;l++)for(var u=n[t[l]],s=u.fields?u.fields:[u],c=0;c<s.length;c++){var f=s[c];if(f.field!==a){var d=yn(i,gn(f.field,{cube:r,cache:o}));f.accessor=d.nodeFn,f.valueAccessor=d.valueFn,f.attrAccessor=d.attrFn}}};function Mn(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,o=t.raw(),i=t.key(),a="S"===o.qMode?Dn(t):qn(o,n,e);if(!a)return null;for(var l=a.height,u=[],s=0;s<=l;s++){var c=null;if(s>0)if("S"===o.qMode){var f=vn(o),d=f[s-1];c=n.fields[d]}else{var p=o.qEffectiveInterColumnSortOrder[s-1];s>o.qEffectiveInterColumnSortOrder.length&&(p=o.qDimensionInfo.length),c=n.fields[p]}var h=r.normalizeConfig(Ot(Ot({},e),{},{field:c?c.key():void 0}),t),m=h.props,v=h.main,g=Object.keys(m);u[s]={propsArr:g,props:m,main:v};var y=c?gn(c,{cube:o,cache:n}):{fieldDepth:0};wn({propsArr:g,props:m,cube:o,cache:n,itemDepthObject:y,f:c})}for(var b=a.copy(),x=b.descendants(),q=a.descendants(),D=0;D<q.length;D++){var w=u[q[D].depth].propsArr,M=u[q[D].depth].props,C=u[q[D].depth].main,I=x[D],k=I.data,S=bn(C,k,{key:i});xn({propsArr:w,props:M,item:I,itemData:k,ret:S,sourceKey:i,isTree:!0}),q[D].data=S}return a}function Cn(e,t,n,r){for(var o=Array.isArray(e)?e:[e],i=[],a=0;a<o.length;a++)if(void 0!==o[a].field){var l=t.raw(),u=t.key();if(!qn(l,n,e))continue;var s="object"===Mt(o[a].field)?o[a].field:t.field(o[a].field),c=r.normalizeConfig(o[a],t),f=c.props,d=c.main,p=Object.keys(f),h=gn(s,{cube:l,cache:n}),m=yn({fieldDepth:0},h),v=m.nodeFn,g=m.attrFn,y=m.valueFn;wn({propsArr:p,props:f,cube:l,cache:n,itemDepthObject:h,f:s});for(var b=!!o[a].trackBy,x=Mt(o[a].trackBy),q={},D=[],w=v(n.tree),M=[],C=0;C<w.length;C++){var I=w[C],k=g?g(y(I)):y(I);if(!d.filter||d.filter(k)){var S=bn(d,k,{key:u});xn({propsArr:p,props:f,item:I,itemData:k,ret:S,sourceKey:u}),b&&r.track({cfg:o[a],itemData:k,obj:S,target:D,tracker:q,trackType:x}),M.push(S)}}b?i.push.apply(i,Tt(r.collect(D,{main:d,propsArr:p,props:f}))):i.push.apply(i,M)}return i}var In,kn=(function(e){
7
+ import e from"picasso.js";import t from"picasso-plugin-q";import{useElement as n,useSelections as r,useModel as o,useApp as i,useTranslator as a,useOptions as l,useState as u,useEffect as s,useStaleLayout as c,useTheme as f,useConstraints as d,useRect as p,usePlugins as h,useAppLayout as m,usePromise as v,onTakeSnapshot as g}from"@nebula.js/stardust";const y={fill:"steelblue",num:1},b=(e,t,n)=>{let r=0,o=0,i=0,a={},l=0;if("labelCenter"===e)r=t.bottomLeft.x,o=t.topRight.y,i=t.bottomRight.x-t.bottomLeft.x,l=t.bottomRight.y-t.topRight.y,a={share:n.share,fill:n.fill};else{const e=180/Math.PI*Math.atan((t.bottomRight.y-t.topRight.y)/(t.topRight.x-t.bottomRight.x));r=e<15&&e>=0?t.topRight.x:e>-15&&e<0?t.bottomRight.x:e<-15?(t.bottomRight.x-t.topRight.x)/2+t.topRight.x+15:(t.topRight.x-t.bottomRight.x)/2+t.bottomRight.x+15,o=t.topRight.y,i=t.width-r,l=t.bottomRight.y-t.topRight.y,a={fill:n.fill}}return{tag:e,type:"rect",x:r,y:o,width:i,height:l,data:n.data,desc:a,fill:"none"}},x=(e,t)=>{const n=(e=>{const t=(e=>{let t=0;return e.forEach((e=>{e.num>t&&(t=e.num)})),t})(e);let n=0;return e.slice().reverse().map((e=>{const r={datum:e,s:n/t,e:e.num/t};return n=e.num,r})).reverse()})(e),r=.9*t.width,o=.9*t.height,i=(t.width-r)/2,a=(t.height-o)/2,l=r-(r>150&&o>150?100:0),u=(o-1*(n.length-1))/n.length,s=[];return n.forEach(((e,r)=>{const o=(c=e.e,f=r<n.length-1?e.s:e.e,[.5-.5*c,.5+.5*c,.5+.5*f,.5-.5*f]).map((e=>Math.round(e*l+i)));var c,f;const d=u*r+1*r+a,p={bottomRight:{x:o[2],y:Math.round(d+u)},bottomLeft:{x:o[3],y:Math.round(d+u)},topRight:{x:o[1],y:Math.round(d)},topLeft:{x:o[0],y:Math.round(d)},width:t.width},h=`M${p.topLeft.x},${p.topLeft.y} L${p.topRight.x},${p.topRight.y} ${p.bottomRight.x},${p.bottomRight.y} ${p.bottomLeft.x},${p.bottomLeft.y}Z`;s.push({tag:"section",type:"path",d:h,data:e.datum.data,fill:e.datum.fill});const m={share:e.e,fill:e.datum.fill,data:e.datum.data};u>12&&(p.bottomRight.x-p.bottomLeft.x>32&&s.push(b("labelCenter",p,m)),s.push(b("labelLeft",p,m)))})),s},q=(e,t,n,r)=>(r-e)/r*(t-n)+n,D=(e,t,n)=>{const r=e.filter((e=>"NaN"!==e.num&&e.num>0)),o=r.length,i=.9*n.width,a=.9*n.height,l=Math.round((n.width-i)/2),u=Math.round((n.height-a)/2),s=i-(i>150&&a>150?100:0),c=a-1*(o-1),f=[],d=r[0].data.num.value;let p=u;return r.forEach(((e,r)=>{const o=t[r]*c,i=Math.round(q(p-u,s,.2*s,a)/2),h=Math.round(q(p-u+o,s,.2*s,a)/2),m=l+Math.round(s/2),v={bottomRight:{x:m+h,y:Math.round(p+o)},bottomLeft:{x:m-h,y:Math.round(p+o)},topRight:{x:m+i,y:p},topLeft:{x:m-i,y:p},width:n.width},g=`M${v.topLeft.x},${v.topLeft.y} L${v.topRight.x},${v.topRight.y} ${v.bottomRight.x},${v.bottomRight.y} ${v.bottomLeft.x},${v.bottomLeft.y}Z`;f.push({tag:"section",type:"path",d:g,data:e.data,fill:e.fill});const y={share:e.data.num.value/d,fill:e.fill,data:e.data};o>2&&(v.bottomRight.x-v.bottomLeft.x>32&&f.push(b("labelCenter",v,y)),f.push(b("labelLeft",v,y))),p+=o+1})),f},w=(e,t,n)=>{const r=e.filter((e=>"NaN"!==e.num&&e.num>0));if(r&&r.length>0)switch(t){case"WIDTH":return x(r,n);case"ORDER":return D(r,r.map((()=>1/r.length)),n);case"HEIGHT":return D(r,(e=>{const t=e.reduce(((e,t)=>e+t.data.num.value),0);return e.map((e=>e.data.num.value/t))})(r),n);case"AREA":return D(r,((e,t,n)=>{const r=e.reduce(((e,t)=>e+t.data.num.value),0),o=.9*t.width,i=.9*t.height,a=o*n,l=i*(o+a)/2,u=(o-a)/2/i,s=[];let c=0;for(let t=e.length-1;t>=0;t--){const n=e[t].data.num.value/r,o=2*u*c+a,f=-o/(2*u)+Math.sqrt(o*o/(4*u*u)+n*l/u);s[t]=f/i,c+=f}return s})(r,n,.2),n);default:return x(r,n)}return[]};var M={require:["resolver"],defaultSettings:{settings:{},data:{},style:{item:"$shape"}},render({data:e}){const t=this.resolver.resolve({data:e,defaults:{...y,...this.style.item},settings:this.settings.settings});return w(t.items,this.settings.settings.mode,this.rect)}};const C={version:"1.4.2",color:{auto:!0,autoMinMax:!0,byDimDef:void 0,byMeasureDef:void 0,colorExpression:void 0,dimensionScheme:"12",expressionIsColor:!0,expressionLabel:"",measureMin:void 0,measureMax:void 0,measureScheme:"sg",mode:"primary",paletteColor:{index:6},persistent:!1,reverseScheme:!1,singleColor:void 0,useBaseColors:"off",useDimColVal:!0,useMeasureGradient:!0},dataPoint:{auto:!0,labelMode:"share"},footnote:"",funnel:{mode:"WIDTH"},qHyperCubeDef:{qDimensions:[],qMeasures:[],qInterColumnSortOrder:[],qInitialDataFetch:[{qWidth:2,qHeight:5e3}],qSuppressMissing:!0,qSuppressZero:!1},showDimensionTitle:!0,showTitles:!0,subtitle:"",title:""};var I={definition:{type:"items",component:"accordion",items:{data:{uses:"data",items:{dimensions:{uses:"dimensions",items:{others:{items:{suppressOther:{defaultValue:!0,show:!1}}}},disabledRef:""},measures:{uses:"measures",disabledRef:""}}},sorting:{uses:"sorting"},settings:{uses:"settings",items:{presentation:{type:"items",label:"Presentation",grouped:!0,items:{funnelmode:{ref:"funnel.mode",label:"Funnel Mode",type:"string",component:"dropdown",options:[{value:"AREA",label:"Area"},{value:"HEIGHT",label:"Height"},{value:"WIDTH",label:"Width"},{value:"ORDER",label:"Ordering"}],defaultValue:"WIDTH"},dimensionTitle:{ref:"showDimensionTitle",type:"boolean",component:"switch",label:"Dimension label",defaultValue:!0,options:[{value:!0,label:"Auto"},{value:!1,label:"Off"}]},valuesAuto:{ref:"dataPoint.auto",type:"boolean",label:"Value labels",component:"switch",defaultValue:!0,options:[{value:!0,label:"Auto"},{value:!1,label:"Custom"}]},labelMode:{ref:"dataPoint.labelMode",type:"string",component:"dropdown",options:[{value:"none",label:"None"},{value:"share",label:"Share"},{value:"value",label:"Values"}],defaultValue:"share",show:e=>!e.dataPoint.auto}}},colorsAndLegend:{uses:"colorsAndLegend",translation:"Colors",items:{colors:{items:{colorByLabel:{show:!1},expressionLabel:{show:!1}}},legend:{show:!1}}}}}}},support:{export:!0,exportData:!0,snapshot:!0,viewData:!1},importProperties:null,exportProperties:null};const k=[{path:"/qHyperCubeDef",dimensions:{min:1,max:1,description:()=>"Segments"},measures:{min:1,max:1,description(e){switch(e.funnel.mode){case"WIDTH":return"Width";case"AREA":return"Area";case"HEIGHT":return"Height";case"ORDER":return"Order";default:return""}},added(e,t){2===t.qHyperCubeDef.qInterColumnSortOrder.length&&1!==t.qHyperCubeDef.qInterColumnSortOrder[0]&&(t.qHyperCubeDef.qInterColumnSortOrder=[1,0])}}}];function S(e){return(S="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})(e)}function A(e,t,n,r,o,i,a){try{var l=e[i](a),u=l.value}catch(e){return void n(e)}l.done?t(u):Promise.resolve(u).then(r,o)}function O(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){A(i,r,o,a,l,"next",e)}function l(e){A(i,r,o,a,l,"throw",e)}a(void 0)}))}}function N(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function E(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 P(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?E(Object(n),!0).forEach((function(t){N(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):E(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function T(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function j(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,i=void 0;try{for(var a,l=e[Symbol.iterator]();!(r=(a=l.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==l.return||l.return()}finally{if(o)throw i}}return n}}(e,t)||R(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 L(e){return function(e){if(Array.isArray(e))return F(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||R(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 R(e,t){if(e){if("string"==typeof e)return F(e,t);var n=Object.prototype.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)?F(e,t):void 0}}function F(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var H=Object.prototype.hasOwnProperty,V=Object.prototype.toString,_=Object.defineProperty,z=Object.getOwnPropertyDescriptor,B=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===V.call(e)},U=function(e){if(!e||"[object Object]"!==V.call(e))return!1;var t,n=H.call(e,"constructor"),r=e.constructor&&e.constructor.prototype&&H.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!r)return!1;for(t in e);return void 0===t||H.call(e,t)},$=function(e,t){_&&"__proto__"===t.name?_(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},K=function(e,t){if("__proto__"===t){if(!H.call(e,t))return;if(z)return z(e,t).value}return e[t]},W=function e(){var t,n,r,o,i,a,l=arguments[0],u=1,s=arguments.length,c=!1;for("boolean"==typeof l&&(c=l,l=arguments[1]||{},u=2),(null==l||"object"!=typeof l&&"function"!=typeof l)&&(l={});u<s;++u)if(null!=(t=arguments[u]))for(n in t)r=K(l,n),l!==(o=K(t,n))&&(c&&o&&(U(o)||(i=B(o)))?(i?(i=!1,a=r&&B(r)?r:[]):a=r&&U(r)?r:{},$(l,{name:n,newValue:e(c,a,o)})):void 0!==o&&$(l,{name:n,newValue:o}));return l};function Y(e,t){return{range:function(e){var n=e.resources,r=e.data,o=n.theme.palette("categorical",0===t?r.items.length:t);return r.items.map((function(e){return o[e.value%o.length]}))},valueAccessor:e.value}}function G(e,t){return{range:function(e){var n=e.resources,r=e.data,o=n.theme.palette("categorical",0===t?r.items.length:t);return r.items.map((function(e){return o[e.row.value%o.length]}))},valueAccessor:e.value}}function Z(e,t,n,r,o){var i,a=o.byRow,l=o.byElemNo;if(r&&(t.input.persistent||e.hc.qDimensionInfo.length>1||void 0===n.activeDimensionIndex&&e.hc.qSize.qcy>((null===(i=e.hc.qDataPages[0])||void 0===i?void 0:i.qArea.qHeight)||0)))return l(r,r.raw().qCardinal);if(r){var u=t.pic.extract({field:r.key(),trackBy:r.value}).length;return a(r,u)}return{}}function J(e,t){var n=e.hc.qDimensionInfo,r=t.input.byDimDef||{activeDimensionIndex:n.length-1};if(r.activeDimensionIndex>=0){var o=n[r.activeDimensionIndex];r=o.coloring&&o.coloring.colorMapRef?{type:"libraryItem",key:o.coloring.colorMapRef,activeDimensionIndex:r.activeDimensionIndex}:{activeDimensionIndex:r.activeDimensionIndex}}return r}function Q(e,t){var n;return t.activeDimensionIndex>=0?n=e.pic.fields().filter((function(e){return"dimension"===e.type()}))[t.activeDimensionIndex]:"libraryItem"===t.type?!1===(n=t.key?e.pic.field((function(e){return e.raw().colorMapRef===t.key})):void 0)&&(n=e.pic.field((function(e){return"colorByAlternative"===e.raw().id}))):"expression"===t.type&&(n=e.pic.field((function(e){return"colorByAlternative"===e.raw().id}))),n}function X(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function ee(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function te(){}var ne=1/.7,re="\\s*([+-]?\\d+)\\s*",oe="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",ie="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ae=/^#([0-9a-f]{3,8})$/,le=new RegExp("^rgb\\("+[re,re,re]+"\\)$"),ue=new RegExp("^rgb\\("+[ie,ie,ie]+"\\)$"),se=new RegExp("^rgba\\("+[re,re,re,oe]+"\\)$"),ce=new RegExp("^rgba\\("+[ie,ie,ie,oe]+"\\)$"),fe=new RegExp("^hsl\\("+[oe,ie,ie]+"\\)$"),de=new RegExp("^hsla\\("+[oe,ie,ie,oe]+"\\)$"),pe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function he(){return this.rgb().formatHex()}function me(){return this.rgb().formatRgb()}function ve(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=ae.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?ge(t):3===n?new qe(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?ye(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?ye(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=le.exec(e))?new qe(t[1],t[2],t[3],1):(t=ue.exec(e))?new qe(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=se.exec(e))?ye(t[1],t[2],t[3],t[4]):(t=ce.exec(e))?ye(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=fe.exec(e))?Ce(t[1],t[2]/100,t[3]/100,1):(t=de.exec(e))?Ce(t[1],t[2]/100,t[3]/100,t[4]):pe.hasOwnProperty(e)?ge(pe[e]):"transparent"===e?new qe(NaN,NaN,NaN,0):null}function ge(e){return new qe(e>>16&255,e>>8&255,255&e,1)}function ye(e,t,n,r){return r<=0&&(e=t=n=NaN),new qe(e,t,n,r)}function be(e){return e instanceof te||(e=ve(e)),e?new qe((e=e.rgb()).r,e.g,e.b,e.opacity):new qe}function xe(e,t,n,r){return 1===arguments.length?be(e):new qe(e,t,n,null==r?1:r)}function qe(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function De(){return"#"+Me(this.r)+Me(this.g)+Me(this.b)}function we(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===e?")":", "+e+")")}function Me(e){return((e=Math.max(0,Math.min(255,Math.round(e)||0)))<16?"0":"")+e.toString(16)}function Ce(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ke(e,t,n,r)}function Ie(e){if(e instanceof ke)return new ke(e.h,e.s,e.l,e.opacity);if(e instanceof te||(e=ve(e)),!e)return new ke;if(e instanceof ke)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),i=Math.max(t,n,r),a=NaN,l=i-o,u=(i+o)/2;return l?(a=t===i?(n-r)/l+6*(n<r):n===i?(r-t)/l+2:(t-n)/l+4,l/=u<.5?i+o:2-i-o,a*=60):l=u>0&&u<1?0:a,new ke(a,l,u,e.opacity)}function ke(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function Se(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}X(te,ve,{copy:function(e){return Object.assign(new this.constructor,this,e)},displayable:function(){return this.rgb().displayable()},hex:he,formatHex:he,formatHsl:function(){return Ie(this).formatHsl()},formatRgb:me,toString:me}),X(qe,xe,ee(te,{brighter:function(e){return e=null==e?ne:Math.pow(ne,e),new qe(this.r*e,this.g*e,this.b*e,this.opacity)},darker:function(e){return e=null==e?.7:Math.pow(.7,e),new qe(this.r*e,this.g*e,this.b*e,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:De,formatHex:De,formatRgb:we,toString:we})),X(ke,(function(e,t,n,r){return 1===arguments.length?Ie(e):new ke(e,t,n,null==r?1:r)}),ee(te,{brighter:function(e){return e=null==e?ne:Math.pow(ne,e),new ke(this.h,this.s,this.l*e,this.opacity)},darker:function(e){return e=null==e?.7:Math.pow(.7,e),new ke(this.h,this.s,this.l*e,this.opacity)},rgb:function(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,o=2*n-r;return new qe(Se(e>=240?e-240:e+120,o,r),Se(e,o,r),Se(e<120?e+240:e-120,o,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===e?")":", "+e+")")}}));var Ae=Math.PI/180,Oe=180/Math.PI,Ne=4/29,Ee=6/29,Pe=3*Ee*Ee;function Te(e){if(e instanceof je)return new je(e.l,e.a,e.b,e.opacity);if(e instanceof _e)return ze(e);e instanceof qe||(e=be(e));var t,n,r=He(e.r),o=He(e.g),i=He(e.b),a=Le((.2225045*r+.7168786*o+.0606169*i)/1);return r===o&&o===i?t=n=a:(t=Le((.4360747*r+.3850649*o+.1430804*i)/.96422),n=Le((.0139322*r+.0971045*o+.7141733*i)/.82521)),new je(116*a-16,500*(t-a),200*(a-n),e.opacity)}function je(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}function Le(e){return e>.008856451679035631?Math.pow(e,1/3):e/Pe+Ne}function Re(e){return e>Ee?e*e*e:Pe*(e-Ne)}function Fe(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function He(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Ve(e){if(e instanceof _e)return new _e(e.h,e.c,e.l,e.opacity);if(e instanceof je||(e=Te(e)),0===e.a&&0===e.b)return new _e(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*Oe;return new _e(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function _e(e,t,n,r){this.h=+e,this.c=+t,this.l=+n,this.opacity=+r}function ze(e){if(isNaN(e.h))return new je(e.l,0,0,e.opacity);var t=e.h*Ae;return new je(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}function Be(e){return function(){return e}}function Ue(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):Be(isNaN(e)?t:e)}X(je,(function(e,t,n,r){return 1===arguments.length?Te(e):new je(e,t,n,null==r?1:r)}),ee(te,{brighter:function(e){return new je(this.l+18*(null==e?1:e),this.a,this.b,this.opacity)},darker:function(e){return new je(this.l-18*(null==e?1:e),this.a,this.b,this.opacity)},rgb:function(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,n=isNaN(this.b)?e:e-this.b/200;return new qe(Fe(3.1338561*(t=.96422*Re(t))-1.6168667*(e=1*Re(e))-.4906146*(n=.82521*Re(n))),Fe(-.9787684*t+1.9161415*e+.033454*n),Fe(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}})),X(_e,(function(e,t,n,r){return 1===arguments.length?Ve(e):new _e(e,t,n,null==r?1:r)}),ee(te,{brighter:function(e){return new _e(this.h,this.c,this.l+18*(null==e?1:e),this.opacity)},darker:function(e){return new _e(this.h,this.c,this.l-18*(null==e?1:e),this.opacity)},rgb:function(){return ze(this).rgb()}}));var $e=function e(t){var n=function(e){return 1==(e=+e)?Ue:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}(t,n,e):Be(isNaN(t)?n:t)}}(t);function r(e,t){var r=n((e=xe(e)).r,(t=xe(t)).r),o=n(e.g,t.g),i=n(e.b,t.b),a=Ue(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=o(t),e.b=i(t),e.opacity=a(t),e+""}}return r.gamma=e,r}(1),Ke=/^class(-pyramid)?/,We=function(e,t,n,r){var o=void 0!==n.min?n.min:r.min(),i=void 0!==n.max?n.max:r.max(),a=o,l=i,u=t.limits,s={},c="percent"===t.limitType?u.map((function(e){return o+(i-o)*e})):u,f=t.colors.map((function(t){return e.resolveUIColor(t)}));if(o=Math.min.apply(Math,[o].concat(L(c))),i=Math.max.apply(Math,[i].concat(L(c))),s.min=o,s.max=i,t.breakTypes&&-1===t.breakTypes.indexOf(!0))s.type="categorical",Object.assign(s,function(e){var t=e.min,n=e.max,r=e.limits,o=e.range,i=[],a=[];if(r.length)if(r[r.length-1]<t)a.push(t,n),i.push(o[o.length-1],o[o.length-1],o[o.length-1]);else if(r[0]>n)a.push(t,n),i.push(o[0],o[0],o[0]);else{if(r[0]>t)a.push(t),i.push(o[0]);else{a.push(t);for(var l=0;l<r.length;l++)if(t<r[l]){i.push(o[l]);break}}for(var u=0;u<r.length;u++)t<r[u]&&r[u]<n&&(a.push(r[u]),i.push(o[u]));if(r[r.length-1]<n)a.push(n),i.push(o[r.length]),i.push(o[r.length]);else{a.push(n);for(var s=0;s<r.length;s++)if(r[s]>n){i.push(o[s]),i.push(o[s]);break}}}else i.push(o[0]);return{min:t,max:n,range:i,domain:a}}({min:"percent"===t.limitType?o:a,max:"percent"===t.limitType?i:l,range:f,limits:"percent"===t.limitType?c:u}));else if(t.breakTypes){var d=t.breakTypes;s.type="continuous",s.domain=[o],s.range=[f[0]];for(var p=0;p<c.length;p+=1)if(d[p]){var h=f[p],m=f[p+1],v=$e(h,m)(.5);s.range.push(v),s.domain.push(c[p]),p<c.length-1&&d[p+1]&&(s.range.push(f[p+1]),s.domain.push((c[p]+c[p+1])/2))}else s.range.push(f[p]),s.range.push(f[p+1]),s.domain.push(c[p]),s.domain.push(c[p]+Math.min(1e-6,(i-o)/1e6));s.range.push(f[f.length-1]),s.domain.push(i)}else s.domain=c,s.range=f;return s};function Ye(e,t,n,r,o){var i,a,l,u=0,s=[],c=(e-t)/(r+1);if(0===c)return 1;for(i=0;i<n.length;i+=1)a=.99*(n[i]-t),l=n[i]>e?Math.floor(e/c):n[i]<t?0:Math.floor(a/c),Number.isNaN(l)||(s[l]?s[l]+=1:s[l]=1);for(i=0;i<s.length;i+=1)s[i]&&(u+=1);return u<=r||u>=o?Math.max(u,r):Ye(e,t,n,r+1,o)}var Ge=function(e,t,n,r){var o,i,a=t.theme,l=t.hc,u=r.f,s={mode:"field",fieldType:"measure",field:u?u.key():void 0,reverse:n.input.reverseScheme||!1,type:"continuous",range:function(e){return e.resources.theme.palette("quant")}},c=[],f=!0;if(u){if(Number.isNaN(+u.min())||Number.isNaN(+u.max()))return{invalid:!0};(f=!("S"===(o=n.pic.raw()).qMode&&(o.qDataPages[0]&&o.qSize.qcy>o.qDataPages[0].qArea.qHeight||!o.qDataPages.length&&o.qSize.qcy>0)||"K"===o.qMode&&o.qStackedDataPages[0]&&o.qSize.qcy>o.qStackedDataPages[0].qArea.qHeight||"T"===o.qMode&&o.qSize.qcy>o.qTreeDataPages[0].qGroupSize))&&(c=n.pic.extract({field:0,props:{num:{field:u.key()},exclude:{fields:l.qDimensionInfo.map((function(e,t){return{field:"qDimensionInfo/".concat(t)}})),value:function(e){return Math.min.apply(Math,L(e))<0}}}}).filter((function(e){return e.value>=0&&!e.exclude.value})).map((function(e){return e.num.value})).filter((function(e){return"number"==typeof e})))}if(!1===n.input.autoMinMax){if(s.min=n.input.measureMin,s.max=n.input.measureMax,s.max<s.min)return{invalid:!0}}else if(u&&!f)s.min=u.min(),s.max=u.max();else if(u){if(!c.length)return{invalid:!0};s.min=Math.min.apply(Math,L(c)),s.max=Math.max.apply(Math,L(c))}if(n.input.measureScheme&&(s.palettes={quant:n.input.measureScheme}),a){var d=a.getDataColorScales().filter((function(e){return e.key===n.input.measureScheme}))[0];s.type=d&&Ke.test(d.type)?"categorical":"continuous","categorical"===s.type&&(i=d.colors.some((function(e){return Array.isArray(e)}))?Math.max.apply(Math,L(d.colors.map((function(e){return e?e.length:0})))):d.colors.length)}if("categorical"===s.type){for(var p=f?Ye(s.max,s.min,c,1,i):i,h=(s.max-s.min)/p,m=[],v=0;v<p+1;v+=1)m.push(s.min+h*v);s.domain=m,s.range=function(e){for(var t=e.resources.theme.palette("quant",p),n=Math.max(1,Math.floor(t.length/p)),r=[],o=0;o<p;o+=1)r.push(t[o*n]);return[r[0]].concat(r,[r[r.length-1]])}}return s};function Ze(e,t){var n;return t.activeMeasureIndex>=0?n=e.pic.fields().filter((function(e){return"measure"===e.type()}))[t.activeMeasureIndex]:"libraryItem"===t.type?n=e.pic.field((function(e){return e.raw().colorMapRef===t.key&&void 0!==t.key})):"expression"===t.type&&(n=e.pic.field((function(e){return"colorByAlternative"===e.raw().id}))),n||(n=e.pic.field((function(e){return void 0!==e.raw().matchMeasure})))&&(n=e.pic.fields().filter((function(e){return"measure"===e.type()}))[n.raw().matchMeasure]),n}function Je(e){var t,n=e.cm,r=e.defaults,o=e.index,i=e.input,a=e.pic;if(!i||!i.on)return null;var l=null!==(t=i.mode)&&void 0!==t?t:"primary";return"primary"===l?function(e,t,n){var r=n.primary;return void 0!==t.paletteColor&&t.paletteColor&&(r=e.resolveUIColor(t.paletteColor)),P(P({},n),{},{mode:"constant",type:"constant",primary:r})}(n,i,r):"byExpression"===l?function(e,t,n){var r="qMeasureInfo/".concat(e,"/"),o=t.field((function(e){return e.id().startsWith(r)&&"colorByMeasureExpression"===e.raw().id})),i=o;return P(P({},n),{},i?{mode:"field",fieldType:"expression",field:o?o.key():void 0,type:"color"}:{mode:"constant",type:"constant",primary:n.nil})}(o,a,r):null}function Qe(e){e.measureOverrides.every((function(e){return!e}))&&(e.measureOverrides=null)}function Xe(e,t){for(var n=(null==t?void 0:t.domain)||[],r=(null==t?void 0:t.range)||[],o=[],i=0;i<e.length;++i){var a=e[i];if("constant"===(null==a?void 0:a.mode)){var l=n.indexOf(i);-1===l?(n.push(i),r.push(a.primary)):r[l]=a.primary,e[i]=null}else if(a){o.push(i);var u=n.indexOf(i);-1!==u&&(n.splice(u,1),r.splice(u,1))}}return{domain:n,range:r,exclude:o}}function et(e,t,n,r){var o,i=function(e,t,n,r){if(t.input&&!t.input.auto){if("byMeasure"===t.input.mode)return function(e,t,n){var r=t.theme,o=t.hc,i=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).getCField,a=void 0===i?Ze:i,l=n.input.byMeasureDef||{activeMeasureIndex:0},u=a(n,l),s=Ge(0,{theme:r,hc:o},n,{f:u});if(s.invalid)return s;("expression"===l.type||l.activeMeasureIndex<0)&&(s.label=l.label,u&&"color.altLabel"===u.raw().labelExpRef&&(s.label=n.input.altLabel)),!s.label&&u&&(s.label=u.title());var c=l.activeMeasureIndex>=0?u:null;if(!c&&u&&void 0!==u.raw().matchMeasure&&u.raw().matchMeasure>-1&&(c=n.pic.fields().filter((function(e){return"measure"===e.type()}))[u.raw().matchMeasure]),n.input.useMeasureGradient&&"libraryItem"===l.type)if(c){var f=c.raw().coloring;f&&f.gradient&&W(s,We(e,f.gradient,s,c))}else s.auxiliary=l;return s}(e,n,t);if("byDimension"===t.input.mode)return function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=r.getCDef,i=void 0===o?J:o,a=r.getCByField,l=void 0===a?Q:a,u=r.getPersistence,s=void 0===u?Z:u,c=i(t,n),f=l(n,c),d=f?f.raw():{},p=n&&n.pic?n.pic.raw():{};if(d.qError||d.qSize&&0===d.qSize.qcy&&!p.qHasOtherValues)return{invalid:!0};var h={mode:"field",fieldType:"dimension",type:"categorical",field:f?f.key():void 0,isFieldLocked:d.qLocked};return("expression"===c.type||c.activeDimensionIndex<0)&&(h.label=c.label,"color.altLabel"===d.labelExpRef&&(h.label=n.input.altLabel)),!h.label&&f&&(h.label=f.title()),n.input.dimensionScheme&&(h.palettes={categorical:n.input.dimensionScheme}),n.input.useDimColVal&&"libraryItem"===c.type&&(h.auxiliary=c),W(h,s(t,n,c,f,{byRow:G,byElemNo:Y})),h}(e,n,t);if("byExpression"===t.input.mode)return function(e,t,n,r){var o=t.hc,i=t.theme,a=t.translator,l=n.pic.field((function(e){return"colorByExpression"===e.raw().id}));if(!l||!l.raw().qFallbackTitle&&!n.input.colorExpression||!(Number.isFinite(l.raw().qMin)&&Number.isFinite(l.raw().qMax)||n.input.expressionIsColor))return{mode:"constant",type:"constant",primary:r.nil};if(n.input.expressionIsColor)return{mode:"field",fieldType:"expression",field:l?l.key():void 0,type:"color"};var u=Ge(0,{hc:o,theme:i},n,{f:l});return u.invalid||(u.label=n.input.expressionLabel||a.get("Object.ChartTooltip.ColorExpression")),u}(0,n,t,r);if("byMultiple"===t.input.mode||"primary"===t.input.mode)return function(e,t,n,r){var o=t.hc,i=t.theme,a=t.translator,l=n.input.useBaseColors;if(("byMultiple"===n.input.mode||"primary"===n.input.mode&&"measure"===n.input.useBaseColors)&&o.qMeasureInfo.length>1&&(l="measure"),"measure"===l){var u=[],s=[];"measure"===n.input.useBaseColors&&o.qMeasureInfo.forEach((function(t,n){if(t.baseColor||t.coloring&&t.coloring.baseColor){u.push(n);var o=e.resolveUIColor(t.baseColor||t.coloring.baseColor);"none"===o?s.push(r.primary):s.push(o)}}));var c=n.input.dimensionScheme?{categorical:n.input.dimensionScheme}:void 0,f=i?i.getDataColorPalettes()[0]:void 0;return"measure"===n.input.useBaseColors&&f&&(c={categorical:f.key}),{mode:"measure",type:"categorical",palettes:c,label:a?a.get("Common.Measures"):void 0,explicit:u.length?{domain:u,range:s}:void 0}}if("dimension"===l){var d=[],p=[];return o.qDimensionInfo.forEach((function(t,n){if(t.baseColor||t.coloring&&t.coloring.baseColor){d.push(n);var o=e.resolveUIColor(t.baseColor||t.coloring.baseColor);"none"===o?p.push(r.primary):p.push(o)}})),{mode:"dimension",type:"categorical",field:d.length?d[0]:void 0,explicit:d.length?{domain:d,range:p}:void 0}}var h=r.primary;if(void 0!==n.input.paletteColor)n.input.paletteColor&&(h=e.resolveUIColor(n.input.paletteColor));else{var m=n.input.singleColor;"number"!=typeof m||Number.isNaN(m)||(h=["#b0afae","#7b7a78","#545352","#4477aa","#7db8da","#b6d7ea","#46c646","#f93f17","#ffcf02","#276e27","#ffffff","#000000"][m])}return{mode:"constant",type:"constant",primary:h}}(e,n,t,r)}return{}}(e,t,n,r);return null!==(o=t.input)&&void 0!==o&&o.measureOverrides?(i.measureOverrides=t.input.measureOverrides.map((function(n,o){return Je({cm:e,input:n,defaults:r,index:o,pic:t.pic})})),function(e,t){var n,r,o,i=t.translator;if(Qe(e),1===(null===(n=e.measureOverrides)||void 0===n?void 0:n.length))return e.measureOverrides[0];if("measure"===e.mode&&e.measureOverrides&&(e.explicit=Xe(e.measureOverrides,e.explicit),Qe(e)),null!==(r=e.measureOverrides)&&void 0!==r&&r.every((function(e){return"constant"===(null==e?void 0:e.mode)}))){var a={mode:"measure",type:"categorical",label:null==i?void 0:i.get("Common.Measures")};return a.explicit=Xe(e.measureOverrides),a}return null!==(o=e.measureOverrides)&&void 0!==o&&o.every((function(e){return e}))?{invalid:!0,measureOverrides:e.measureOverrides}:e}(i,n)):i}function tt(e){var t=P({hc:null,colorProps:null,layout:null,theme:null},e),n={},r={auto:function(){return{mode:"primary"}},getDimensionColorMap:function(){return Promise.reject()},getMeasure:function(){return Promise.reject()},getAttributeDimension:function(){return Promise.reject()}},o={auto:function(e){return e?(r.auto=e,o):r.auto},getDimensionColorMap:function(e){return e?(r.getDimensionColorMap=e,o):r.getDimensionColorMap},getAttributeDimension:function(e){return e?(r.getAttributeDimension=e,o):r.getAttributeDimension},getMeasure:function(e){return e?(r.getMeasure=e,o):r.getMeasure},set:function(e){var o;if(!e.colorProps)throw new Error('Missing "colorProps"');if(W(t,e),(n={pic:t.picasso.data("q")({data:t.hc,config:{localeInfo:t.localeInfo}}),input:t.colorProps}).input.auto){var i=r.auto(e.layout);n.input=W(!0,{},n.input,i,{auto:!1});var a=t.theme?t.theme.getDataColorPalettes():[];a[0]&&(n.input.dimensionScheme=a[0].key);var l=0;n.input.byDimDef&&+n.input.byDimDef.activeDimensionIndex>=0&&(l=+n.input.byDimDef.activeDimensionIndex),t.hc&&t.hc.qDimensionInfo[l]&&t.hc.qDimensionInfo[l].coloring&&t.hc.qDimensionInfo[l].coloring.colorMapRef&&n.input.byDimDef&&(n.input.byDimDef.type="libraryItem",n.input.byDimDef.key=t.hc.qDimensionInfo[l].coloring.colorMapRef)}null!==(o=n.input.measureOverrides)&&void 0!==o&&o.every((function(e){return!e||!e.on}))&&(n.input=W(!1,{},n.input,{measureOverrides:null}))},palettes:function(){if(!n.palettes){var e=t.theme,r=[];(e&&e.getDataColorPickerPalettes()||[]).forEach((function(e){r.push({key:"ui",colors:e.colors})})),n.palettes=r}return n.palettes},getAuxiliaryData:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/qHyperCubeDef";if(!e.auxiliary&&!/qAttrDimInfo/.test(e.field))return Promise.resolve();var o=e.auxiliary||{},i=o.key;if("measure"===e.fieldType)return r.getMeasure(i,t).catch((function(){}));if("dimension"===e.fieldType){var a="".concat(n,"/").concat(e.field).replace("qDimensionInfo","qDimensions").replace("qAttrDimInfo","qAttributeDimensions");return Promise.all([/qAttrDimInfo/.test(e.field)?r.getAttributeDimension(a,t).catch((function(){})):Promise.resolve(),i?r.getDimensionColorMap(i,t).catch((function(){})):Promise.resolve()])}return Promise.resolve()},getAuxiliarySettings:function(e,r){var o=this;return e.auxiliary||/qAttrDimInfo/.test(e.field)?(this.palettes(),this.getAuxiliaryData(e,r).then((function(r){if(!r)return{};if("measure"===e.fieldType){if(r.coloring&&r.coloring.gradient){var i=n.pic.field(e.field);return We(o,r.coloring.gradient,e,i)}return{}}if("dimension"===e.fieldType){var a={nil:e.nil,others:e.others},l=r[0],u=r[1]?r[1].colorMap:null;if(l){var s=t.picasso.data("q")({data:{qDimensionInfo:[n.pic.field(e.field).raw(),n.pic.field(e.field).raw()],qMeasureInfo:[],qDataPages:l,qInterColumnSortOrder:[0,1],qMode:"S"}});a.legendDataset=s}return u?function(e,t,n,r){var o=r.external,i=r.field,a=P({},e);W(a,Y(i,i.raw().qCardinal));var l=o.theme?o.theme.getDataColorPalettes()[0]:null;return t.nul&&(a.nil=n.resolveUIColor(t.nul)),t.oth&&(a.others=n.resolveUIColor(t.oth)),t.usePal?(a.palettes={categorical:t.pal},l&&!t.pal&&(a.palettes.categorical=l.key,W(a,Y(i)))):!1===t.autoFill&&t.single?a.range=[n.resolveUIColor(t.single)]:t.autoFill&&(l&&(a.palettes={categorical:l.key}),W(a,Y(i))),t.colors&&t.colors.length&&(a.explicit=function(e,t,n){for(var r={},o=0;o<e.length;o+=1)r[e[o].value]=e[o].baseColor;var i=[];return{domain:function(e){var o=e.data,a=[];i=[];for(var l=0;l<o.items.length;l++){var u=o.items[l],s=(u.text||u).label;r[s]&&-1===a.indexOf(u.value)&&(a.push(u.value),i.push(t.resolveUIColor(r[s])))}return a.push(-3,-2),i.push(n.others),i.push(n.nil),a},range:function(){return i}}}(t.colors,n,a)),a}(a,u,o,{external:t,field:n.pic.field(e.field)}):a}return{}}))):Promise.resolve()},resolveUIColor:function(e){if(e.index<0||void 0===e.index)return e.color;if(void 0===n.uiPalette&&(n.uiPalette=this.palettes().filter((function(e){return"ui"===e.key}))[0]||!1),!n.uiPalette)return e.color;var t="none"===n.uiPalette.colors[0]?e.index:e.index-1;return void 0===n.uiPalette.colors[t]?e.color:n.uiPalette.colors[t]},settings:function(){if(this.palettes(),!n.settings){var e={primary:"steelblue",others:"#aaa",nil:"#ddd"},r=t.theme;r&&(e=P(P({},e),r.getDataColorSpecials())),n.settings=W(e,et(this,n,t,e))}return n.settings}};return o}var nt=function(e,t){var n=e.fieldType,r={};if(t)if("measure"===n){var o=t.coloring;o&&(r.measureGradient=o.gradient)}else if("dimension"===n){var i=t[0],a=t[1];i&&(r.legendDataPage=i),a&&(r.dimValsData=a.colorMap)}return r},rt=function(e){throw e.isHandled=!0,e},ot=function(e,t){var n=t.layout,r=t.app;return n&&n.snapshotData?n.snapshotData.content&&n.snapshotData.content.chartData&&n.snapshotData.content.chartData.dimValsData?Promise.resolve({colorMap:n.snapshotData.content.chartData.dimValsData}):Promise.reject():r&&r.getObject?r.getObject("ColorMapModel_".concat(e)).then((function(e){return e.getLayout()})):Promise.reject()},it=function(e,t){var n=t.layout,r=t.app;return n&&n.snapshotData?n.snapshotData.content&&n.snapshotData.content.chartData&&n.snapshotData.content.chartData.measureGradient?Promise.resolve({coloring:{gradient:n.snapshotData.content.chartData.measureGradient}}):Promise.reject():r&&r.getMeasure?r.getMeasure(e).then((function(e){return e.getMeasure()})):Promise.reject()},at=function(e,t){var n=t.layout,r=t.model,o=t.app;return n&&n.snapshotData?n.snapshotData.content&&n.snapshotData.content.chartData&&n.snapshotData.content.chartData.legendDataPage?Promise.resolve(n.snapshotData.content.chartData.legendDataPage):Promise.reject():r&&r.session&&o?r.getHyperCubeData(e,[{qHeight:100,qLeft:0,qTop:0,qWidth:2}]).catch(rt):Promise.reject()};function lt(e){var t=e.hc,n=e.source,r=e.coloring,o={data:{extract:[{source:"dummy",field:0,filter:function(){return o.expando=t.qDataPages[0]?t.qDataPages[0].qArea.qTop:0,!1}},{source:n,field:r.field,trackBy:r.valueAccessor,reduce:"first",props:{row:{reduce:function(){return o.expando++}},text:{value:function(e){return e.qText},reduce:"first"}}}]},expando:0};return o}function ut(e){return function(t){return"object"===S(t.datum[e])?t.datum[e].value:void 0}}function st(e){return"object"===S(e.datum.isNull)?e.datum.isNull.value:-2===e.datum.value}function ct(e){return-3===e.datum.value}var ft=function(e,t,n){var r=e&&e.dock||void 0;if("auto"!==r)return r||"right";if(t){var o=t.element.getBoundingClientRect();if(o.height>o.width)return"bottom"}return n?"left":"right"},dt=function(e,t,n){return!(n.invalid||"color"===n.type||"measure"===n.mode&&t.qMeasureInfo.length<=1||"dimension"===n.mode)&&("function"==typeof e.show?e.show():!1!==e.show)};function pt(e,t){var n=e.styleReference,r=e.chart,o=e.rtl,i=t.legendProps,a=t.coloring,l=t.theme,u=t.hc;return{layout:{minimumLayoutMode:"MEDIUM",dock:ft(i,r,o)},show:"function"==typeof i.show?function(){return dt(i,u,a)}:dt(i,u,a),renderer:"svg",mounted:function(e){e.childNodes[0].style.pointerEvents="none",e.style.overflow="hidden"},settings:{title:{show:!1!==i.showTitle,wordBreak:"break-word",maxLines:2,lineHeight:1.2,text:a.label||"",fill:l?l.getStyle(n,"legend.title","color"):void 0,fontSize:l?l.getStyle(n,"legend.title","fontSize"):"16px",fontFamily:l?l.getStyle(n,"legend.title","fontFamily"):"QlikView Sans, sans-serif"}}}}function ht(e,t,n){var r=[],o=[],i=function(e,t,n){return"categorical"===t.coloring.type?function(e,t,n){var r=pt(e,t);if(!r.show)return!1;var o=e.key,i=e.styleReference,a=e.viewState,l=e.rtl,u=e.settings,s=e.style,c=t.scaleKey,f=t.theme,d=t.scales,p={up:"M13.6,11 L2.4,11 C2.28954305,11 2.2,10.9104569 2.2,10.8 C2.2,10.756726 2.21403557,10.7146192 2.24,10.68 L7.84,3.21333333 C7.90627417,3.12496777 8.03163444,3.10705916 8.12,3.17333333 C8.13516113,3.18470418 8.14862915,3.1981722 8.16,3.21333333 L13.76,10.68 C13.8262742,10.7683656 13.8083656,10.8937258 13.72,10.96 C13.6853808,10.9859644 13.643274,11 13.6,11 Z",down:"M2.4,4 L13.6,4 C13.7104569,4 13.8,4.08954305 13.8,4.2 C13.8,4.24327404 13.7859644,4.28538077 13.76,4.32 L8.16,11.7866667 C8.09372583,11.8750322 7.96836556,11.8929408 7.88,11.8266667 C7.86483887,11.8152958 7.85137085,11.8018278 7.84,11.7866667 L2.24,4.32 C2.17372583,4.23163444 2.19163444,4.10627417 2.28,4.04 C2.31461923,4.01403557 2.35672596,4 2.4,4 Z",left:"M11,2.4 L11,13.6 C11,13.7104569 10.9104569,13.8 10.8,13.8 C10.756726,13.8 10.7146192,13.7859644 10.68,13.76 L3.21333333,8.16 C3.12496777,8.09372583 3.10705916,7.96836556 3.17333333,7.88 C3.18470418,7.86483887 3.1981722,7.85137085 3.21333333,7.84 L10.68,2.24 C10.7683656,2.17372583 10.8937258,2.19163444 10.96,2.28 C10.9859644,2.31461923 11,2.35672596 11,2.4 Z",right:"M4,13.6 L4,2.4 C4,2.28954305 4.08954305,2.2 4.2,2.2 C4.24327404,2.2 4.28538077,2.21403557 4.32,2.24 L11.7866667,7.84 C11.8750322,7.90627417 11.8929408,8.03163444 11.8266667,8.12 C11.8152958,8.13516113 11.8018278,8.14862915 11.7866667,8.16 L4.32,13.76 C4.23163444,13.8262742 4.10627417,13.8083656 4.04,13.72 C4.01403557,13.6853808 4,13.643274 4,13.6 Z"},h="".concat(c,"Legend");return W(!0,r,{type:"legend-cat",key:"".concat(o,"-cat"),scale:h in d?h:c,settings:{layout:{scrollOffset:function(){return a?a.get("legendScrollOffset"):void 0},size:-1!==["top","bottom"].indexOf(r.layout.dock)?2:1,direction:l?"rtl":"ltr",horizontal:20},item:{show:function(e){return-2!==e.datum.value},label:{fill:f?f.getStyle(i,"legend.label","color"):void 0,fontSize:f?f.getStyle(i,"legend.label","fontSize"):void 0,fontFamily:f?f.getStyle(i,"legend.label","fontFamily"):"QlikView Sans, sans-serif"}},navigation:{disabled:n,button:{content:function(e,t){var n=t.direction;return e("i",{style:{"pointer-events":"none",fontSize:"12px",display:"inline-block",fontStyle:"normal",lineHeight:"0",textAlign:"center",textTransform:"none",verticalAlign:"-0.125em",textRendering:"optimizelegibility",margin:"0px"}},[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 16 16",fill:"currentColor"},[e("path",{d:p[n]})])])}}}},brush:{consume:[{context:"selection",data:["",o],style:{inactive:{opacity:.3}}}]}},{settings:u,style:s})}(e,t,n):"continuous"===t.coloring.type&&function(e,t){var n=e.key,r=e.styleReference,o=e.rtl,i=e.settings,a=e.style,l=t.scaleKey,u=t.theme,s=pt(e,t);return!!s.show&&W(!0,s,{type:"legend-seq",key:"".concat(n,"-seq"),settings:{fill:l,major:"".concat(l,"Range"),length:1,tick:{fill:u?u.getStyle(r,"legend.label","color"):void 0,fontSize:u?u.getStyle(r,"legend.label","fontSize"):void 0,fontFamily:u?u.getStyle(r,"legend.label","fontFamily"):"QlikView Sans, sans-serif"},title:{anchor:!o||"top"!==s.layout.dock&&"bottom"!==s.layout.dock?void 0:"right",padding:parseFloat(s.settings.title.fontSize)||16}}},{settings:i,style:a})}(e,t)}(e,t,n&&n.navigationDisabled);return r.push(i),i&&"legend-cat"===i.type&&(o.push(function(e){var t=e.key,n=e.requireFailure,r=e.recognizeWith,o=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).actions;return{key:"event:tap-".concat(t),type:"Tap",requireFailure:n,recognizeWith:r,options:{event:"legendtap",interval:10,pointers:1,enable:function(e,n){var r;if(!n)return!0;if(null!=o&&null!==(r=o.interact)&&void 0!==r&&r.enabled&&!o.interact.enabled())return!1;if(!this.chart.componentsFromPoint({x:n.center.x,y:n.center.y}).some((function(e){return e.key==="".concat(t,"-cat")})))return!1;var i=n.srcEvent.target;return!!(i&&i.hasAttribute("data-action")&&i.hasAttribute("data-component-key"))||!(!i||!i.childNodes[0]||"BUTTON"!==i.childNodes[0].nodeName)}},events:{legendtap:function(e){e.preventDefault();var t=e.srcEvent.target;t&&t.hasAttribute("data-action")&&t.hasAttribute("data-component-key")&&this.chart.component(t.getAttribute("data-component-key")).emit(t.getAttribute("data-action"))}}}}(e,n)),o.push(function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.eventName,r=t.key,o=t.requireFailure,i=t.recognizeWith,a=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).actions;return{key:"event:pan-".concat(r),type:"Pan",requireFailure:o,recognizeWith:i,options:{event:n,pointers:1,threshold:10,enable:function(e,t){var o;return this.started===n||!t||!(null!=a&&null!==(o=a.interact)&&void 0!==o&&o.enabled&&!a.interact.enabled())&&this.chart.componentsFromPoint({x:t.center.x,y:t.center.y}).some((function(e){return e.key==="".concat(r,"-cat")}))}},events:(e={},N(e,"".concat(n,"start"),(function(e){e.preventDefault(),this.started!==n&&(this.started=n,this.chart.component("".concat(r,"-cat")).emit("panstart",e))})),N(e,"".concat(n,"move"),(function(e){e.preventDefault(),this.chart.component("".concat(r,"-cat")).emit("panmove",e)})),N(e,"".concat(n,"end"),(function(e){e.preventDefault(),this.chart.component("".concat(r,"-cat")).emit("panend",e),this.started=!1})),e)}}(e,n))),{interactions:o,components:r}}var mt=function(e){return"rgba(".concat([(16711680&e)>>16,(65280&e)>>8,255&e,((4278190080&e)>>>24)/255].join(","),")")};function vt(e){var t=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.auto,n=tt(e.resources).auto(t||function(){return{mode:"byDimension",persistent:!1,useDimColVal:!0,byDimDef:{activeDimensionIndex:0,type:"expression",label:""}}}).getDimensionColorMap((function(e,t){var n=t.layout,r=t.app;return ot(e,{layout:n,app:r})})).getMeasure((function(e,t){var n=t.layout,r=t.app;return it(e,{layout:n,app:r})})).getAttributeDimension((function(e,t){var n=t.layout,r=t.model,o=t.app;return at(e,{layout:n,model:r,app:o})}));return n.getSnapshotData=nt,n}({resources:e}),n={},r={},o=function(e){return r.settings||(e||console.warn("settings() called before auxiliarySettings()"),r.settings=t.settings()),r.settings},i={config:function(o){if(n=P({},o),r={},!n.key)throw new Error("Missing key");t.set(P(P({},e),n))},auto:function(e){return e?(t.auto(e),i):t.auto()},getAuxiliarySettings:function(e){return r.auxiliarySettings?Promise.resolve(r.auxiliarySettings):t.getAuxiliarySettings(o(!0),e).then((function(e){return r.auxiliarySettings=e||{},r.settings=P(P({},r.settings),r.auxiliarySettings),r.scales=void 0,r.color=void 0,r.auxiliarySettings}))},getAuxiliaryData:function(){return t.getAuxiliaryData(o())},getSnapshotData:function(e){var n=o();return t.getAuxiliaryData(n,e).then((function(e){return t.getSnapshotData(n,e)}))},resolveUIColor:function(e){return t.resolveUIColor(e)},settings:function(){var e=o();return{mode:e.mode,type:e.type,label:e.label,field:e.field,fieldType:e.fieldType,nil:e.nil,others:e.others,primary:e.primary}},settingsForMeasure:function(e){var t;return(null===(t=o().measureOverrides)||void 0===t?void 0:t[e])||this.settings()},isSelectionLocked:function(e){var t=e.isMeasureSelectionLocked;return function(e,t){var n=t.isMeasureSelectionLocked;return"field"!==e.mode||("dimension"===e.fieldType?e.isFieldLocked:"measure"!==e.fieldType||n)}(o(),{isMeasureSelectionLocked:t})},palettes:function(){return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.colorProps,n=e.coloring,r=e.theme,o=[];if(n&&n.palettes&&r){var i=n.palettes.categorical||t.dimensionScheme,a=r.getDataColorPalettes().filter((function(e){return e.key===i}))[0]||r.getDataColorPalettes()[0];i&&a&&o.push({key:"categorical",colors:a.colors});var l=n.palettes.metric||t.measureScheme,u=r.getDataColorScales().filter((function(e){return e.key===l}))[0];if(u){var s=u.colors[0]?u.colors:[[]].concat(L(u.colors.slice(1)));s=Array.isArray(s[0])?s.map((function(e){return e.slice().reverse()})):s.slice().reverse(),o.push({key:"quant",colors:s})}}return o}({coloring:o(),colorProps:n.colorProps,theme:n.theme})},scales:function(){return r.scales=r.scales||function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.hc,n=e.coloring,r=e.rtl,o=e.key,i=e.source,a=e.picasso,l={},u=o;if(n){var s={override:!0,domain:n.explicit&&"function"==typeof n.explicit.domain?n.explicit.domain:[].concat(L((n.explicit||{}).domain||[]),[-3,-2]),range:n.explicit&&"function"==typeof n.explicit.range?n.explicit.range:[].concat(L((n.explicit||{}).range||[]),[n.others,n.nil])};if("field"===n.mode){if("dimension"===n.fieldType){var c,f=lt({hc:t,source:i,coloring:n}).data;if(n.legendDataset){var d=0,p={};a.data("q")({data:t}).extract({field:n.field,trackBy:n.valueAccessor,reduce:function(e){var t=e[0];return p[t]=d++,e[0]}}),c={source:"attrDim",extract:{field:"qDimensionInfo/0",filter:function(e){return e.qElemNumber>=0},props:{row:{value:function(e){return p[e.qElemNumber]}}}}}}var h={data:f,range:n.range,domain:n.domain,explicit:s,type:"categorical-color",label:function(e){return e.datum.text&&e.datum.text.value?e.datum.text.value:e.datum.label}};l[u]=h,c&&(l["".concat(u,"Legend")]=P(P({},h),{},{data:c})),t&&t.qHasOtherValues&&c&&((c||h.data).amend=[{label:t.qDimensionInfo[0].othersLabel,source:{key:"qHyperCube",field:"qDimensionInfo/0"},row:{value:-3},value:-3}])}else if("measure"===n.fieldType){var m={data:{field:n.field},min:n.min,max:n.max};l[u]=W({},m,{type:"categorical"===n.type?"threshold-color":"sequential-color",range:n.range,domain:n.domain,invert:n.reverse}),"sequential-color"===l[u].type&&(l["".concat(u,"Range")]=W({},m,{invert:!!r}))}else if("color"!==n.type)throw new Error("UNUSED FIELD")}else if("dimension"===n.mode){var v={data:t.qDimensionInfo.map((function(e,t){return t})),label:function(e){return t.qDimensionInfo[e.datum.value].qFallbackTitle},explicit:s,type:"categorical-color"};l[u]=v}else if("measure"===n.mode){var g={data:t.qMeasureInfo.map((function(e,t){return t})).filter((function(e){var t,r;return!(null!==(t=n.explicit)&&void 0!==t&&null!==(r=t.exclude)&&void 0!==r&&r.includes(e))})),label:function(e){return t.qMeasureInfo[e.datum.value].qFallbackTitle},explicit:s,type:"categorical-color"};l[u]=g}}return l}({hc:n.hc,coloring:o(),key:n.key,source:n.source,picasso:e.picasso}),r.scales},color:function(){return r.color=r.color||function(e){var t=e.coloring,n=e.scales,r=e.key,o=ut(r),i=ut("".concat(r,"IsAnOther")),a=function(e,t){var r=e.fieldType,a=e.invalid,l=e.mode,u=e.nil,s=e.others,c=e.primary,f=e.type;return a?function(e){return ct(e)||i(e)?s:u}:n[t]?function(e){return ct(e)?s:st(e)||-2===o(e)&&"dimension"===r||"NaN"===o(e)?u:i(e)?s:e.resources.scale(t)(o(e))||s}:"constant"===l?function(e){return ct(e)||i(e)?s:st(e)?u:c}:"color"===f?function(e){return ct(e)||i(e)?s:st(e)?u:o(e)||s}:null},l=a(t,r);if(t.measureOverrides){var u=ut("".concat(r,"MeasureIdx")),s=t.measureOverrides.map((function(e){return e&&a(e)}));return function(e){var t=u(e);return s[t]?s[t](e):l(e)}}return l}({coloring:o(),scales:this.scales(),key:n.key}),r.color},datumProps:function(e){return function(e){var t,n,r=e.hc,o=e.coloring,i=e.scales,a=e.key,l=e.addMeasureIx,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=a,c=o.nil;"field"===o.mode&&o.field?t=o.field:i[a]&&"field"===o.mode&&(t=i[a].data.field||o.field),t?(n={field:t,reduce:"first"},"color"===o.type&&(n.value=function(e){return"NaN"!==e.qNum?mt(e.qNum):e.qText&&ve(e.qText)?e.qText:c})):"dimension"===o.mode?n=void 0!==o.field?o.field:r.qDimensionInfo.length-1:"measure"===o.mode&&(n=u);var f=N({},s,n);return r.qDimensionInfo.length>1&&(f["".concat(s,"IsAnOther")]={fields:r.qDimensionInfo.map((function(e,t){return{field:"qDimensionInfo/".concat(t)}})),value:function(e){return-1!==e.indexOf(-3)}}),l&&(f["".concat(s,"MeasureIdx")]=u),f}({coloring:this.settingsForMeasure(e),scales:this.scales(),key:n.key,hc:n.hc,addMeasureIx:o().measureOverrides},e)},data:function(){var e=o(),t={key:"dummy",data:[["field"],["a"]]};return e.legendDataset?[t,{type:"q",key:"attrDim",data:e.legendDataset.raw(),config:{localeInfo:n.localeInfo}}]:[t]},legend:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.eventName,r=e.key,i=e.viewState,a=e.chart,l=e.rtl,u=e.styleReference,s=void 0===u?"object.legend":u,c=e.settings,f=void 0===c?{}:c,d=e.style,p=void 0===d?{}:d,h=arguments.length>1?arguments[1]:void 0;return ht({eventName:t,key:r,rtl:l,viewState:i,chart:a,styleReference:s,settings:f,style:p},{legendProps:n.legendProps,scaleKey:n.key,coloring:o(),theme:n.theme,hc:n.hc,scales:this.scales()},h)}};return i}var gt=function(e){return e.baseColor||e.coloring&&e.coloring.baseColor};function yt(e){var t=e.qHyperCube,n=t.qDimensionInfo,r=t.qMeasureInfo,o=n.some(gt),i=r.some(gt),a=e.color.useBaseColors;return"measure"===a&&!i||"dimension"===a&&!o?"off":a}function bt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=P(P(P({},e),t),{},{colorProps:P(P({},e.colorProps),t.colorProps||{})});return n}var xt=function(e){return e.baseColor||e.coloring&&e.coloring.baseColor};function qt(e){var t,n=e.qHyperCube.qDimensionInfo.some(xt),r=e.qHyperCube.qMeasureInfo.some(xt),o=n?"dimension":void 0;return{mode:"primary",useBaseColors:null!==(t=null!=o?o:r?"measure":void 0)&&void 0!==t?t:"off",paletteColor:null}}var Dt=function(){};function wt(e){var t=e.originalArray,n=e.newArray,r=e.matchKey;return Array.isArray(t)&&t.length?(n.forEach((function(e){var n=-1;t.some((function(t,o){return t[r]&&t[r]===e[r]&&(n=o),n})),n>-1?t[n]=e:t.push(e)})),t):n}function Mt(e){return(Mt="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})(e)}function Ct(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function It(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function kt(e,t,n){return t&&It(e.prototype,t),n&&It(e,n),e}function St(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function At(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 Ot(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?At(Object(n),!0).forEach((function(t){St(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):At(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Nt(e,t){return(Nt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Et(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Pt(e,t,n){return(Pt=Et()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&Nt(o,n.prototype),o}).apply(null,arguments)}function Tt(e){return function(e){if(Array.isArray(e))return Lt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||jt(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 jt(e,t){if(e){if("string"==typeof e)return Lt(e,t);var n=Object.prototype.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)?Lt(e,t):void 0}}function Lt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Rt=Object.prototype.hasOwnProperty,Ft=Object.prototype.toString,Ht=Object.defineProperty,Vt=Object.getOwnPropertyDescriptor,_t=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===Ft.call(e)},zt=function(e){if(!e||"[object Object]"!==Ft.call(e))return!1;var t,n=Rt.call(e,"constructor"),r=e.constructor&&e.constructor.prototype&&Rt.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!r)return!1;for(t in e);return void 0===t||Rt.call(e,t)},Bt=function(e,t){Ht&&"__proto__"===t.name?Ht(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},Ut=function(e,t){if("__proto__"===t){if(!Rt.call(e,t))return;if(Vt)return Vt(e,t).value}return e[t]},$t=function e(){var t,n,r,o,i,a,l=arguments[0],u=1,s=arguments.length,c=!1;for("boolean"==typeof l&&(c=l,l=arguments[1]||{},u=2),(null==l||"object"!=typeof l&&"function"!=typeof l)&&(l={});u<s;++u)if(null!=(t=arguments[u]))for(n in t)r=Ut(l,n),l!==(o=Ut(t,n))&&(c&&o&&(zt(o)||(i=_t(o)))?(i?(i=!1,a=r&&_t(r)?r:[]):a=r&&zt(r)?r:{},Bt(l,{name:n,newValue:e(c,a,o)})):void 0!==o&&Bt(l,{name:n,newValue:o}));return l};function Kt(e,t,n){if(!e)return-1;var r=n.cache,o=e.origin?e.origin():null;o&&(e=o);var i=r.fields.indexOf(e),a=-1,l=-1;if(-1===i)for(var u=0;u<r.wrappedFields.length;u++)if(l=r.wrappedFields[u].attrDims.map((function(e){return e.instance})).indexOf(e),a=r.wrappedFields[u].attrExps.map((function(e){return e.instance})).indexOf(e),-1!==l||-1!==a){i=u;break}return(i-=t.qArea.qLeft)<0||i>=t.qArea.qWidth?-1:l>=0?function(e){return e[i].qAttrDims.qValues[l]}:a>=0?function(e){return e[i].qAttrExps.qValues[a]}:function(e){return e[i]}}function Wt(e,t,n){var r=n.key,o={value:"function"==typeof e.value?e.value(t):void 0!==e.value?e.value:t};return o.label="function"==typeof e.label?e.label(t):void 0!==e.label?String(e.label):String(o.value),e.field&&(o.source={key:r,field:e.field.key()}),o}function Yt(e){var t=e.cache,n=e.f,r=e.mainCell,o=e.p;e.prop;var i=e.page,a=e.rowIdx,l=e.row,u=e.sourceKey,s=e.target,c=e.targetProp,f=r;if(o.field&&o.field!==n){var d=Kt(o.field,i,{cache:t});if(-1===d)return;f=$t({qRow:a},d(l))}s[c]=Wt(o,f,{key:u})}function Gt(e,t,n,r){for(var o=Array.isArray(e)?e:[e],i=[],a=0;a<o.length;a++)if(void 0!==o[a].field){for(var l=t.raw(),u=t.key(),s="object"===Mt(o[a].field)?o[a].field:t.field(o[a].field),c=r.normalizeConfig(o[a],t),f=c.props,d=c.main,p=Object.keys(f),h=!!o[a].trackBy,m=Mt(o[a].trackBy),v={},g=[],y=[],b=0;b<l.qDataPages.length;b++){var x=Kt(s,l.qDataPages[b],{cache:n});if(-1!==x)for(var q=0;q<l.qDataPages[b].qMatrix.length;q++){var D=l.qDataPages[b].qArea.qTop+q,w=$t({qRow:D},x(l.qDataPages[b].qMatrix[q])),M=Wt(d,w,{key:u});if(!d.filter||d.filter(w)){for(var C=0;C<p.length;C++){var I=f[p[C]],k=I.fields||[I];I.fields&&(M[p[C]]=[]);for(var S=0;S<k.length;S++)Yt({cache:n,f:s,mainCell:w,p:k[S],prop:p[C],props:f,page:l.qDataPages[b],rowIdx:D,row:l.qDataPages[b].qMatrix[q],sourceKey:u,target:I.fields?M[p[C]]:M,targetProp:I.fields?S:p[C]});if(I.fields){var A=M[p[C]].map((function(e){return e.value})),O=M[p[C]].map((function(e){return e.label}));M[p[C]]={value:"function"==typeof I.value?I.value(A):void 0!==I.value?I.value:A,label:"function"==typeof I.label?I.label(O):void 0!==I.label?String(I.label):String(M[p[C]].value)}}}h&&r.track({cfg:o[a],itemData:w,obj:M,target:g,tracker:v,trackType:m}),y.push(M)}}}h?i.push.apply(i,Tt(r.collect(g,{main:d,propsArr:p,props:f}))):i.push.apply(i,y)}return i}function Zt(e){var t=0,n=e.children,r=n&&n.length;if(r)for(;--r>=0;)t+=n[r].value;else t=1;e.value=t}function Jt(e,t){var n,r,o,i,a,l=new tn(e),u=+e.value&&(l.value=e.value),s=[l];for(null==t&&(t=Qt);n=s.pop();)if(u&&(n.value=+n.data.value),(o=t(n.data))&&(a=o.length))for(n.children=new Array(a),i=a-1;i>=0;--i)s.push(r=n.children[i]=new tn(o[i])),r.parent=n,r.depth=n.depth+1;return l.eachBefore(en)}function Qt(e){return e.children}function Xt(e){e.data=e.data.data}function en(e){var t=0;do{e.height=t}while((e=e.parent)&&e.height<++t)}function tn(e){this.data=e,this.depth=this.height=0,this.parent=null}function nn(e){if("function"!=typeof e)throw new Error;return e}tn.prototype=Jt.prototype={constructor:tn,count:function(){return this.eachAfter(Zt)},each:function(e){var t,n,r,o,i=this,a=[i];do{for(t=a.reverse(),a=[];i=t.pop();)if(e(i),n=i.children)for(r=0,o=n.length;r<o;++r)a.push(n[r])}while(a.length);return this},eachAfter:function(e){for(var t,n,r,o=this,i=[o],a=[];o=i.pop();)if(a.push(o),t=o.children)for(n=0,r=t.length;n<r;++n)i.push(t[n]);for(;o=a.pop();)e(o);return this},eachBefore:function(e){for(var t,n,r=this,o=[r];r=o.pop();)if(e(r),t=r.children)for(n=t.length-1;n>=0;--n)o.push(t[n]);return this},sum:function(e){return this.eachAfter((function(t){for(var n=+e(t.data)||0,r=t.children,o=r&&r.length;--o>=0;)n+=r[o].value;t.value=n}))},sort:function(e){return this.eachBefore((function(t){t.children&&t.children.sort(e)}))},path:function(e){for(var t=this,n=function(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),o=null;for(e=n.pop(),t=r.pop();e===t;)o=e,e=n.pop(),t=r.pop();return o}(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var o=r.length;e!==n;)r.splice(o,0,e),e=e.parent;return r},ancestors:function(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t},descendants:function(){var e=[];return this.each((function(t){e.push(t)})),e},leaves:function(){var e=[];return this.eachBefore((function(t){t.children||e.push(t)})),e},links:function(){var e=this,t=[];return e.each((function(n){n!==e&&t.push({source:n.parent,target:n})})),t},copy:function(){return Jt(this).eachBefore(Xt)}};var rn={depth:-1},on={};function an(e){return e.id}function ln(e){return e.parentId}function un(e,t){"/"===e.charAt(0)&&(e=e.substring(1));for(var n,r=e.split("/"),o=t,i=0;i<r.length;i++){if("*"===r[i]&&Array.isArray(o)){var a=[];n=r.slice(i+1).join("/");for(var l=0;l<o.length;l++){var u=un(n,o[l]);Array.isArray(u)?a.push.apply(a,Tt(u)):a.push(u)}return a}if(!r[i]&&Array.isArray(o)){var s=new Array(o.length);n=r.slice(i+1).join("/");for(var c=0;c<o.length;c++)s[c]=un(n,o[c]);return s}r[i]in o&&(o=o[r[i]])}return o}function sn(e,t,n){var r=[];if(!e||!e.length)return r;if(t<=0){var o=n>=0?[e[n]]:e;r.push.apply(r,Tt(o))}else for(var i=0;i<e.length;i++)e[i].children&&e[i].children.length&&r.push.apply(r,Tt(sn(e[i].children,t-1,n)));return r}function cn(e,t,n){if(e===t)return function(e){return e};if(e>t){var r=Math.max(0,Math.min(100,e-t)),o=Tt(Array(r)).map(String.prototype.valueOf,"parent").join(".");return Function("node","return node.".concat(o,";"))}if(t>e){var i=Math.max(0,Math.min(100,t-e));return function(e){return sn(e.children,i-1,n)}}return!1}function fn(e,t){var n=t.cache;if("number"==typeof e)return n.fields[e];var r=n.allFields;if("function"==typeof e){for(var o=0;o<r.length;o++)if(e(r[o]))return r[o];return!1}if("string"==typeof e){for(var i=0;i<r.length;i++)if(r[i].key()===e||r[i].title()===e)return r[i]}else if(e&&-1!==r.indexOf(e))return e;throw Error("Field not found: ".concat(e))}var dn=/^qDimensionInfo(?:\/(\d+))?/,pn=/^\/?qMeasureInfo\/(\d+)/,hn=/\/qAttrExprInfo\/(\d+)/,mn=/\/qAttrDimInfo\/(\d+)/;function vn(e){return(e.qColumnOrder&&e.qColumnOrder.length?e.qColumnOrder:e.qDimensionInfo.map((function(e,t){return t}))).filter((function(t){return t<e.qDimensionInfo.length}))}function gn(e,t){var n=t.cube;if(!e)return-1;var r=e.origin&&e.origin()?e.origin().key():e.key(),o=!1,i=-1,a=-1,l=-1,u=-1,s=-1,c=r,f=n.qEffectiveInterColumnSortOrder,d=vn(n);return dn.test(c)&&(o=!0,i=+dn.exec(c)[1],c=r.replace(dn,"")),pn.test(c)&&("K"===n.qMode?u=+pn.exec(c)[1]:f&&-1!==f.indexOf(-1)?(u=+pn.exec(c)[1],s=0):s=+pn.exec(c)[1],c=c.replace(pn,"")),c&&(mn.exec(c)?l=+mn.exec(c)[1]:hn.exec(c)&&(a=+hn.exec(c)[1])),{fieldDepth:(o?"S"===n.qMode?d[i]:f?f.indexOf(i):i:f&&-1!==f.indexOf(-1)?f.indexOf(-1):n.qDimensionInfo.length-("K"===n.qMode?0:1))+1,pseudoMeasureIndex:u,measureIdx:s,attrDimIdx:l,attrIdx:a}}function yn(e,t){var n,r,o=cn(e.fieldDepth,t.fieldDepth,t.pseudoMeasureIndex);return n=t.measureIdx>=0?function(e){return e.data.qValues[t.measureIdx]}:function(e){return e.data},t.attrDimIdx>=0?r=function(e){var n;return null==e||null===(n=e.qAttrDims)||void 0===n?void 0:n.qValues[t.attrDimIdx]}:t.attrIdx>=0&&(r=function(e){var n;return null==e||null===(n=e.qAttrExps)||void 0===n?void 0:n.qValues[t.attrIdx]}),{nodeFn:o,attrFn:r,valueFn:n}}function bn(e,t,n){var r=n.key,o={value:"function"==typeof e.value?e.value(t):void 0!==e.value?e.value:t};return o.label="function"==typeof e.label?e.label(t):void 0!==e.label?String(e.label):String(o.value),e.field&&(o.source={key:r,field:e.field.key()}),o}function xn(e){for(var t=e.propsArr,n=e.props,r=e.item,o=e.itemData,i=e.ret,a=e.sourceKey,l=0;l<t.length;l++){var u=n[t[l]],s=u.fields||[u],c=void 0,f=void 0;u.fields&&(c=[],f=[]);for(var d=function(e){var n=s[e],d=void 0,p=void 0,h=void 0,m=void 0,v=void 0,g=void 0;if("primitive"===n.type?(h=n.value,g=String(n.value)):("function"==typeof n.value&&(d=function(e){return n.value(e,r)}),"function"==typeof n.label&&(p=function(e){return n.label(e,r)}),n.accessor?(m=n.accessor(r),Array.isArray(m)?(v=m.map(n.valueAccessor),n.attrAccessor&&(v=v.map(n.attrAccessor)),d&&(h=v.map(d),d=null),p&&(g=v.map(p),p=null),h=n.reduce?n.reduce(h):h,g=n.reduceLabel?n.reduceLabel(g,h):String(h)):g=h=n.attrAccessor?n.attrAccessor(n.valueAccessor(m)):n.valueAccessor(m)):(h=o,g=o)),u.fields){var y=d?d(h):h;c.push(y),f.push(p&&null!=g?p(g):null!=g?g:String(y))}else{var b=d?d(h):h;i[t[l]]={value:b,label:p?p(g):null!=g?g:String(b)},n.field&&(i[t[l]].source={field:n.field.key(),key:a})}},p=0;p<s.length;p++)d(p);c&&(i[t[l]]={value:"function"==typeof u.value?u.value(c,r):c,label:"function"==typeof u.label?u.label(f,r):f})}}var qn=function(e,t,n){var r="K"===e.qMode?"/qStackedDataPages/*/qData":"/qTreeDataPages/*",o="K"===e.qMode?"qSubNodes":"qNodes",i=un(r,e);return i&&i[0]?(t.tree=Jt(i[0],n.children||function(e){return e[o]}),t.tree):null};function Dn(e){for(var t=e.raw().qDataPages.length?e.raw().qDataPages[0].qMatrix:[],n=function(e){var t=e.raw().qColumnOrder,n=e.fields();return t&&t.length===n.length?t:n.map((function(e,t){return t}))}(e),r=e.fields(),o=e.fields().filter((function(e){return"dimension"===e.type()})).map((function(e){return n.indexOf(r.indexOf(e))})),i=e.fields().filter((function(e){return"measure"===e.type()})).map((function(e){return n.indexOf(r.indexOf(e))})),a={__root:{__id:"__root",qValues:[]}},l=0;l<t.length;l++){for(var u=t[l],s="__root",c=!1,f=0;f<o.length;f++){var d=u[o[f]],p="".concat(s,"__").concat(d.qText);a[p]||(a[p]=Ot({__id:p,__parent:s,qValues:[]},d),c=!0),s=p}if(c)for(var h=0;h<i.length;h++){var m=u[i[h]];a[s].qValues.push(m)}}var v=Object.keys(a).map((function(e){return a[e]}));return function(){var e=an,t=ln;function n(n){var r,o,i,a,l,u,s,c=n.length,f=new Array(c),d={};for(o=0;o<c;++o)r=n[o],l=f[o]=new tn(r),null!=(u=e(r,o,n))&&(u+="")&&(d[s="$"+(l.id=u)]=s in d?on:l);for(o=0;o<c;++o)if(l=f[o],null!=(u=t(n[o],o,n))&&(u+="")){if(!(a=d["$"+u]))throw new Error("missing: "+u);if(a===on)throw new Error("ambiguous: "+u);a.children?a.children.push(l):a.children=[l],l.parent=a}else{if(i)throw new Error("multiple roots");i=l}if(!i)throw new Error("no root");if(i.parent=rn,i.eachBefore((function(e){e.depth=e.parent.depth+1,--c})).eachBefore(en),i.parent=null,c>0)throw new Error("cycle");return i}return n.id=function(t){return arguments.length?(e=nn(t),n):e},n.parentId=function(e){return arguments.length?(t=nn(e),n):t},n}().id((function(e){return e.__id})).parentId((function(e){return e.__parent}))(v)}var wn=function(e){for(var t=e.propsArr,n=e.props,r=e.cube,o=e.cache,i=e.itemDepthObject,a=e.f,l=0;l<t.length;l++)for(var u=n[t[l]],s=u.fields?u.fields:[u],c=0;c<s.length;c++){var f=s[c];if(f.field!==a){var d=yn(i,gn(f.field,{cube:r,cache:o}));f.accessor=d.nodeFn,f.valueAccessor=d.valueFn,f.attrAccessor=d.attrFn}}};function Mn(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,o=t.raw(),i=t.key(),a="S"===o.qMode?Dn(t):qn(o,n,e);if(!a)return null;for(var l=a.height,u=[],s=0;s<=l;s++){var c=null;if(s>0)if("S"===o.qMode){var f=vn(o),d=f[s-1];c=n.fields[d]}else{var p=o.qEffectiveInterColumnSortOrder[s-1];s>o.qEffectiveInterColumnSortOrder.length&&(p=o.qDimensionInfo.length),c=n.fields[p]}var h=r.normalizeConfig(Ot(Ot({},e),{},{field:c?c.key():void 0}),t),m=h.props,v=h.main,g=Object.keys(m);u[s]={propsArr:g,props:m,main:v};var y=c?gn(c,{cube:o,cache:n}):{fieldDepth:0};wn({propsArr:g,props:m,cube:o,cache:n,itemDepthObject:y,f:c})}for(var b=a.copy(),x=b.descendants(),q=a.descendants(),D=0;D<q.length;D++){var w=u[q[D].depth].propsArr,M=u[q[D].depth].props,C=u[q[D].depth].main,I=x[D],k=I.data,S=bn(C,k,{key:i});xn({propsArr:w,props:M,item:I,itemData:k,ret:S,sourceKey:i,isTree:!0}),q[D].data=S}return a}function Cn(e,t,n,r){for(var o=Array.isArray(e)?e:[e],i=[],a=0;a<o.length;a++)if(void 0!==o[a].field){var l=t.raw(),u=t.key();if(!qn(l,n,e))continue;var s="object"===Mt(o[a].field)?o[a].field:t.field(o[a].field),c=r.normalizeConfig(o[a],t),f=c.props,d=c.main,p=Object.keys(f),h=gn(s,{cube:l,cache:n}),m=yn({fieldDepth:0},h),v=m.nodeFn,g=m.attrFn,y=m.valueFn;wn({propsArr:p,props:f,cube:l,cache:n,itemDepthObject:h,f:s});for(var b=!!o[a].trackBy,x=Mt(o[a].trackBy),q={},D=[],w=v(n.tree),M=[],C=0;C<w.length;C++){var I=w[C],k=g?g(y(I)):y(I);if(!d.filter||d.filter(k)){var S=bn(d,k,{key:u});xn({propsArr:p,props:f,item:I,itemData:k,ret:S,sourceKey:u}),b&&r.track({cfg:o[a],itemData:k,obj:S,target:D,tracker:q,trackType:x}),M.push(S)}}b?i.push.apply(i,Tt(r.collect(D,{main:d,propsArr:p,props:f}))):i.push.apply(i,M)}return i}var In,kn=(function(e){
8
8
  /*! javascript-number-formatter - v1.1.11 - http://mottie.github.com/javascript-number-formatter/ * © ecava */
9
9
  e.exports=function(e,t){if(!e||isNaN(+t))return t;var n,r,o,i,a,l,u,s,c,f,d=e.length,p=e.search(/[0-9\-\+#]/),h=p>0?e.substring(0,p):"",m=e.split("").reverse().join(""),v=m.search(/[0-9\-\+#]/),g=d-v,y=e.substring(g,g+1),b=g+("."===y||","===y?1:0),x=v>0?e.substring(b,d):"";if(n=(t="-"===(e=e.substring(p,b)).charAt(0)?-t:+t)<0?t=-t:0,o=(r=e.match(/[^\d\-\+#]/g))&&r[r.length-1]||".",i=r&&r[1]&&r[0]||",",e=e.split(o),t=+(t=t.toFixed(e[1]&&e[1].length))+"",l=e[1]&&e[1].lastIndexOf("0"),(!(s=t.split("."))[1]||s[1]&&s[1].length<=l)&&(t=(+t).toFixed(l+1)),c=e[0].split(i),e[0]=c.join(""),(a=e[0]&&e[0].indexOf("0"))>-1)for(;s[0].length<e[0].length-a;)s[0]="0"+s[0];else 0==+s[0]&&(s[0]="");if((t=t.split("."))[0]=s[0],u=c[1]&&c[c.length-1].length){for(m="",g=(f=t[0]).length%u,d=f.length,b=0;b<d;b++)m+=f.charAt(b),!((b-g+1)%u)&&b<d-u&&(m+=i);t[0]=m}return t[1]=e[1]&&t[1]?o+t[1]:"","0"!==(r=t.join(""))&&""!==r||(n=!1),h+(n?"-":"")+r+x}}(In={exports:{}}),In.exports);function Sn(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}var An={3:"k",6:"M",9:"G",12:"T",15:"P",18:"E",21:"Z",24:"Y","-3":"m","-6":"μ","-9":"n","-12":"p","-15":"f","-18":"a","-21":"z","-24":"y"},On=/%$/,Nn=/^\(r(0[2-9]|[12]\d|3[0-6])\)/i,En=/^\(oct\)/i,Pn=/^\(dec\)/i,Tn=/^\(hex\)/i,jn=/^\(bin\)/i,Ln=/^\(rom\)/i,Rn=/^(\(rom\)|\(bin\)|\(hex\)|\(dec\)|\(oct\)|\(r(0[2-9]|[12]\d|3[0-6])\))/i,Fn=/#|0/g;function Hn(e,t,n,r){return e=e.toString(t),n[1]===n[1].toUpperCase()&&(e=e.toUpperCase()),e.length-e.indexOf(".")>10&&(e=e.slice(0,e.indexOf(".")+11)),e.replace(".",r||".")}function Vn(e,t,n){var r=Sn(e);return n?r:new RegExp(r||"",t)}function _n(e,t,n){var r,o,i,a,l,u,s,c,f,d,p,h=e.pattern;h.indexOf("A")>=0&&(h=h.replace("A",""),e.abbreviate=!0),d=t,(p=n)&&(p=Sn(p)),d&&(d=Sn(d)),f=new RegExp("(?:[#0]+".concat(d,")?[#0]+(?:").concat(p,"[#0]+)?")),a=(i=(i=h.match(f))?i[0]:"")?h.substr(0,h.indexOf(i)):h,l=i?h.substring(h.indexOf(i)+i.length):"",i||(i=h?"#":"##########"),t&&t===n&&(o=(r=i.split(n)).pop(),i=r.join("")+n+o,t=""),u=t,t=/,/.test(n)?"¤":",",u&&(i=i.replace(Vn(u,"g"),t)),s=n,n=".",s&&(i=i.replace(Vn(s,"g"),n)),c=(c=i.match(/#/g))?c.length:0;var m,v=h.split(s);v[1]&&(m=v[1].match(Fn)),e.prefix=a||"",e.postfix=l||"",e.pattern=h,e.maxPrecision=m?m.length:2,e.percentage=On.test(h),e.numericPattern=i||"",e.numericRegex=new RegExp("".concat(Vn(t,null,!0),"|").concat(Vn(n,null,!0)),"g"),e.groupTemp=u,e.decTemp=s,e.t=t,e.d=n,e.temp=c}var zn=function(){function e(t,n,r,o,i){Ct(this,e),this.localeInfo=t,this.pattern=n,this.thousandDelimiter=r||",",this.decimalDelimiter=o||".",this.type=i||"numeric",this.patternSeparator=";",this.abbreviations=function(e,t){if(!e||!e.qNumericalAbbreviation)return An;var n={};return e.qNumericalAbbreviation.split(t).forEach((function(e){var t=e.split(":");2===t.length&&(n[t[0]]=t[1])})),n}(t,this.patternSeparator),this.prepare()}return kt(e,[{key:"clone",value:function(){var t=new e(this.localeInfo,this.pattern,this.thousandDelimiter,this.decimalDelimiter,this.type);return t.subtype=this.subtype,t}},{key:"format",value:function(e,t,n,r){return this.prepare(t,n,r),this.formatValue(e)}},{key:"prepare",value:function(e,t,n){var r;void 0===e&&(e=this.pattern),void 0===t&&(t=this.thousandDelimiter),void 0===n&&(n=this.decimalDelimiter),e?(this._prepared={positive:{d:n,t:t,abbreviate:!1,isFunctional:!1,prefix:"",postfix:""},negative:{d:n,t:t,abbreviate:!1,isFunctional:!1,prefix:"",postfix:""},zero:{d:n,t:t,abbreviate:!1,isFunctional:!1,prefix:"",postfix:""}},r=this._prepared,e=e.split(this.patternSeparator),r.positive.pattern=e[0],r.negative.pattern=e[1],r.zero.pattern=e[2],Rn.test(e[0])&&(r.positive.isFunctional=!0),e[1]?Rn.test(e[1])&&(r.negative.isFunctional=!0):r.negative=!1,e[2]?Rn.test(e[2])&&(r.zero.isFunctional=!0):r.zero=!1,r.positive.isFunctional||_n(r.positive,t,n),r.negative&&!r.negative.isFunctional&&_n(r.negative,t,n),r.zero&&!r.zero.isFunctional&&_n(r.zero,t,n)):this._prepared={pattern:!1}}},{key:"formatValue",value:function(e){var t,n,r,o,i,a,l,u,s,c=this._prepared,f="",d="",p=e;if(isNaN(e))return"".concat(p);if(e=+e,!1===c.pattern)return e.toString();if(0===e&&c.zero)return(c=c.zero).pattern;if(e<0&&c.negative?(c=c.negative,e=-e):c=c.positive,i=c.d,a=c.t,c.isFunctional)e=function(e,t,n){var r;return Nn.test(t)?e=Hn(e,Number(/\d{2}/.exec(t)[0]),t,n):En.test(t)?e=Hn(e,8,t,n):Pn.test(t)?e=Hn(e,10,t,n):Tn.test(t)?e=Hn(e,16,t,n):jn.test(t)?e=Hn(e,2,t,n):Ln.test(t)&&(r="",e<0&&(r="-",e=-e),e=0===(e=Math.floor(e))?"0":e<=5e5?r+(e=function(e,t){for(var n,r="",o=Number(String(e).slice(-3)),i=(e-o)/1e3,a=[0,1,4,5,9,10,40,50,90,100,400,500,900].reverse(),l=["0","I","IV","V","IX","X","XL","L","XC","C","CD","D","CM"].reverse();o>0;)for(n=0;n<a.length;n++)if(a[n]<=o){r+=l[n],o-=a[n];break}for(n=0;n<i;n++)r="M".concat(r);return t[1]!==t[1].toUpperCase()&&(r=r.toLowerCase()),r}(e,t)):t+r+e.toExponential(0)),e}(e,c.pattern,i);else{if(c.percentage&&(e*=100),c.abbreviate){var h,m,v=Object.keys(this.abbreviations).map((function(e){return parseInt(e,10)})).sort((function(e,t){return e-t})),g=v[0];for(l=0,n=Number(Number(e).toExponential().split("e")[1]);g<=n&&l<v.length;)g=v[++l];l>0&&(h=v[l-1]),h&&n>0&&h>0?m=h:(n<0&&h<0||!h)&&(g<0&&g-n<=c.maxPrecision?m=g:h<=n&&!(g>0&&-n<=c.maxPrecision)&&(m=h)),m&&(f=this.abbreviations[m],e/=Math.pow(10,m))}if(r=Math.abs(e),t=c.temp,s=(u=c.numericPattern).split(i)[1],"I"===this.type&&(e=Math.round(e)),o=e,s||"#"!==u.slice(-1)[0])if(r>=1e15||r>0&&r<=1e-14)e=r?r.toExponential(15).replace(/\.?0+(?=e)/,""):"0";else{var y=Number(e.toFixed(Math.min(20,s?s.length:0)).split(".")[0]),b=u.split(i)[0];if(e=kn(b+=i,y)||"0",s){var x=Math.max(0,Math.min(14,s.length)),q=s.replace(/#+$/,"").length,D=("I"===this.type?0:r%1).toFixed(x).slice(2).replace(/0+$/,"");for(l=D.length;l<q;l++)D+="0";D&&(e+=i+D)}else 0===y&&(o=0)}else if(r>=Math.pow(10,t)||r<1||r<1e-4)0===e?e="0":r<1e-4||r>=1e20?(e=(e=o.toExponential(Math.max(1,Math.min(14,t))-1)).replace(/\.?0+(?=e)/,""),d=""):(e=e.toPrecision(Math.max(1,Math.min(14,t)))).indexOf(".")>=0&&(e=(e=e.replace(e.indexOf("e")<0?/0+$/:/\.?0+(?=e)/,"")).replace(".",i));else{for(u+=i,t=Math.max(0,Math.min(20,t-Math.ceil(Math.log(r)/Math.log(10)))),l=0;l<t;l++)u+="#";e=kn(u,e)}e=e.replace(c.numericRegex,(function(e){return e===a?c.groupTemp:e===i?c.decTemp:""})),o<0&&!/^-/.test(e)&&(e="-".concat(e))}return c.prefix+e+d+f+c.postfix}}],[{key:"getStaticFormatter",value:function(){return{prepare:function(){},formatValue:function(e){return"".concat(e)}}}}]),e}();function Bn(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=r.size,i=void 0===o?5e3:o,a=r.multipleArguments,l=void 0!==a&&a,u=r.toKey,s=void 0===u?function(e){return e}:u,c=Object.create(null),f=Object.create(null),d=0,p=0;return(t=l?function(){return n=s.apply(void 0,arguments),t.has(n)?t.get(n):t.set(n,e.apply(void 0,arguments))}:function(r){return n=s(r),t.has(n)?t.get(n):t.set(n,e(r))}).set=function(e,t){return d>=i&&(delete c[f[p]],delete f[p],d--,p++),c[e]=t,f[d]=e,d++,t},t.get=function(e){return c[e]},t.has=function(e){return e in c},t.clear=function(){c=Object.create(null),f=Object.create(null),d=0,p=0},t.size=function(){return d},t}function Un(e,t,n,r,o){var i=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Pt(zn,t)}(o,e,t,n,r),a=Bn(i.formatValue.bind(i),{toKey:function(e){return isNaN(e)?e:+e}});function l(e){return a(e)}return l.format=function(e,t,n,r){return a.clear(),i.format(t,e,n,r)},l.pattern=function(e){return e&&(a.clear(),i.pattern=e,i.prepare()),i.pattern},l}var $n=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Kn=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],Wn=["January","February","March","April","May","June","July","August","September","October","November","December"],Yn=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Gn(e,t){for(var n=e.length;n<t;n++)e="0".concat(e);return e}function Zn(e){var t=e.toString().split(".");return t[1]?t=Number("0.".concat(t[1])):0}var Jn=function(){function e(t,n,r){Ct(this,e);var o,i=t||{};i.qCalendarStrings||(i.qCalendarStrings={qLongDayNames:$n,qDayNames:Kn,qLongMonthNames:Wn,qMonthNames:Yn}),this.localeInfo=i,this.locale_days=i.qCalendarStrings.qLongDayNames.slice(),this.locale_days_abbr=i.qCalendarStrings.qDayNames.slice(),this.locale_months=i.qCalendarStrings.qLongMonthNames.slice(),this.locale_months_abbr=i.qCalendarStrings.qMonthNames.slice(),n||(n=(St(o={},"T",i.qTimeFmt||"hh:mm:ss"),St(o,"D",i.qDateFmt||"YYYY-MM-DD"),St(o,"TS",i.qTimestampFmt||"YYYY-MM-DD hh:mm:ss"),o)[r]),this.pattern=n}return kt(e,[{key:"clone",value:function(){var t=new e(this.localeInfo,this.pattern);return t.subtype=this.subtype,t}},{key:"format",value:function(e,t){t||(t=this.pattern?this.pattern:"YYYY-MM-DD hh:mm:ss"),t=t.replace(/\[.+]|\[|]/g,"");var n,r,o,i,a,l=/t+/gi.test(t);e instanceof Date?(o=l,i=(r=e).getUTCHours(),o&&((i%=12)||(i=12)),(a=r.getUTCDay()-1)<0&&(a=6),n={year:r.getUTCFullYear(),month:r.getUTCMonth(),day:a,date:r.getUTCDate(),h:i,m:r.getUTCMinutes(),s:r.getUTCSeconds(),f:r.getUTCMilliseconds(),t:r.getUTCHours()>=12?"pm":"am"}):(e<0&&(e=-e,t="-".concat(t)),n=function(e,t){var n,r=function(e){var t=e,n=24*Zn(t),r=60*Zn(n),o=60*Zn(r),i=1e3*Zn(o);return{d:Math.floor(t),h:Math.floor(n),m:Math.floor(r),s:Math.floor(o),f:Math.round(i)}}(e),o=r.d,i=r.h,a=r.m,l=r.s,u=r.f,s=0;/w+|t+/gi.test(t)&&(n=new Date(Date.UTC(1899,11,30+Math.floor(e),0,0,Math.round(86400*(e-Math.floor(e))))),isNaN(n.getTime())&&(n=null)),/D+/gi.test(t)||(i+=24*o),/h+/gi.test(t)||(a+=60*i),/m+/gi.test(t)||(l+=60*a),/w+/gi.test(t)&&(s=n?n.getDay()-1:0)<0&&(s=6);var c="";return n&&(c=n.getUTCHours()>=12?"pm":"am"),{year:0,month:0,day:s,date:o,h:i,m:a,s:l,f:u,t:c}}(e,t));var u=function(e,t){return{"Y+|y+":{Y:"".concat(Number("".concat(t.year).slice(-2))),YY:Gn("".concat(t.year).slice(-2),2),YYY:Gn("".concat(t.year).slice(-3),3),def:function(e){return Gn("".concat(t.year),e.length)}},"M+":{M:t.month+1,MM:Gn("".concat(t.month+1),2),MMM:e.locale_months_abbr[t.month],def:e.locale_months[t.month]},"W+|w+":{W:t.day,WW:Gn("".concat(t.day),2),WWW:e.locale_days_abbr[t.day],def:e.locale_days[t.day]},"D+|d+":{D:t.date,def:function(e){return Gn("".concat(t.date),e.length)}},"h+|H+":{h:t.h,def:function(e){return Gn("".concat(t.h),e.length)}},"m+":{m:t.m,def:function(e){return Gn("".concat(t.m),e.length)}},"s+|S+":{s:t.s,def:function(e){return Gn("".concat(t.s),e.length)}},"f+|F+":{def:function(e){var n="".concat(t.f),r=e.length-n.length;if(r>0)for(var o=0;o<r;o++)n+="0";else r<0&&(n=n.slice(0,e.length));return n}},"t{1,2}|T{1,2}":{def:function(e){var n=t.t;return e[0].toUpperCase()===e[0]&&(n=n.toUpperCase()),n.slice(0,e.length)}}}}(this,n),s=[];for(var c in u)Object.prototype.hasOwnProperty.call(u,c)&&s.push(c);var f=new RegExp(s.join("|"),"g");return t.replace(f,(function(e){var t,n,r;for(n in u)if(Object.prototype.hasOwnProperty.call(u,n)&&(t=new RegExp(n)).test(e))break;if(!t)return"";for(var o in u[n])if(o===e||o.toLowerCase()===e){void 0===(r=u[n][o])&&(r=u[n][o.toLowerCase()]);break}return void 0===r&&(r=u[n].def),"function"==typeof r&&(r=r(e)),r}))}}]),e}();function Qn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Pt(Jn,t)}function Xn(e){return new Date(Date.UTC(1899,11,30+Math.floor(e),0,0,0,Math.round(864e5*(e-Math.floor(e)))))}function er(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"TS",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=Qn(n,e,t),o=Bn(r.format.bind(r),{toKey:function(e){return"object"===Mt(e)&&"function"==typeof e.getTime?e.getTime():e}});function i(e){return"IV"!==t?Xn(e):e}function a(e){return e=i(e),o(e)}return a.format=function(e,t){return o.clear(),t=i(t),r.format(t,e)},a.locale=function(n){return r=Qn(n,e,t),o=Bn(r.format.bind(r),{toKey:function(e){return"object"===Mt(e)?e.getTime():e}}),this},a.qtype=function(e){return void 0!==e&&(t=e,o.clear()),t},a}function tr(e,t){if(e&&e.qNumFormat&&-1!==["D","T","TS","IV"].indexOf(e.qNumFormat.qType))return er(e.qNumFormat.qFmt,e.qNumFormat.qType,t);var n="#",r=t&&void 0!==t.qThousandSep?t.qThousandSep:",",o=t&&void 0!==t.qDecimalSep?t.qDecimalSep:".",i="U",a=e&&!!e.qIsAutoFormat;return e&&e.qNumFormat?(n=e.qNumFormat.qFmt||n,r=e.qNumFormat.qThou||r,o=e.qNumFormat.qDec||o,i=e.qNumFormat.qType||i,a=a&&-1===["M"].indexOf(e.qNumFormat.qType)):a=!0,(a||"U"===i)&&(n="#".concat(o,"##A"),i="U"),Un(n,r,o,i,t)}function nr(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.meta,r=t.id,o=t.key,i=t.localeInfo,a=t.fieldExtractor,l=t.value,u=t.type,s=t.sourceField,c=l||("dimension"===u?function(e){return e.qElemNo}:function(e){return e.qValue}),f=function(e){return e.qText||""},d="dimension"===u?"first":"avg",p=tr(n,i),h="dimension"===u?"first":function(e,t){return p(t)},m={id:function(){return r},key:function(){return o},raw:function(){return n},title:function(){return n.qFallbackTitle||n.label},type:function(){return u},origin:function(){return s},items:function(){return e||(e=a(m)),e},min:function(){return n.qMin},max:function(){return n.qMax},value:c,label:f,reduce:d,reduceLabel:h,formatter:function(){return p},tags:function(){return n.qTags}};return m}function rr(e,t,n,r,o){return(t[e]||[]).map((function(t,i){var a="".concat(r?"".concat(r,"/"):"").concat(e,"/").concat(i),l={instance:nr($t({id:"".concat(n?"".concat(n,"/"):"").concat(a),key:a,meta:t},o))};return l.attrDims=rr("qAttrDimInfo",t,n,a,$t({},o,{value:function(e){return e.qElemNo},type:"dimension"})),l.attrExps=rr("qAttrExprInfo",t,n,a,$t({},o,{value:function(e){return e.qNum},type:"measure"})),l.measures=rr("qMeasureInfo",t,n,a,$t({},o,{value:function(e){return e.qValue},type:"measure"})),l}))}function or(){var e,t,n,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=r.key,i=r.data,a=r.config,l=void 0===a?{}:a,u={fields:[],wrappedFields:[],allFields:[],virtualFields:[]},s=i;if(!s)throw new Error('Missing "data" input');if(!s.qDimensionInfo)throw new Error('The "data" input is not recognized as a hypercube');var c=or.util,f={cache:u,cube:s,localeInfo:l.localeInfo,fieldExtractor:null,pages:null,hierarchy:function(){return null},virtualFields:l.virtualFields},d={key:function(){return o},raw:function(){return s},field:function(e){return fn(e,f)},fields:function(){return u.fields.slice()},extract:function(e){return f.extractor(e,d,u,c)},hierarchy:function(e){return f.hierarchy(e,d,u,c)},_cache:function(){return u}};"K"===s.qMode||"T"===s.qMode||!s.qMode&&s.qNodesOnDim?(f.extractor=Cn,f.hierarchy=Mn,f.pages="K"===s.qMode?s.qStackedDataPages:s.qTreeDataPages):"S"===s.qMode?(f.extractor=Gt,f.pages=s.qDataPages,f.hierarchy=Mn):f.extractor=function(){return[]},f.fieldExtractor=function(e){return f.extractor({field:e},d,u,c)};var p="S"===s.qMode?function(e){return e.qElemNumber}:void 0,h="S"===s.qMode?function(e){return e.qNum}:void 0;(e=u.wrappedFields).push.apply(e,Tt(rr("qDimensionInfo",s,o,"",$t({},f,{value:p,type:"dimension"})))),(t=u.wrappedFields).push.apply(t,Tt(rr("qMeasureInfo",s,o,"",$t({},f,{value:h,type:"measure"})))),u.fields=u.wrappedFields.map((function(e){return e.instance}));var m=function e(t){t.forEach((function(t){u.allFields.push(t.instance),e(t.measures),e(t.attrDims),e(t.attrExps)}))};return m(u.wrappedFields),(l.virtualFields||[]).forEach((function(e){var t=d.field(e.from),n=nr(Ot({meta:t.raw(),id:"".concat(o,"/").concat(e.key),sourceField:t,fieldExtractor:function(e){return f.extractor({field:e},d,u,c)},key:e.key,type:t.type(),localeInfo:f.localeInfo,value:t.value},e.override||{}));u.virtualFields.push(n)})),(n=u.allFields).push.apply(n,Tt(u.virtualFields)),d}var ir=[["qHyperCube","qHyperCubeDef"],["qTreeData","qTreeDataDef"],["qDimensionInfo","qDimensions"],["qMeasureInfo","qMeasures"],["qAttrDimInfo","qAttributeDimensions"],["qAttrExprInfo","qAttributeExpressions"]],ar=/\/qDimensionInfo(?:\/(\d+))?/,lr=/\/qMeasureInfo\/(\d+)/,ur=/\/qAttrDimInfo\/(\d+)(?:\/(\d+))?/,sr=/\/qAttrExprInfo\/(\d+)/,cr=/\/?qHyperCube/,fr=/\/?qTreeData/,dr=function(e){return"".concat(e.substr(0,e.indexOf("/qHyperCubeDef")+14))},pr=function(e){return"".concat(e.substr(0,e.indexOf("/qTreeDataDef")+13))};function hr(e,t){var n=e,r=-1,o=-1,i="",a=function(e){return e};cr.test(e)?(i="".concat(n.substr(0,n.indexOf("qHyperCube")+10)),a=dr):fr.test(e)&&(i="".concat(n.substr(0,n.indexOf("qTreeData")+9)),a=pr);var l=!0;if(ar.test(e)&&(r=+ar.exec(e)[1]),lr.test(e)&&(o=+lr.exec(e)[1]),ur.test(e)){o=-1,r=0;var u=+ur.exec(n)[2];isNaN(u)||(r=u,n=n.replace(/\/\d+$/,"")),l=!1}if(sr.test(e)){var s=o;if(t){o=0;var c=un(i,t);o+=(c.qMeasureInfo||[]).length,r>-1?(o=c.qDimensionInfo.slice(0,r).reduce((function(e,t){return e+t.qAttrExprInfo.length}),o),r=-1):(o=c.qDimensionInfo.reduce((function(e,t){return e+t.qAttrExprInfo.length}),o),o=c.qMeasureInfo.slice(0,s).reduce((function(e,t){return e+t.qAttrExprInfo.length}),o)),o+=+sr.exec(n)[1]}else r>-1?(r=-1,o=+sr.exec(n)[1]):o+=+sr.exec(n)[1]+1}return ir.forEach((function(e){var t=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,i=void 0;try{for(var a,l=e[Symbol.iterator]();!(r=(a=l.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==l.return||l.return()}finally{if(o)throw i}}return n}}(e,t)||jt(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.")}()}(e,2),r=t[0],o=t[1];n=n.replace(r,o)})),l&&(n=a(n)),n&&"/"!==n[0]&&(n="/".concat(n)),{measureIdx:o,dimensionIdx:r,path:n}}function mr(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,o=n.byCells,i=n.primarySource,a=[],l={},u=e.isActive(),s=!1;return e.brushes().forEach((function(e){var t=hr(e.id,r);if("range"===e.type&&t.measureIdx>-1&&t.dimensionIdx>-1){var n=e.brush.ranges();n.length&&(s=!0,l.multiRangeSelectTreeDataValues||(l.multiRangeSelectTreeDataValues={path:t.path,ranges:[]}),n.forEach((function(e){return l.multiRangeSelectTreeDataValues.ranges.push({qMeasureIx:t.measureIdx,qDimensionIx:t.dimensionIdx,qRange:{qMin:e.min,qMax:e.max,qMinInclEq:!0,qMaxInclEq:!0}})})))}else{if("range"===e.type&&t.measureIdx>-1){var u=e.brush.ranges();u.length&&(s=!0,l.rangeSelectHyperCubeValues||(l.rangeSelectHyperCubeValues={path:t.path,ranges:[]}),u.forEach((function(e){return l.rangeSelectHyperCubeValues.ranges.push({qMeasureIx:t.measureIdx,qRange:{qMin:e.min,qMax:e.max,qMinInclEq:!0,qMaxInclEq:!0}})})))}if("range"===e.type&&t.dimensionIdx>-1){var c=e.brush.ranges();c.length&&(s=!0,l.selectHyperCubeContinuousRange||(l.selectHyperCubeContinuousRange={path:t.path,ranges:[]}),c.forEach((function(e){return l.selectHyperCubeContinuousRange.ranges.push({qDimIx:t.dimensionIdx,qRange:{qMin:e.min,qMax:e.max,qMinInclEq:!0,qMaxInclEq:!1}})})))}if("value"===e.type&&t.dimensionIdx>-1)if(o)if(r&&r.qHyperCube&&("P"===r.qHyperCube.qMode||"T"===r.qHyperCube.qMode||"K"===r.qHyperCube.qMode)){var f=r.qHyperCube,d=f.qNoOfLeftDims,p=f.qEffectiveInterColumnSortOrder.indexOf(t.dimensionIdx);if(l.selectPivotCells||(l.selectPivotCells={path:t.path,cells:[]}),e.id===i||!i){var h=e.brush.values().map((function(e){return+e})).filter((function(e){return!isNaN(e)}));(0===d||p>=d)&&d>-1?h.forEach((function(e){l.selectPivotCells.cells.push({qType:"T",qCol:e,qRow:p-d})})):h.forEach((function(e){l.selectPivotCells.cells.push({qType:"L",qCol:t.dimensionIdx,qRow:e})})),s=!!l.selectPivotCells.cells.length}}else l.selectHyperCubeCells||(l.selectHyperCubeCells={path:t.path,cols:[]}),l.selectHyperCubeCells.cols.push(t.dimensionIdx),e.id!==i&&(i||l.selectHyperCubeCells.values)||(l.selectHyperCubeCells.values=e.brush.values().map((function(e){return+e})).filter((function(e){return!isNaN(e)})),s=!!l.selectHyperCubeCells.values.length);else{var m=e.brush.values().map((function(e){return+e})).filter((function(e){return!isNaN(e)}));s=!!m.length,a.push({params:[t.path,t.dimensionIdx,m,!1],method:"selectHyperCubeValues"})}}})),!s&&u?[{method:"resetMadeSelections",params:[]}]:(l.rangeSelectHyperCubeValues&&a.push({method:"rangeSelectHyperCubeValues",params:[l.rangeSelectHyperCubeValues.path,l.rangeSelectHyperCubeValues.ranges,[],null===(t=n.orMode)||void 0===t||t]}),l.selectHyperCubeContinuousRange&&a.push({method:"selectHyperCubeContinuousRange",params:[l.selectHyperCubeContinuousRange.path,l.selectHyperCubeContinuousRange.ranges]}),l.selectHyperCubeCells&&a.push({method:"selectHyperCubeCells",params:[l.selectHyperCubeCells.path,l.selectHyperCubeCells.values,l.selectHyperCubeCells.cols]}),l.selectPivotCells&&a.push({method:"selectPivotCells",params:[l.selectPivotCells.path,l.selectPivotCells.cells]}),l.multiRangeSelectTreeDataValues&&a.push({method:"multiRangeSelectTreeDataValues",params:[l.multiRangeSelectTreeDataValues.path,l.multiRangeSelectTreeDataValues.ranges]}),a)}function vr(e){or.util=e.data("matrix").util,e.data("q",or),e.formatter("q-number",Un),e.formatter("q-time",er)}function gr(e){var t=function(e,t,n){if(void 0===e||void 0===t)return n;for(var r=t.split("."),o=e,i=0;i<r.length;++i){var a=r[i];if(void 0===o[a])return n;o=o[a]}return o}(e.layout||{},e.path.split("/").join("."));if(!t)return!1;var n=t.qIsOneAndOnlyOne;return void 0!==n&&n}function yr(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(null==e||!e.length)return!1;var t=e.filter((function(e){return"object"===S(e.data)&&Array.isArray(e.data.fields)})).every((function(e){return e.data.fields.every((function(e){var t=e.raw();return!(!t.qLocked&&t.qCardinal)}))}));return t}function br(e){var t=e.brush,n=e.colorField,r=e.legendAlias,o=e.useLegendCube,i=void 0!==o&&o;!n||/qAttrDimInfo/.test(n)?(t.removeKeyAlias("attrDim/qDimensionInfo/0"),r&&t.removeKeyAlias(r),t.addKeyAlias("attrDim/qDimensionInfo/0","qHyperCube/".concat(n))):i&&t.addKeyAlias(r,"qHyperCube/".concat(n))}vr.qBrushHelper=mr,vr.selections=mr;function xr(e){var t=e.brush,n=e.getConfig;return{interceptor:function(e){var r=t.brushes(),o=n(),i=o.allowSimultaneous,a=o.layout,l=void 0===a?{}:a;r.forEach((function(n){var r,o,a;("range"===n.type||null!==(r=e[0])&&void 0!==r&&r.key&&(null===(o=e[0])||void 0===o?void 0:o.key)!==n.id&&0!==i.indexOf(null===(a=e[0])||void 0===a?void 0:a.key))&&t.clear([])}));var u=e.filter((function(e){return-2!==e.value}));return u.length>1?function(e){var t=e.layout,n=void 0===t?{}:t,r=e.values,o=void 0===r?[]:r;if(null==o||!o.length)return[];var i=Array.from(new Set(o.map((function(e){return e.key})))),a=[];return i.forEach((function(e){var t=gr({layout:n,path:e}),r=o.filter((function(t){return t.key===e})),i=t?[r.pop()]:r;a.push.apply(a,L(i))})),a.filter(Boolean)}({layout:l,values:u}):u},rangeInterceptor:function(e){var r=t.brushes(),o=n().allowSimultaneous;return r.filter((function(e){return"value"===e.type})).length?(t.clear([]),e):(r.forEach((function(n){var r=n.id===e[0].key||o.includes(n.id)&&o.includes(e[0].key);"range"!==n.type||r||t.clear([])})),e)}}}var qr=[],Dr=0,wr=function(e){var t=qr.filter((function(e){var t;return null===(t=e.selections)||void 0===t?void 0:t.isActive()}));t.length&&("Enter"===e.key?t.forEach((function(e){return e.selections.confirm()})):"Escape"!==e.key&&"Esc"!==e.key||t.forEach((function(e){return e.selections.cancel()})))},Mr=function(){document.addEventListener("keyup",wr)},Cr=function(){document.removeEventListener("keyup",wr)},Ir=function(e,t){Object.keys(t).forEach((function(n){e.on(n,t[n])}))},kr=function(e,t){Object.keys(t).forEach((function(n){e.removeListener(n,t[n])}))};function Sr(e,t,n){if(t&&void 0!==n&&"selectHyperCubeContinuousRange"===e.method){var r=e.params;if(r&&r[1]&&r[1][0]){var o=r[1][0],i=o.qDimIx,a=o.qRange;"undefined"!==i&&a&&!1===a.qMaxInclEq&&a.qMax>=n&&(a.qMaxInclEq=!0)}}}function Ar(e){var t=e.chart,n=e.document,r=e.selectionInfo,o=e.eventName,i=e.componentName,a=e.brushName,l=void 0===a?"selection":a,u=e.emit,s=void 0===u?"rangeClear":u,c=r.event===o,f=n.querySelector("[data-key='".concat(i,"-edge-0']"));if(c||!f)return!1;var d=t.component(i);return!!d&&(d.emit(s),"string"==typeof l&&t.brush(l).clear(),d)}function Or(e){var t=e.selectionInfo,n=e.chart,r=e.document,o=e.eventName,i=void 0===o?"discreteRange":o,a=e.componentName,l=void 0===a?"discrete-range-brush":a,u=e.cleared;return Ar({selectionInfo:t,chart:n,document:r,eventName:void 0!==u&&u?void 0:i,componentName:l,emit:"areaClear",brushName:e.brushName})}function Nr(e){var t=e.selectionInfo,n=e.chart,r=e.document,o=e.eventName,i=void 0===o?"continuousRange":o,a=e.componentName,l=void 0===a?"continuous-range-brush":a,u=e.cleared;return Ar({selectionInfo:t,chart:n,document:r,eventName:void 0!==u&&u?void 0:i,componentName:l,brushName:e.brushName})}function Er(e){var t=e.selectionInfo,n=e.chart,r=e.document,o=e.componentName,i=void 0===o?"minor-range-brush":o,a=e.eventName,l=void 0===a?"minorRange":a,u=e.cleared,s=void 0!==u&&u,c=e.brushName,f=Ar({selectionInfo:t,chart:n,document:r,eventName:s?void 0:l,componentName:i,brushName:void 0!==c&&c});if(f){var d=f.settings.settings,p=d.scale,h=d.brush,m=n.scale(p).data().fields.map((function(e){return e.id()})),v=n.brush(h),g=v.brushes().filter((function(e){return"range"===e.type&&m.some((function(t){return t===e.id}))}));v&&g.length&&g.forEach((function(e){v.removeRanges(e.brush.ranges().map((function(t){return{key:e.id,range:t}})))}))}}function Pr(e){var t=e.selectionInfo,n=e.chart,r=e.document,o=e.selections,i=e.eventName,a=void 0===i?"xAxis":i,l=e.cleared;Ar({selectionInfo:t,chart:n,document:r,eventName:void 0!==l&&l?void 0:a,componentName:"".concat(a,"-range-brush"),emit:"areaClear",brushName:!1})&&o.clear()}function Tr(e){var t=e.chart,n=e.selectionInfo,r=e.selections,o=e.events,i=void 0===o?["tap"]:o,a=e.brushNames,l=void 0===a?[]:a;if(n&&i.includes(n.event)){var u=n.currentComponent;n.previousComponent!==u&&(r.clear(),l.forEach((function(e){return t.brush(e).end()})))}}function jr(e){var t=e.selectionInfo,n=e.chart,r=e.document,o=e.selections,i=e.eventName,a=void 0===i?"legendRange":i,l=e.componentName,u=void 0===l?"legend-range-brush":l,s=e.cleared,c=void 0!==s&&s,f=e.brushName;Ar({selectionInfo:t,chart:n,document:r,eventName:c?void 0:a,componentName:u,brushName:void 0!==f&&f})&&o.clear()}var Lr=function(e){e.chart,e.document,e.selections,e.selectionInfo;var t=T(e,["chart","document","selections","selectionInfo"]);t.clearDiscrete(),t.clearContinuous(),t.clearMinor(),t.clearRange(),t.clearTap(),t.clearLegend()};function Rr(e){var t,n=e.lasso;null!=n&&null!==(t=n.active)&&void 0!==t&&t.call(n)&&(null==n||n.action(!1))}function Fr(e){var t,n=e.chart,r=e.selectionInfo,o=e.selectionActions,i=e.actions,a=void 0===i?{}:i,l=e.selections,u=e.selectionEvents;if(!1===o||!1===u)return function(){};var s=(a||{}).lasso,c=void 0!==s&&s,f=o.reset,d=void 0===f?Rr:f,p=o.clear,h=!1!==p&&function(e){var t=e.clear,n=void 0===t?Lr:t,r=e.selections,o=e.selectionInfo,i=e.chart;return function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).cleared,t={selections:r,selectionInfo:o,chart:i,document:document,cleared:e};return n(P({clearDiscrete:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Or(P(P({},t),e))},clearContinuous:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Nr(P(P({},t),e))},clearMinor:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Er(P(P({},t),e))},clearRange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Pr(P(P({},t),e))},clearTap:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Tr(P(P({},t),e))},clearLegend:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return jr(P(P({},t),e))}},t))}}({clear:p,selections:l,selectionInfo:r,chart:n}),m=function(e){var t=e.chart,n=e.lasso,r=e.reset,o=e.clear,i=!1,a={deactivated:function(e){r({e:e,lasso:n})},canceled:function(e){r({e:e,lasso:n}),o({e:e,chart:t,document:document})},cleared:function(e){i||(i=!0,o({e:e,chart:t,document:document,cleared:!0}),i=!1)}};return!1===r&&delete a.deactivated,!1===o&&delete a.cleared,!1===r&&!1===o&&delete a.canceled,a}({chart:n,clear:h,reset:d,lasso:c}),v={};Object.entries(m).forEach((function(e){var t=j(e,2),n=t[0],r=t[1];v[n]=function(e,t){return t?function(n){return t({event:n,defaultFunc:e})}:e}(r,u[n])}));var g=function(e){var t=e.selectionEvents,n=e.selections,r=e.selectionInfo,o=e.clear,i=e.chart,a=e.document,l=t.start,u={selections:n,selectionInfo:r,chart:i,document:a},s=function(e){return Object.assign(r,e||{})},c=function(e){var t=e.event,n=e.components;return function(){return function(e){var t=e.selectionInfo,n=e.clear,r=e.event,o=e.components,i=void 0===o?[]:o;(0,e.setSelectionInfo)(P(P({},void 0===t?{}:t),{},{event:r,components:i.map((function(e){return e.key})).filter(Boolean)})),n()}({event:t,components:n,clear:o,chart:i,selectionInfo:r,setSelectionInfo:s})}};return"function"==typeof l?function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];l(P(P({defaultFunc:c({event:e,components:t}),setSelectionInfo:s,clear:o},u),{},{event:e,components:t}))}:function(e){c({event:e,components:arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]})()}}({selectionEvents:u,selections:l,selectionInfo:r,clear:h,chart:n,document:document});return null==a||null===(t=a.select)||void 0===t||t.on("start",g),Object.entries(v).forEach((function(e){var t=j(e,2),n=t[0],r=t[1];null==l||l.on(n,r)})),function(){var e;null==a||null===(e=a.select)||void 0===e||e.removeListener("start",g),Object.entries(v).forEach((function(e){var t=j(e,2),n=t[0],r=t[1];null==l||l.removeListener(n,r)}))}}var Hr=[{key:"qHyperCube/qDimensionInfo/0:numeric",includeMax:!1}];function Vr(e){var t=e.chart,n=e.actions,r=e.selections,o=e.picassoQ,i=e.config,a=i.allowSimultaneous,l=void 0!==a&&a,u=i.majorScale,s=void 0===u?void 0:u,c=i.selectionActions,f=(c=void 0===c?{}:c).clear,d=c.reset,p=i.selectionEvents,h=void 0===p?{deactivated:void 0,canceled:void 0,cleared:void 0,start:void 0}:p,m=i.brushEvents,v=void 0===m?{}:m,g=i.brushName,y=void 0===g?"selection":g,b=i.brushMaxListeners,x=void 0===b?20:b,q=i.brushRanges,D=void 0!==q&&q,w=i.interceptors,M=void 0===w?{}:w,C=i.selectionsFn,I=void 0===C?o.selections:C,k=t.brush(y);if("number"==typeof x&&k.setMaxListeners(x),D){var S=!0===D?Hr:D;k.configure({ranges:S})}var A={canSelect:!0,getIsSelectionLocked:!1,isInnerDimensionLocked:!1,lockedDimensions:[],singleSelectIndex:0,singleSelectDims:[],selectionInfo:{colorField:void 0,components:[],event:void 0,currentComponent:void 0,previousComponent:void 0}},O=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.selections,r=t.brush,o=t.majorScale,i=t.actions,a=t.selectionsFn,l=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).path,u=void 0===l?"/qHyperCubeDef":l;if(!n)return{layout:function(){},allowSimultaneous:function(){},release:function(){}};var s=++Dr,c=null,f=[],d={};n.on=n.on.bind(n),n.isActive=n.isActive.bind(n),n.addListener=n.addListener.bind(n),n.removeListener=n.removeListener.bind(n);var p=xr({brush:r,getConfig:function(){return{layout:c,allowSimultaneous:f}}}),h=p.rangeInterceptor,m=p.interceptor;r.intercept("set-ranges",h),r.intercept("toggle-ranges",h),r.intercept("toggle-values",m),r.intercept("set-values",m),r.intercept("add-values",m),r.on("start",(function(){return n.begin(u)}));var v={activate:function(){},deactivated:function(){return r.end()},cleared:function(){return r.clear()},canceled:function(){return r.end()}};Ir(n,v);var g=null==o||null===(e=o.max)||void 0===e?void 0:e.call(o);return null!=i&&i.select?(i.select.on("start",(function(){var e;r.start(),"function"==typeof i.select.getBrushOptions&&(d=(e=i.select).getBrushOptions.apply(e,arguments))})),i.select.on("end",(function(){a(r,d,c).forEach((function(e){Sr(e,i.select.brushSelectionIncludeMax,g),n.select(e)}))}))):r.on("update",(function(){a(r,d,c).forEach((function(e){return n.select(e)}))})),0===qr.length&&Mr(),qr.push({key:s,selections:n}),{layout:function(e){c=e},allowSimultaneous:function(e){f=e},release:function(){c=null;var e=qr.indexOf(qr.filter((function(e){return e.key===s}))[0]);-1!==e&&qr.splice(e,1),qr.length||Cr(),kr(n,v)}}}({brush:k,majorScale:s,actions:n,selections:r,picassoQ:o,selectionsFn:I});!function(e){var t=e.brush,n=e.interceptors,r=void 0===n?{}:n;Object.entries(r).forEach((function(e){var n=j(e,2),r=n[0],o=n[1];(Array.isArray(o)?o:[o]).forEach((function(e){t.intercept(r,e)}))}))}({brush:k,interceptors:M});var N=function(e){var t=e.chart,n=e.selectionActions,r=e.brush,o=e.actions,i=e.selectionInfo,a=e.selections,l=e.selectionEvents,u=function(e){var t=e.brush,n=e.chart,r=e.selectionInfo,o=e.brushEvents,i=void 0===o?{}:o,a=Object.entries(i).map((function(e){var o=j(e,2),i=o[0],a=o[1],l=function(){return a({chart:n,selectionInfo:r})};return t.on(i,l),[i,l]}));return function(){a.forEach((function(e){var n=j(e,2),r=n[0],o=n[1];t.removeListener(r,o)}))}}({brush:r,chart:t,selectionInfo:i,brushEvents:e.brushEvents}),s=Fr({chart:t,selectionInfo:i,selectionActions:n,actions:o,selections:a,selectionEvents:l}),c=function(e){var t=e.actions;if(null==t||!t.lasso)return function(){};var n=!1,r=function(e){n||"Shift"!==e.key||(t.lasso.action(!0),n=!0)},o=function(e){"Shift"===e.key&&(t.lasso.action(!1),n=!1)};return document.addEventListener("keydown",r),document.addEventListener("keyup",o),function(){document.removeEventListener("keydown",r),document.removeEventListener("keyup",o)}}({actions:o});return function(){u(),s(),c()}}({chart:t,brush:k,actions:n,selections:r,selectionInfo:A.selectionInfo,selectionActions:{clear:f,reset:d},selectionEvents:h,brushEvents:v});if(l){var E=!0===l?L(Array(15)).map((function(e,t){return"qHyperCube/qMeasureInfo/".concat(t)})):l;O.allowSimultaneous(E)}return{unbindEvents:N,state:A,picassoSelections:O,brush:k}}function _r(e){var t=e.chart,n=e.selections,r=e.actions,o=void 0!==r&&r,i=e.config,a=void 0===i?{}:i,l=Vr({chart:t,actions:o,selections:n,picassoQ:vr,config:a}),u=l.unbindEvents,s=l.state,c=l.picassoSelections,f=l.brush,d=a.custom,p=void 0===d?{}:d,h=a.legendAlias,m=void 0===h?void 0:h,v=a.setBrushAliases,g=void 0===v?br:v;return{getIsDimensionLocked:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return s.lockedDimensions[e]},getIsSelectionLocked:function(){var e,t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return null!==(e=null==n||null===(t=n.isLocked)||void 0===t?void 0:t.call(n))&&void 0!==e?e:yr(r)},getIsSingleSelect:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:s.singleSelectIndex;return s.singleSelectDimensions[e]},getCanSelect:function(){return s.canSelect},getSelectionInfo:function(){return s.selectionInfo},setLayout:function(e){var t=function(e){var t,n,r,o=e.selections,i=e.picassoSelections,a=e.layout,l={lockedDimensions:[],singleSelectDimensions:[]};null!=o&&null!==(t=o.isModal)&&void 0!==t&&t.call(o)&&o.confirm(),i.layout(a);var u=(null!==(n=null==a?void 0:a.qHyperCube)&&void 0!==n?n:{}).qDimensionInfo,s=void 0===u?[]:u;return l.lockedDimensions=s.map((function(e){return!!e.qLocked})),l.singleSelectDimensions=s.map((function(e,t){return gr({layout:a,path:"qHyperCube/qDimensionInfo/".concat(t)})})),l.singleSelectIndex=function(e){var t,n=((null==e?void 0:e.qHyperCube)||{}).qDimensionInfo,r=void 0===n?[]:n;return null!==(t=r.map((function(e,t){var n;return!(e.qLocked||(null===(n=e.qCardinalities)||void 0===n?void 0:n.qHypercubeCardinal)<=1)&&t})).filter((function(e){return"number"==typeof e}))[0])&&void 0!==t?t:Math.max(r.length-1,0)}(a),l.canSelect=0===s.length||s.some((function(e){return!e.qLocked})),l.dimensionLocked=!(null===(r=s[0])||void 0===r||!r.qLocked),l}({selections:n,picassoSelections:c,layout:e});Object.assign(s,t)},setBrushAliases:function(e){var t=e.colorField,n=e.useLegendCube,r=void 0!==n&&n,o=T(e,["colorField","useLegendCube"]),i=P({useLegendCube:r,colorField:t,brush:f,legendAlias:m},o);g(P(P({},i),{},{defaultFunc:function(){return br(i)}}))},destroy:function(){u(),c.release()},custom:P({},p)}}function zr(e){const t=e.node.desc&&e.node.desc.share;return t?e.formatter("share")(t):""}function Br(e){return e.formatter("num")(e.node.data.num.value)}function Ur({data:e}){return e?e.label:""}function $r(e){if(e.dataPoint.auto)return zr;switch(e.dataPoint.labelMode){case"share":return zr;case"value":return Br;case"none":return null;default:return zr}}function Kr(e,t){const n=(n,r=1)=>({component:"fun",selector:n,strategy:{type:"rows",settings:{align:r,fill:".labelCenter"===n?({node:e})=>t.getContrastingColorTo(e.desc.fill):t.getStyle("","","color"),labels:".labelCenter"===n?[{label:$r(e)}]:[{label:Ur}]}}});return{key:"funnel-labels",type:"labels",layout:{displayOrder:2},settings:{sources:[n(".labelLeft",0),n(".labelCenter",.5)]},animations:{enabled:!0}}}function Wr(e){if(!e.showDimensionTitle||!e.qHyperCube.qDimensionInfo[0].qFallbackTitle)return!1;return{key:"dimension-title",type:"text",text:e.qHyperCube.qDimensionInfo[0].qFallbackTitle,layout:{dock:"top"},animations:{enabled:!0}}}function Yr({picasso:e}){const t=n(),c=r(),f=o(),d=i(),p=a(),h=l(),[m,v]=u(),[g,y]=u(),[b,x]=u();return s((()=>{const n=function(e){var t,n,r,o,i=e.picasso,a=e.model,l=e.app,u=e.translator,s=e.layoutService,c=void 0===s?void 0:s,f=e.createConfig,d=void 0===f?Dt:f,p=e.config,h=void 0===p?{}:p,m=e.custom,v=void 0===m?{}:m,g=h.localeInfo,y=h.key,b=h.theme,x=void 0===b?void 0:b,q=h.auto,D=void 0===q?void 0:q,w=h.definitionPath,M=null==c||null===(t=c.getLayout)||void 0===t?void 0:t.call(c),C={theme:x,key:y,localeInfo:g,layout:M,hc:null==c||null===(n=c.getHyperCube)||void 0===n?void 0:n.call(c),legendProps:null==c||null===(r=c.getLayoutValue)||void 0===r?void 0:r.call(c,"legend"),colorProps:P(P({},null==c||null===(o=c.getLayoutValue)||void 0===o?void 0:o.call(c,"color")),{},{useBaseColors:M?yt(M):void 0})},I=vt({picasso:i,model:a,app:l,translator:u,auto:D});!1!==D&&I.auto((function(e){return D?D({layout:e,defaultAuto:qt}):qt(e)}));var k=!1;return{getColor:function(){return I.color()},getPaletteColor:function(e){var t=e.index,n=e.color;return I.resolveUIColor({index:t,color:n})},getData:function(){return I.data()},getDatumProps:function(e){return I.datumProps(e)},getSnapshotData:function(){return I.getSnapshotData(w)},getSettingsForMeasure:function(e){return I.settingsForMeasure(e)},getSettings:function(){return I.settings()},getLegend:function(e,t){return I.legend(e,t)},getScales:function(){return I.scales()},getPalettes:function(){return I.palettes()},isSelectionLocked:function(e){var t=e.isMeasureSelectionLocked;return I.isSelectionLocked({isMeasureSelectionLocked:t})},isInitialized:function(){return k},custom:P({},v),initialize:function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).createConfig,t=(void 0===e?d:e)({getUseBaseColors:yt}),n=bt(C,t);return I.config(n),I.getAuxiliarySettings(w).then((function(){k=!0}))}}}({picasso:e,model:f,app:d,translator:p,config:{auto:!1,key:"fill"}});t.style.overflow="hidden";const r=e({renderer:{prio:[h.renderer||"svg"]}}).chart({element:t,data:[],settings:{}}),o=_r({chart:r,selections:c,config:{selectionActions:!1}});return x(o),y(n),v(r),()=>{o.destroy(),r.destroy()}}),[]),[m,g,b]}function Gr({picasso:e}){const t=c(),n=f(),r=d(),o=p(),i=h(),a=m().qLocaleInfo,[l,u,y]=Yr({picasso:e,layout:t}),[b]=v((()=>{if(!u)return Promise.resolve();const r=function(e){return{layout:e,keys:{SCALE:{FILL:"fill"},COMPONENT:{FUNNEL:"fun",FUNNEL_LABELS:"funnel-labels",DIMENSION_TITLE:"dimension-title"}}}}(t),o=function(e){var t=e.picassoInstance,n=e.plugins,r=e.pluginArgs,o=void 0===r?{}:r,i={initialized:!1,definitions:[]};return{initialize:function(){return O(regeneratorRuntime.mark((function e(){var r,a,l,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!i.initialized){e.next=2;break}return e.abrupt("return");case 2:return a=Promise.all(n.filter((function(e){return"custom-component"===e.info.type})).map(function(){var e=O(regeneratorRuntime.mark((function e(n){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n.info.componentName){e.next=2;break}throw new Error("plugin-service: Custom component is missing componentName");case 2:return e.next=4,n.fn(P({},o));case 4:if("object"===S(r=e.sent)){e.next=7;break}throw new Error("plugin-service: Custom component needs to be an object");case 7:t.component(n.info.componentName,r);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())),l=Promise.all(n.filter((function(e){return"component-definition"===e.info.type})).map((function(e){return e.fn(P({},o))}))),e.next=6,Promise.all([a,l]);case 6:u=e.sent,i.initialized=!0,(r=i.definitions).push.apply(r,L(u[1]));case 9:case"end":return e.stop()}}),e)})))()},extendComponents:function(e){return i.initialized?(i.definitions.filter(Boolean).forEach((function(t){var n=j(e.filter((function(e){return e.key&&e.key===t.key})),1)[0];if(n){var r=W(!0,{},n.brush);W(!0,n,t),t.brush&&(n.brush=function(e,t){return"object"===S(e)&&Object.keys(e).length?(Array.isArray(t.consume)&&(e.consume=wt({originalArray:e.consume,newArray:t.consume,matchKey:"context"})),Array.isArray(t.trigger)&&(e.trigger=wt({originalArray:e.trigger,newArray:t.trigger,matchKey:"on"})),e):t}(r,t.brush))}else e.push(t)})),e):e}}}({picassoInstance:e,plugins:i,pluginArgs:r});return Promise.all([u.initialize({createConfig:({getUseBaseColors:e})=>({theme:n,colorProps:{...t.color,useBaseColors:e(t)},layout:t,hc:t.qHyperCube})}),o.initialize()]).then((()=>o))}),[t,u]);s((()=>{if(!l||!u||!b)return;const e=[{type:"q",key:"qHyperCube",data:t.qHyperCube,config:{localeInfo:a}},...u.getData()],o=function({layout:e,constraints:t,colorService:n,theme:r,pluginService:o}){const i=function(e){return{...e.getScales()}}(n),a=n.getPalettes(),l=[function({layout:e,constraints:t,colorService:n}){const r=n.getDatumProps(),o=n.getColor();return{type:"funnel",key:"fun",data:{extract:{field:"qDimensionInfo/0",props:{num:{field:"qMeasureInfo/0"},...r}}},brush:t.select||t.active?{}:{trigger:[{contexts:["selection"],data:[""]}],consume:[{context:"selection",filter:e=>"section"===e.tag,style:{inactive:{opacity:.3}}}]},settings:{num:{ref:"num"},fill:o,mode:e.funnel.mode},animations:{enabled:!0,trackBy:e=>`${e.tag}: ${e.data.value}`}}}({layout:e,constraints:t,colorService:n}),Kr(e,r),Wr(e)];return{palettes:a,style:{"$font-family":r.getStyle("","","fontFamily"),"$font-color":r.getStyle("","","color"),"$font-size":r.getStyle("","","fontSize")},scales:i,components:o.extendComponents(l),formatters:{share:{type:"d3-number",format:".1%"},num:{data:{field:"qMeasureInfo/0"}}}}}({layout:t,constraints:r,colorService:u,theme:n,pluginService:b});l.update({data:e,settings:o})}),[l,u,n.name(),b,r]),s((()=>{l&&l.update()}),[o.width,o.height]),s((()=>{y&&y.setLayout(t)}),[t]),g((e=>u.getSnapshotData().then((t=>(e.snapshotData=e.snapshotData||{},e.snapshotData.content=e.snapshotData.content||{},e.snapshotData.content.chartData=t,e))).catch((()=>e))))}function Zr(){const n=e();return n.use(t),n.component("funnel",M),{ext:I,qae:{properties:{initial:C},data:{targets:k}},component(){Gr({picasso:n})}}}export{Zr as default};