@nebula.js/sn-funnel-chart 1.6.6 → 1.7.0

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.6.6",
6
+ "version": "1.7.0",
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.6.6",
6
+ "version": "1.7.0",
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.6.6
2
+ * @nebula.js/sn-funnel-chart v1.7.0
3
3
  * Copyright (c) 2023 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 s,useEffect as u,useStaleLayout as c,useTheme as f,useConstraints as d,useRect as p,usePlugins as h,useAppLayout as m,usePromise as v,onTakeSnapshot as y}from"@nebula.js/stardust";const g={fill:"steelblue",num:1},b=.9,x=150,q=(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"}},w=(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;const r=e.slice().reverse().map((e=>{const r={datum:e,s:n/t,e:e.num/t};return n=e.num,r}));return r.reverse()})(e),r=t.width*b,o=t.height*b,i=(t.width-r)/2,a=(t.height-o)/2,l=r-(r>x&&o>x?100:0),s=(o-1*(n.length-1))/n.length,u=[];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=s*r+1*r+a,p={bottomRight:{x:o[2],y:Math.round(d+s)},bottomLeft:{x:o[3],y:Math.round(d+s)},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`;u.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};s>12&&(p.bottomRight.x-p.bottomLeft.x>32&&u.push(q("labelCenter",p,m)),u.push(q("labelLeft",p,m)))})),u},D=(e,t,n,r)=>(r-e)/r*(t-n)+n,C=(e,t,n)=>{const r=e.filter((e=>"NaN"!==e.num&&e.num>0)),o=r.length,i=n.width*b,a=n.height*b,l=Math.round((n.width-i)/2),s=Math.round((n.height-a)/2),u=i-(i>x&&a>x?100:0),c=a-1*(o-1),f=[],d=r[0].data.num.value;let p=s;return r.forEach(((e,r)=>{const o=t[r]*c,i=Math.round(D(p-s,u,.2*u,a)/2),h=Math.round(D(p-s+o,u,.2*u,a)/2),m=l+Math.round(u/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},y=`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:y,data:e.data,fill:e.fill});const g={share:e.data.num.value/d,fill:e.fill,data:e.data};o>2&&(v.bottomRight.x-v.bottomLeft.x>32&&f.push(q("labelCenter",v,g)),f.push(q("labelLeft",v,g))),p+=o+1})),f},I=(e,t,n)=>{const r=e.filter((e=>"NaN"!==e.num&&e.num>0));if(r&&r.length>0)switch(t){case"WIDTH":default:return w(r,n);case"ORDER":return C(r,r.map((()=>1/r.length)),n);case"HEIGHT":return C(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 C(r,((e,t,n)=>{const r=e.reduce(((e,t)=>e+t.data.num.value),0),o=t.width*b,i=t.height*b,a=o*n,l=i*(o+a)/2,s=(o-a)/2/i,u=[];let c=0;for(let t=e.length-1;t>=0;t--){const n=e[t].data.num.value/r,o=2*s*c+a,f=-o/(2*s)+Math.sqrt(o*o/(4*s*s)+n*l/s);u[t]=f/i,c+=f}return u})(r,n,.2),n)}return[]};var M={require:["resolver"],defaultSettings:{settings:{},data:{},style:{item:"$shape"}},render({data:e}){const t=this.resolver.resolve({data:e,defaults:{...g,...this.style.item},settings:this.settings.settings});return I(t.items,this.settings.settings.mode,this.rect)}};const k={version:"1.6.6",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 S={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 title",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 O=[{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 E(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var A=Object.prototype.hasOwnProperty,N=Object.prototype.toString,L=Object.defineProperty,P=Object.getOwnPropertyDescriptor,T=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===N.call(e)},F=function(e){if(!e||"[object Object]"!==N.call(e))return!1;var t,n=A.call(e,"constructor"),r=e.constructor&&e.constructor.prototype&&A.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!r)return!1;for(t in e);return void 0===t||A.call(e,t)},j=function(e,t){L&&"__proto__"===t.name?L(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},R=function(e,t){if("__proto__"===t){if(!A.call(e,t))return;if(P)return P(e,t).value}return e[t]},$=function e(){var t,n,r,o,i,a,l=arguments[0],s=1,u=arguments.length,c=!1;for("boolean"==typeof l&&(c=l,l=arguments[1]||{},s=2),(null==l||"object"!=typeof l&&"function"!=typeof l)&&(l={});s<u;++s)if(null!=(t=arguments[s]))for(n in t)r=R(l,n),l!==(o=R(t,n))&&(c&&o&&(F(o)||(i=T(o)))?(i?(i=!1,a=r&&T(r)?r:[]):a=r&&F(r)?r:{},j(l,{name:n,newValue:e(c,a,o)})):void 0!==o&&j(l,{name:n,newValue:o}));return l},H=E($);function _(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 z(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_(Object(n),!0).forEach((function(t){Y(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function V(){V=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,o){var i=t&&t.prototype instanceof d?t:d,a=Object.create(i.prototype),l=new I(o||[]);return r(a,"_invoke",{value:q(e,n,l)}),a}function c(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var f={};function d(){}function p(){}function h(){}var m={};s(m,i,(function(){return this}));var v=Object.getPrototypeOf,y=v&&v(v(M([])));y&&y!==t&&n.call(y,i)&&(m=y);var g=h.prototype=d.prototype=Object.create(m);function b(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function o(r,i,a,l){var s=c(e[r],e,i);if("throw"!==s.type){var u=s.arg,f=u.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){o("next",e,a,l)}),(function(e){o("throw",e,a,l)})):t.resolve(f).then((function(e){u.value=e,a(u)}),(function(e){return o("throw",e,a,l)}))}l(s.arg)}var i;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){o(e,n,t,r)}))}return i=i?i.then(r,r):r()}})}function q(e,t,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return{value:void 0,done:!0}}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var l=w(a,n);if(l){if(l===f)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=c(e,t,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}function w(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var o=c(r,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,f;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function D(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(D,this),this.reset(!0)}function M(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,o=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:k}}function k(){return{value:void 0,done:!0}}return p.prototype=h,r(g,"constructor",{value:h,configurable:!0}),r(h,"constructor",{value:p,configurable:!0}),p.displayName=s(h,l,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,s(e,l,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},b(x.prototype),s(x.prototype,a,(function(){return this})),e.AsyncIterator=x,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new x(u(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},b(g),s(g,l,"Generator"),s(g,i,(function(){return this})),s(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},e.values=M,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(C),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var l=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(l&&s){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),C(n),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;C(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:M(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},e}function B(e){return B="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},B(e)}function U(e,t,n,r,o,i,a){try{var l=e[i](a),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(r,o)}function W(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){U(i,r,o,a,l,"next",e)}function l(e){U(i,r,o,a,l,"throw",e)}a(void 0)}))}}function Y(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function K(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 G(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,l=[],s=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return l}}(e,t)||J(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 Z(e){return function(e){if(Array.isArray(e))return X(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||J(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 J(e,t){if(e){if("string"==typeof e)return X(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)?X(e,t):void 0}}function X(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 Q=Object.prototype.hasOwnProperty,ee=Object.prototype.toString,te=Object.defineProperty,ne=Object.getOwnPropertyDescriptor,re=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===ee.call(e)},oe=function(e){if(!e||"[object Object]"!==ee.call(e))return!1;var t,n=Q.call(e,"constructor"),r=e.constructor&&e.constructor.prototype&&Q.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!r)return!1;for(t in e);return void 0===t||Q.call(e,t)},ie=function(e,t){te&&"__proto__"===t.name?te(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},ae=function(e,t){if("__proto__"===t){if(!Q.call(e,t))return;if(ne)return ne(e,t).value}return e[t]},le=function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}((function e(){var t,n,r,o,i,a,l=arguments[0],s=1,u=arguments.length,c=!1;for("boolean"==typeof l&&(c=l,l=arguments[1]||{},s=2),(null==l||"object"!=typeof l&&"function"!=typeof l)&&(l={});s<u;++s)if(null!=(t=arguments[s]))for(n in t)r=ae(l,n),l!==(o=ae(t,n))&&(c&&o&&(oe(o)||(i=re(o)))?(i?(i=!1,a=r&&re(r)?r:[]):a=r&&oe(r)?r:{},ie(l,{name:n,newValue:e(c,a,o)})):void 0!==o&&ie(l,{name:n,newValue:o}));return l}));function se(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 ue(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 ce(e,t,n,r,o){var i,a,l=o.byRow,s=o.byElemNo;if(r&&(t.input.persistent||e.hc.qDimensionInfo.length>1||void 0===n.activeDimensionIndex&&e.hc.qSize.qcy>((null===(a=(i=e.hc).qDataPages[0]||i.qStackedDataPages[0])||void 0===a?void 0:a.qArea.qHeight)||0)))return s(r,r.raw().qCardinal);if(r){var u=t.pic.extract({field:r.key(),trackBy:r.value}).length;return l(r,u)}return{}}function fe(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 de(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 pe(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function he(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function me(){}var ve=1/.7,ye="\\s*([+-]?\\d+)\\s*",ge="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",be="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",xe=/^#([0-9a-f]{3,8})$/,qe=new RegExp(`^rgb\\(${ye},${ye},${ye}\\)$`),we=new RegExp(`^rgb\\(${be},${be},${be}\\)$`),De=new RegExp(`^rgba\\(${ye},${ye},${ye},${ge}\\)$`),Ce=new RegExp(`^rgba\\(${be},${be},${be},${ge}\\)$`),Ie=new RegExp(`^hsl\\(${ge},${be},${be}\\)$`),Me=new RegExp(`^hsla\\(${ge},${be},${be},${ge}\\)$`),ke={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 Se(){return this.rgb().formatHex()}function Oe(){return this.rgb().formatRgb()}function Ee(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=xe.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?Ae(t):3===n?new Te(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?Ne(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?Ne(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=qe.exec(e))?new Te(t[1],t[2],t[3],1):(t=we.exec(e))?new Te(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=De.exec(e))?Ne(t[1],t[2],t[3],t[4]):(t=Ce.exec(e))?Ne(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=Ie.exec(e))?_e(t[1],t[2]/100,t[3]/100,1):(t=Me.exec(e))?_e(t[1],t[2]/100,t[3]/100,t[4]):ke.hasOwnProperty(e)?Ae(ke[e]):"transparent"===e?new Te(NaN,NaN,NaN,0):null}function Ae(e){return new Te(e>>16&255,e>>8&255,255&e,1)}function Ne(e,t,n,r){return r<=0&&(e=t=n=NaN),new Te(e,t,n,r)}function Le(e){return e instanceof me||(e=Ee(e)),e?new Te((e=e.rgb()).r,e.g,e.b,e.opacity):new Te}function Pe(e,t,n,r){return 1===arguments.length?Le(e):new Te(e,t,n,null==r?1:r)}function Te(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function Fe(){return`#${He(this.r)}${He(this.g)}${He(this.b)}`}function je(){const e=Re(this.opacity);return`${1===e?"rgb(":"rgba("}${$e(this.r)}, ${$e(this.g)}, ${$e(this.b)}${1===e?")":`, ${e})`}`}function Re(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function $e(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function He(e){return((e=$e(e))<16?"0":"")+e.toString(16)}function _e(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ve(e,t,n,r)}function ze(e){if(e instanceof Ve)return new Ve(e.h,e.s,e.l,e.opacity);if(e instanceof me||(e=Ee(e)),!e)return new Ve;if(e instanceof Ve)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,s=(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/=s<.5?i+o:2-i-o,a*=60):l=s>0&&s<1?0:a,new Ve(a,l,s,e.opacity)}function Ve(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function Be(e){return(e=(e||0)%360)<0?e+360:e}function Ue(e){return Math.max(0,Math.min(1,e||0))}function We(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}pe(me,Ee,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Se,formatHex:Se,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return ze(this).formatHsl()},formatRgb:Oe,toString:Oe}),pe(Te,Pe,he(me,{brighter(e){return e=null==e?ve:Math.pow(ve,e),new Te(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?.7:Math.pow(.7,e),new Te(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Te($e(this.r),$e(this.g),$e(this.b),Re(this.opacity))},displayable(){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:Fe,formatHex:Fe,formatHex8:function(){return`#${He(this.r)}${He(this.g)}${He(this.b)}${He(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:je,toString:je})),pe(Ve,(function(e,t,n,r){return 1===arguments.length?ze(e):new Ve(e,t,n,null==r?1:r)}),he(me,{brighter(e){return e=null==e?ve:Math.pow(ve,e),new Ve(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?.7:Math.pow(.7,e),new Ve(this.h,this.s,this.l*e,this.opacity)},rgb(){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 Te(We(e>=240?e-240:e+120,o,r),We(e,o,r),We(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new Ve(Be(this.h),Ue(this.s),Ue(this.l),Re(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Re(this.opacity);return`${1===e?"hsl(":"hsla("}${Be(this.h)}, ${100*Ue(this.s)}%, ${100*Ue(this.l)}%${1===e?")":`, ${e})`}`}}));const Ye=Math.PI/180,Ke=180/Math.PI,Ge=4/29,Ze=6/29,Je=3*Ze*Ze;function Xe(e){if(e instanceof Qe)return new Qe(e.l,e.a,e.b,e.opacity);if(e instanceof ot)return it(e);e instanceof Te||(e=Le(e));var t,n,r=rt(e.r),o=rt(e.g),i=rt(e.b),a=et((.2225045*r+.7168786*o+.0606169*i)/1);return r===o&&o===i?t=n=a:(t=et((.4360747*r+.3850649*o+.1430804*i)/.96422),n=et((.0139322*r+.0971045*o+.7141733*i)/.82521)),new Qe(116*a-16,500*(t-a),200*(a-n),e.opacity)}function Qe(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}function et(e){return e>.008856451679035631?Math.pow(e,1/3):e/Je+Ge}function tt(e){return e>Ze?e*e*e:Je*(e-Ge)}function nt(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function rt(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function ot(e,t,n,r){this.h=+e,this.c=+t,this.l=+n,this.opacity=+r}function it(e){if(isNaN(e.h))return new Qe(e.l,0,0,e.opacity);var t=e.h*Ye;return new Qe(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}pe(Qe,(function(e,t,n,r){return 1===arguments.length?Xe(e):new Qe(e,t,n,null==r?1:r)}),he(me,{brighter(e){return new Qe(this.l+18*(null==e?1:e),this.a,this.b,this.opacity)},darker(e){return new Qe(this.l-18*(null==e?1:e),this.a,this.b,this.opacity)},rgb(){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 Te(nt(3.1338561*(t=.96422*tt(t))-1.6168667*(e=1*tt(e))-.4906146*(n=.82521*tt(n))),nt(-.9787684*t+1.9161415*e+.033454*n),nt(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}})),pe(ot,(function(e,t,n,r){return 1===arguments.length?function(e){if(e instanceof ot)return new ot(e.h,e.c,e.l,e.opacity);if(e instanceof Qe||(e=Xe(e)),0===e.a&&0===e.b)return new ot(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*Ke;return new ot(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}(e):new ot(e,t,n,null==r?1:r)}),he(me,{brighter(e){return new ot(this.h,this.c,this.l+18*(null==e?1:e),this.opacity)},darker(e){return new ot(this.h,this.c,this.l-18*(null==e?1:e),this.opacity)},rgb(){return it(this).rgb()}}));var at=e=>()=>e;function lt(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):at(isNaN(e)?t:e)}var st=function e(t){var n=function(e){return 1==(e=+e)?lt: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):at(isNaN(t)?n:t)}}(t);function r(e,t){var r=n((e=Pe(e)).r,(t=Pe(t)).r),o=n(e.g,t.g),i=n(e.b,t.b),a=lt(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),ut=/^class(-pyramid)?/,ct=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,s=t.limits,u={},c="percent"===t.limitType?s.map((function(e){return o+(i-o)*e})):s,f=t.colors.map((function(t){return e.resolveUIColor(t)}));if(o=Math.min.apply(Math,[o].concat(Z(c))),i=Math.max.apply(Math,[i].concat(Z(c))),u.min=o,u.max=i,t.breakTypes&&-1===t.breakTypes.indexOf(!0))u.type="categorical",Object.assign(u,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 s=0;s<r.length;s++)t<r[s]&&r[s]<n&&(a.push(r[s]),i.push(o[s]));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 u=0;u<r.length;u++)if(r[u]>n){i.push(o[u]),i.push(o[u]);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:s}));else if(t.breakTypes){var d=t.breakTypes;u.type="continuous",u.domain=[o],u.range=[f[0]];for(var p=0;p<c.length;p+=1)if(d[p]){var h=f[p],m=f[p+1],v=st(h,m)(.5);u.range.push(v),u.domain.push(c[p]),p<c.length-1&&d[p+1]&&(u.range.push(f[p+1]),u.domain.push((c[p]+c[p+1])/2))}else u.range.push(f[p]),u.range.push(f[p+1]),u.domain.push(c[p]),u.domain.push(c[p]+Math.min(1e-6,(i-o)/1e6));u.range.push(f[f.length-1]),u.domain.push(i)}else u.domain=c,u.range=f;return u};function ft(e,t,n,r,o){var i,a,l,s=0,u=[],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)||(u[l]?u[l]+=1:u[l]=1);for(i=0;i<u.length;i+=1)u[i]&&(s+=1);return s<=r||s>=o?Math.max(s,r):ft(e,t,n,r+1,o)}var dt=function(e,t,n,r){var o,i,a=t.theme,l=t.hc,s=r.f,u={mode:"field",fieldType:"measure",field:s?s.key():void 0,reverse:n.input.reverseScheme||!1,type:"continuous",range:function(e){return e.resources.theme.palette("quant")}},c=[],f=!0;if(s){if(Number.isNaN(+s.min())||Number.isNaN(+s.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:s.key()},exclude:{fields:l.qDimensionInfo.map((function(e,t){return{field:"qDimensionInfo/".concat(t)}})),value:function(e){return Math.min.apply(Math,Z(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(u.min=n.input.measureMin,u.max=n.input.measureMax,u.max<u.min)return{invalid:!0}}else if(s&&!f)u.min=s.min(),u.max=s.max();else if(s){if(!c.length)return{invalid:!0};u.min=Math.min.apply(Math,Z(c)),u.max=Math.max.apply(Math,Z(c))}if(n.input.measureScheme&&(u.palettes={quant:n.input.measureScheme}),a){var d=a.getDataColorScales().filter((function(e){return e.key===n.input.measureScheme}))[0];u.type=d&&ut.test(d.type)?"categorical":"continuous","categorical"===u.type&&(i=d.colors.some((function(e){return Array.isArray(e)}))?Math.max.apply(Math,Z(d.colors.map((function(e){return e?e.length:0})))):d.colors.length)}if("categorical"===u.type){for(var p=f?ft(u.max,u.min,c,1,i):i,h=(u.max-u.min)/p,m=[],v=0;v<p+1;v+=1)m.push(u.min+h*v);u.domain=m,u.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 u};function pt(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 ht(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)),z(z({},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 z(z({},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 mt(e){e.measureOverrides.every((function(e){return!e}))&&(e.measureOverrides=null)}function vt(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 s=n.indexOf(i);-1!==s&&(n.splice(s,1),r.splice(s,1))}}return{domain:n,range:r,exclude:o}}function yt(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?pt:i,l=n.input.byMeasureDef||{activeMeasureIndex:0},s=a(n,l),u=dt(0,{theme:r,hc:o},n,{f:s});if(u.invalid)return u;"expression"===l.type&&(l.activeMeasureIndex<0||void 0===l.activeMeasureIndex)&&(u.label=l.label,s&&"color.altLabel"===s.raw().labelExpRef&&(u.label=n.input.altLabel)),!u.label&&s&&(u.label=s.title());var c=l.activeMeasureIndex>=0?s:null;if(!c&&s&&void 0!==s.raw().matchMeasure&&s.raw().matchMeasure>-1&&(c=n.pic.fields().filter((function(e){return"measure"===e.type()}))[s.raw().matchMeasure]),n.input.useMeasureGradient&&"libraryItem"===l.type)if(c){var f=c.raw().coloring;f&&f.gradient&&le(u,ct(e,f.gradient,u,c))}else u.auxiliary=l;return u}(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?fe:o,a=r.getCByField,l=void 0===a?de:a,s=r.getPersistence,u=void 0===s?ce:s,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),le(h,u(t,n,c,f,{byRow:ue,byElemNo:se})),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 s=dt(0,{hc:o,theme:i},n,{f:l});return s.invalid||(s.label=n.input.expressionLabel||a.get("Object.ChartTooltip.ColorExpression")),s}(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 s=[],u=[];"measure"===n.input.useBaseColors&&o.qMeasureInfo.forEach((function(t,n){if(t.baseColor||t.coloring&&t.coloring.baseColor){s.push(n);var o=e.resolveUIColor(t.baseColor||t.coloring.baseColor);"none"===o?u.push(r.primary):u.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:s.length?{domain:s,range:u}: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 ht({cm:e,input:n,defaults:r,index:o,pic:t.pic})})),function(e,t){var n,r,o,i=t.translator;if(mt(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=vt(e.measureOverrides,e.explicit),mt(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=vt(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 gt(e){var t=z({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(le(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=le(!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=le(!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||{}).key;if("measure"===e.fieldType)return r.getMeasure(o,t).catch((function(){}));if("dimension"===e.fieldType){var i="".concat(n,"/").concat(e.field).replace("qDimensionInfo","qDimensions").replace("qAttrDimInfo","qAttributeDimensions");return Promise.all([/qAttrDimInfo/.test(e.field)?r.getAttributeDimension(i,t).catch((function(){})):Promise.resolve(),o?r.getDimensionColorMap(o,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 ct(o,r.coloring.gradient,e,i)}return{}}if("dimension"===e.fieldType){var a={nil:e.nil,others:e.others},l=r[0],s=r[1]?r[1].colorMap:null;if(l){var u=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=u}return s?function(e,t,n,r){var o=r.external,i=r.field,a=z({},e);le(a,se(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,le(a,se(i)))):!1===t.autoFill&&t.single?a.range=[n.resolveUIColor(t.single)]:t.autoFill&&(l&&(a.palettes={categorical:l.key}),le(a,se(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 s=o.items[l],u=(s.text||s).label;r[u]&&-1===a.indexOf(s.value)&&(a.push(s.value),i.push(t.resolveUIColor(r[u])))}return a.push(-3,-2),i.push(n.others),i.push(n.nil),a},range:function(){return i}}}(t.colors,n,a)),a}(a,s,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=z(z({},e),r.getDataColorSpecials())),n.settings=le(e,yt(this,n,t,e))}return n.settings}};return o}var bt=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},xt=function(e){throw e.isHandled=!0,e},qt=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()},wt=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()},Dt=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(xt):Promise.reject()};function Ct(e){return function(t){return"object"===B(t.datum[e])?t.datum[e].value:void 0}}function It(e){return"object"===B(e.datum.isNull)?e.datum.isNull.value:-2===e.datum.value}function Mt(e){return-3===e.datum.value}var kt={TITLE:{COLOR:void 0,FONT_SIZE:"16px",FONT_FAMILY:"'Source Sans Pro', 'Arial', 'sans-serif'"},LABEL:{COLOR:void 0,FONT_SIZE:void 0,FONT_FAMILY:"'Source Sans Pro', 'Arial', 'sans-serif'"}};function St(e){var t=e.theme,n=e.key,r=e.styleOverrides,o={title:{color:kt.TITLE.COLOR,fontSize:kt.TITLE.FONT_SIZE,fontFamily:kt.TITLE.FONT_FAMILY},label:{color:kt.LABEL.COLOR,fontSize:kt.LABEL.FONT_SIZE,fontFamily:kt.LABEL.FONT_FAMILY}};if(!t&&!r)return o;var i=r||{},a=i.title,l=i.label,s=function(e){var t=e.theme,n=e.key;return function(e,r,o,i){return void 0!==e?e:t?t.getStyle(n,r,o):i}}({theme:t,key:n});return o.title.color=s(null==a?void 0:a.color,"legend.title","color",kt.TITLE.COLOR),o.title.fontSize=s(null==a?void 0:a.fontSize,"legend.title","fontSize",kt.TITLE.FONT_SIZE),o.title.fontFamily=s(null==a?void 0:a.fontFamily,"legend.title","fontFamily",kt.TITLE.FONT_FAMILY),o.label.color=s(null==l?void 0:l.color,"legend.label","color",kt.LABEL.COLOR),o.label.fontSize=s(null==l?void 0:l.fontSize,"legend.label","fontSize",kt.LABEL.FONT_SIZE),o.label.fontFamily=s(null==l?void 0:l.fontFamily,"legend.label","fontFamily",kt.LABEL.FONT_FAMILY),o}var Ot=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"},Et=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 At(e,t){var n=e.styleReference,r=e.styleOverrides,o=e.chart,i=e.rtl,a=t.legendProps,l=t.coloring,s=t.theme,u=t.hc,c=St({theme:s,key:n,styleOverrides:r});return{layout:{minimumLayoutMode:"MEDIUM",dock:Ot(a,o,i)},show:"function"==typeof a.show?function(){return Et(a,u,l)}:Et(a,u,l),renderer:"svg",mounted:function(e){e.childNodes[0].style.pointerEvents="none",e.style.overflow="hidden"},settings:{title:{show:!1!==a.showTitle,wordBreak:"break-word",maxLines:2,lineHeight:1.2,text:l.label||"",fill:c.title.color,fontSize:c.title.fontSize,fontFamily:c.title.fontFamily}}}}function Nt(e,t,n){return"categorical"===t.coloring.type?function(e,t,n){var r=At(e,t);if(!r.show)return!1;var o,i=e.key,a=e.styleReference,l=e.styleOverrides,s=e.viewState,u=e.rtl,c=e.settings,f=e.style,d=t.scaleKey,p=t.theme,h=t.scales,m=St({theme:p,key:a,styleOverrides:l}),v=r.layout.dock,y="left"===v||"right"===v?{maxLines:2,wordBreak:"break-word"}:{},g={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"};"dimension"===t.coloring.fieldType&&(o=function(e){return e.datum.value>=0||-3===e.datum.value});var b="".concat(d,"Legend");return le(!0,r,{type:"legend-cat",key:"".concat(i,"-cat"),scale:b in h?b:d,settings:{layout:{scrollOffset:function(){return s?s.get("legendScrollOffset"):void 0},size:-1!==["top","bottom"].indexOf(r.layout.dock)?2:1,direction:u?"rtl":"ltr",horizontal:20},item:{show:o,label:z({fill:m.label.color,fontSize:m.label.fontSize,fontFamily:m.label.fontFamily},y)},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:g[n]})])])}}}},brush:{consume:[{context:"selection",data:["",i],style:{inactive:{opacity:.3}}}]}},{settings:c,style:f})}(e,t,n):"continuous"===t.coloring.type&&function(e,t){var n,r=e.key,o=e.styleReference,i=e.styleOverrides,a=e.rtl,l=e.settings,s=e.style,u=t.scaleKey,c=t.theme,f="".concat(u,"Range"),d=At(e,t);if(!d.show)return!1;var p=St({theme:c,key:o,styleOverrides:i}),h=d.layout.dock,m="right"===h||"left"===h,v=null===(n=t.scales)||void 0===n?void 0:n[f];return m&&v&&(v.invert=!0),le(!0,d,{type:"legend-seq",key:"".concat(r,"-seq"),settings:{fill:u,major:f,length:1,tick:{fill:p.label.color,fontSize:p.label.fontSize,fontFamily:p.label.fontFamily},title:{anchor:!a||"top"!==d.layout.dock&&"bottom"!==d.layout.dock?void 0:"right",padding:parseFloat(d.settings.title.fontSize)||16}}},{settings:l,style:s})}(e,t)}function Lt(e,t,n){var r=[],o=[],i=Nt(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={},Y(e,"".concat(n,"start"),(function(e){e.preventDefault(),this.started!==n&&(this.started=n,this.chart.component("".concat(r,"-cat")).emit("panstart",e))})),Y(e,"".concat(n,"move"),(function(e){e.preventDefault(),this.chart.component("".concat(r,"-cat")).emit("panmove",e)})),Y(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 Pt=function(e){return"rgba(".concat([(16711680&e)>>16,(65280&e)>>8,255&e,((4278190080&e)>>>24)/255].join(","),")")};function Tt(e){var t=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.auto,n=gt(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 qt(e,{layout:n,app:r})})).getMeasure((function(e,t){var n=t.layout,r=t.app;return wt(e,{layout:n,app:r})})).getAttributeDimension((function(e,t){var n=t.layout,r=t.model,o=t.app;return Dt(e,{layout:n,model:r,app:o})}));return n.getSnapshotData=bt,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=z({},o),r={},!n.key)throw new Error("Missing key");t.set(z(z({},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=z(z({},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,s=r.getDataColorScales().filter((function(e){return e.key===l}))[0];if(s){var u=s.colors[0]?s.colors:[[]].concat(Z(s.colors.slice(1)));u=Array.isArray(u[0])?u.map((function(e){return e.slice().reverse()})):u.slice().reverse(),o.push({key:"quant",colors:u})}}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={},s=o;if(n){var u={override:!0,domain:n.explicit&&"function"==typeof n.explicit.domain?n.explicit.domain:[].concat(Z((n.explicit||{}).domain||[]),[-3,-2]),range:n.explicit&&"function"==typeof n.explicit.range?n.explicit.range:[].concat(Z((n.explicit||{}).range||[]),[n.others,n.nil])};if("field"===n.mode){if("dimension"===n.fieldType){var c,f=function(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}({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:u,type:"categorical-color",label:function(e){return e.datum.text&&e.datum.text.value?e.datum.text.value:e.datum.label}};l[s]=h,c&&(l["".concat(s,"Legend")]=z(z({},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[s]=le({},m,{type:"categorical"===n.type?"threshold-color":"sequential-color",range:n.range,domain:n.domain,invert:n.reverse}),"sequential-color"===l[s].type&&(l["".concat(s,"Range")]=le({},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:u,type:"categorical-color"};l[s]=v}else if("measure"===n.mode){var y={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:u,type:"categorical-color"};l[s]=y}}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=Ct(r),i=Ct("".concat(r,"IsAnOther")),a=function(e,t){var r=e.fieldType,a=e.invalid,l=e.mode,s=e.nil,u=e.others,c=e.primary,f=e.type;return a?function(e){return Mt(e)||i(e)?u:s}:n[t]?function(e){return Mt(e)?u:It(e)||-2===o(e)&&"dimension"===r||"NaN"===o(e)?s:i(e)?u:e.resources.scale(t)(o(e))||u}:"constant"===l?function(e){return Mt(e)||i(e)?u:It(e)?s:c}:"color"===f?function(e){return Mt(e)||i(e)?u:It(e)?s:o(e)||u}:null},l=a(t,r);if(t.measureOverrides){var s=Ct("".concat(r,"MeasureIdx")),u=t.measureOverrides.map((function(e){return e&&a(e)}));return function(e){var t=s(e);return u[t]?u[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,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,u=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?Pt(e.qNum):e.qText&&Ee(e.qText)?e.qText:c})):"dimension"===o.mode?n=void 0!==o.field?o.field:r.qDimensionInfo.length-1:"measure"===o.mode&&(n=s);var f=Y({},u,n);return r.qDimensionInfo.length>1&&(f["".concat(u,"IsAnOther")]={fields:r.qDimensionInfo.map((function(e,t){return{field:"qDimensionInfo/".concat(t)}})),value:function(e){return-1!==e.indexOf(-3)}}),l&&(f["".concat(u,"MeasureIdx")]=s),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,s=e.styleReference,u=void 0===s?"object.legend":s,c=e.styleOverrides,f=e.settings,d=void 0===f?{}:f,p=e.style,h=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Lt({eventName:t,key:r,rtl:l,viewState:i,chart:a,styleReference:u,styleOverrides:c,settings:d,style:void 0===p?{}:p},{legendProps:n.legendProps,scaleKey:n.key,coloring:o(),theme:n.theme,hc:n.hc,scales:this.scales()},h)}};return i}var Ft=function(e){return e.baseColor||e.coloring&&e.coloring.baseColor};function jt(e){var t=e.qHyperCube,n=t.qDimensionInfo,r=t.qMeasureInfo,o=n.some(Ft),i=r.some(Ft),a=e.color.useBaseColors;return"measure"===a&&!i||"dimension"===a&&!o?"off":a}function Rt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return z(z(z({},e),t),{},{colorProps:z(z({},e.colorProps),t.colorProps||{})})}var $t=function(e){return e.baseColor||e.coloring&&e.coloring.baseColor};function Ht(e){var t,n=e.qHyperCube.qDimensionInfo.some($t),r=e.qHyperCube.qMeasureInfo.some($t),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 _t=function(){};function zt(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}var Vt=["__proto__","constructor"];function Bt(e,t,n){if(void 0!==e&&void 0!==t){var r=t.split("."),o=r[r.length-1];if(!Vt.some((function(e){return r.includes(e)}))){for(var i=e,a=0;a<r.length-1;++a){var l=r[a];void 0===i[l]&&(i[l]=Number.isNaN(+r[a+1])?{}:[]),i=i[l]}void 0!==n?i[o]=n:delete i[o]}}}function Ut(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 Wt(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 Yt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Wt(Object(n),!0).forEach((function(t){Kt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Kt(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Gt=Object.prototype.hasOwnProperty,Zt=Object.prototype.toString,Jt=Object.defineProperty,Xt=Object.getOwnPropertyDescriptor,Qt=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===Zt.call(e)},en=function(e){if(!e||"[object Object]"!==Zt.call(e))return!1;var t,n=Gt.call(e,"constructor"),r=e.constructor&&e.constructor.prototype&&Gt.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!r)return!1;for(t in e);return void 0===t||Gt.call(e,t)},tn=function(e,t){Jt&&"__proto__"===t.name?Jt(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},nn=function(e,t){if("__proto__"===t){if(!Gt.call(e,t))return;if(Xt)return Xt(e,t).value}return e[t]},rn=function e(){var t,n,r,o,i,a,l=arguments[0],s=1,u=arguments.length,c=!1;for("boolean"==typeof l&&(c=l,l=arguments[1]||{},s=2),(null==l||"object"!=typeof l&&"function"!=typeof l)&&(l={});s<u;++s)if(null!=(t=arguments[s]))for(n in t)r=nn(l,n),l!==(o=nn(t,n))&&(c&&o&&(en(o)||(i=Qt(o)))?(i?(i=!1,a=r&&Qt(r)?r:[]):a=r&&en(r)?r:{},tn(l,{name:n,newValue:e(c,a,o)})):void 0!==o&&tn(l,{name:n,newValue:o}));return l};function on(e,t,n,r){if(!e)return-1;const o=n.cache,i=e.origin?e.origin():null;i&&(e=i);let a=o.fields.indexOf(e),l=-1,s=-1;if(-1===a)for(let t=0;t<o.wrappedFields.length;t++)if(s=o.wrappedFields[t].attrDims.map((e=>e.instance)).indexOf(e),l=o.wrappedFields[t].attrExps.map((e=>e.instance)).indexOf(e),-1!==s||-1!==l){a=t;break}if(Array.isArray(r)&&r.some(((e,t)=>e!==t))){const e=r.indexOf(a);-1!==e&&(a=e)}return a-=t.qArea.qLeft,a<0||a>=t.qArea.qWidth?-1:s>=0?e=>e[a].qAttrDims.qValues[s]:l>=0?e=>e[a].qAttrExps.qValues[l]:e=>e[a]}function an(e,t,n){let{key:r}=n;const 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 ln(e){let{cache:t,f:n,mainCell:r,p:o,prop:i,page:a,rowIdx:l,row:s,sourceKey:u,target:c,targetProp:f,columnOrder:d}=e,p=r;if(o.field&&o.field!==n){const e=on(o.field,a,{cache:t},d);if(-1===e)return;p=rn({qRow:l},e(s))}c[f]=an(o,p,{key:u})}function sn(e,t,n,r){const o=Array.isArray(e)?e:[e];let i=[];for(let e=0;e<o.length;e++)if(void 0!==o[e].field){const a=t.raw(),l=t.key(),s="object"==typeof o[e].field?o[e].field:t.field(o[e].field),{props:u,main:c}=r.normalizeConfig(o[e],t),f=Object.keys(u),d=!!o[e].trackBy,p=typeof o[e].trackBy,h={},m=[],v=[];for(let t=0;t<a.qDataPages.length;t++){const i=on(s,a.qDataPages[t],{cache:n},a.qColumnOrder);if(-1!==i)for(let y=0;y<a.qDataPages[t].qMatrix.length;y++){const g=a.qDataPages[t].qArea.qTop+y,b=rn({qRow:g},i(a.qDataPages[t].qMatrix[y])),x=an(c,b,{key:l});if(!c.filter||c.filter(b)){for(let e=0;e<f.length;e++){const r=u[f[e]];let o=r.fields||[r];r.fields&&(x[f[e]]=[]);for(let i=0;i<o.length;i++)ln({cache:n,f:s,mainCell:b,p:o[i],prop:f[e],props:u,page:a.qDataPages[t],rowIdx:g,row:a.qDataPages[t].qMatrix[y],sourceKey:l,target:r.fields?x[f[e]]:x,targetProp:r.fields?i:f[e],columnOrder:a.qColumnOrder});if(r.fields){const t=x[f[e]].map((e=>e.value)),n=x[f[e]].map((e=>e.label));x[f[e]]={value:"function"==typeof r.value?r.value(t):void 0!==r.value?r.value:t,label:"function"==typeof r.label?r.label(n):void 0!==r.label?String(r.label):String(x[f[e]].value)}}}d&&r.track({cfg:o[e],itemData:b,obj:x,target:m,tracker:h,trackType:p}),v.push(x)}}}const y=d?r.collect(m,{main:c,propsArr:f,props:u}):v;i=[...i,...y]}return i}function un(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 cn(e,t){e instanceof Map?(e=[void 0,e],void 0===t&&(t=dn)):void 0===t&&(t=fn);for(var n,r,o,i,a,l=new mn(e),s=[l];n=s.pop();)if((o=t(n.data))&&(a=(o=Array.from(o)).length))for(n.children=o,i=a-1;i>=0;--i)s.push(r=o[i]=new mn(o[i])),r.parent=n,r.depth=n.depth+1;return l.eachBefore(hn)}function fn(e){return e.children}function dn(e){return Array.isArray(e)?e[1]:null}function pn(e){void 0!==e.data.value&&(e.value=e.data.value),e.data=e.data.data}function hn(e){var t=0;do{e.height=t}while((e=e.parent)&&e.height<++t)}function mn(e){this.data=e,this.depth=this.height=0,this.parent=null}function vn(e){return null==e?null:function(e){if("function"!=typeof e)throw new Error;return e}(e)}mn.prototype=cn.prototype={constructor:mn,count:function(){return this.eachAfter(un)},each:function(e,t){let n=-1;for(const r of this)e.call(t,r,++n,this);return this},eachAfter:function(e,t){for(var n,r,o,i=this,a=[i],l=[],s=-1;i=a.pop();)if(l.push(i),n=i.children)for(r=0,o=n.length;r<o;++r)a.push(n[r]);for(;i=l.pop();)e.call(t,i,++s,this);return this},eachBefore:function(e,t){for(var n,r,o=this,i=[o],a=-1;o=i.pop();)if(e.call(t,o,++a,this),n=o.children)for(r=n.length-1;r>=0;--r)i.push(n[r]);return this},find:function(e,t){let n=-1;for(const r of this)if(e.call(t,r,++n,this))return r},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(){return Array.from(this)},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 cn(this).eachBefore(pn)},[Symbol.iterator]:function*(){var e,t,n,r,o=this,i=[o];do{for(e=i.reverse(),i=[];o=e.pop();)if(yield o,t=o.children)for(n=0,r=t.length;n<r;++n)i.push(t[n])}while(i.length)}};var yn={depth:-1},gn={},bn={};function xn(e){return e.id}function qn(e){return e.parentId}function wn(e){let t=e.length;if(t<2)return"";for(;--t>1&&!Dn(e,t););return e.slice(0,t)}function Dn(e,t){if("/"===e[t]){let n=0;for(;t>0&&"\\"===e[--t];)++n;if(0==(1&n))return!0}return!1}function Cn(e,t){"/"===e.charAt(0)&&(e=e.substring(1));const n=e.split("/");let r,o=t;for(let e=0;e<n.length;e++){if("*"===n[e]&&Array.isArray(o)){const t=[];r=n.slice(e+1).join("/");for(let e=0;e<o.length;e++){let n=Cn(r,o[e]);Array.isArray(n)?t.push(...n):t.push(n)}return t}if(!n[e]&&Array.isArray(o)){const t=new Array(o.length);r=n.slice(e+1).join("/");for(let e=0;e<o.length;e++)t[e]=Cn(r,o[e]);return t}n[e]in o&&(o=o[n[e]])}return o}function In(e,t,n){let r=[];if(!e||!e.length)return r;if(t<=0){const t=n>=0?[e[n]]:e;r=[...r,...t]}else for(let o=0;o<e.length;o++)e[o].children&&e[o].children.length&&(r=[...r,...In(e[o].children,t-1,n)]);return r}function Mn(e,t,n){if(e===t)return e=>e;if(e>t){const n=Math.max(0,Math.min(100,e-t));return e=>{let t=e;for(let e=0;e<n;++e)t=t.parent;return t}}if(t>e){const r=Math.max(0,Math.min(100,t-e));return e=>In(e.children,r-1,n)}return!1}const kn=/^qDimensionInfo(?:\/(\d+))?/,Sn=/^\/?qMeasureInfo\/(\d+)/,On=/\/qAttrExprInfo\/(\d+)/,En=/\/qAttrDimInfo\/(\d+)/;function An(e){return(e.qColumnOrder&&e.qColumnOrder.length?e.qColumnOrder:e.qDimensionInfo.map(((e,t)=>t))).filter((t=>t<e.qDimensionInfo.length))}function Nn(e,t){let{cube:n}=t;if(!e)return-1;let r=e.origin&&e.origin()?e.origin().key():e.key(),o=!1,i=-1,a=-1,l=-1,s=-1,u=-1,c=-1,f=r;const d=n.qEffectiveInterColumnSortOrder,p=An(n);return kn.test(f)&&(o=!0,i=+kn.exec(f)[1],f=r.replace(kn,"")),Sn.test(f)&&("K"===n.qMode?u=+Sn.exec(f)[1]:d&&-1!==d.indexOf(-1)?(u=+Sn.exec(f)[1],c=0):c=+Sn.exec(f)[1],f=f.replace(Sn,"")),f&&(En.exec(f)?l=+En.exec(f)[1]:On.exec(f)&&(a=+On.exec(f)[1])),s=o?"S"===n.qMode?p[i]:d?d.indexOf(i):i:d&&-1!==d.indexOf(-1)?d.indexOf(-1):n.qDimensionInfo.length-("K"===n.qMode?0:1),{fieldDepth:s+1,pseudoMeasureIndex:u,measureIdx:c,attrDimIdx:l,attrIdx:a}}function Ln(e,t){let n,r,o=Mn(e.fieldDepth,t.fieldDepth,t.pseudoMeasureIndex);return n=t.measureIdx>=0?e=>e.data.qValues[t.measureIdx]:e=>e.data,t.attrDimIdx>=0?r=e=>{var n;return null==e||null===(n=e.qAttrDims)||void 0===n?void 0:n.qValues[t.attrDimIdx]}:t.attrIdx>=0&&(r=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 Pn(e,t,n){let{key:r}=n;const 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 Tn(e){let{propsArr:t,props:n,item:r,itemData:o,ret:i,sourceKey:a}=e;for(let e=0;e<t.length;e++){const l=n[t[e]],s=l.fields||[l];let u,c;l.fields&&(u=[],c=[]);for(let n=0;n<s.length;n++){const f=s[n];let d,p,h,m,v,y;if("primitive"===f.type?(h=f.value,y=String(f.value)):("function"==typeof f.value&&(d=e=>f.value(e,r)),"function"==typeof f.label&&(p=e=>f.label(e,r)),f.accessor?(m=f.accessor(r),Array.isArray(m)?(v=m.map(f.valueAccessor),f.attrAccessor&&(v=v.map(f.attrAccessor)),d&&(h=v.map(d),d=null),p&&(y=v.map(p),p=null),h=f.reduce?f.reduce(h):h,y=f.reduceLabel?f.reduceLabel(y,h):String(h)):(h=f.attrAccessor?f.attrAccessor(f.valueAccessor(m)):f.valueAccessor(m),y=h)):(h=o,y=o)),l.fields){const e=d?d(h):h;u.push(e),c.push(p&&null!=y?p(y):null!=y?y:String(e))}else{const n=d?d(h):h;i[t[e]]={value:n,label:p?p(y):null!=y?y:String(n)},f.field&&(i[t[e]].source={field:f.field.key(),key:a})}}u&&(i[t[e]]={value:"function"==typeof l.value?l.value(u,r):u,label:"function"==typeof l.label?l.label(c,r):c})}}const Fn=(e,t,n)=>{const r="K"===e.qMode?"/qStackedDataPages/*/qData":"/qTreeDataPages/*",o="K"===e.qMode?"qSubNodes":"qNodes",i=Cn(r,e);return i&&i[0]?(t.tree=cn(i[0],n.children||(e=>e[o])),t.tree):null};function jn(e){const t=e.raw().qDataPages.length?e.raw().qDataPages[0].qMatrix:[],n=function(e){const t=e.raw().qColumnOrder,n=e.fields();return t&&t.length===n.length?t:n.map(((e,t)=>t))}(e),r=e.fields(),o=e.fields().filter((e=>"dimension"===e.type())).map((e=>n.indexOf(r.indexOf(e)))),i=e.fields().filter((e=>"measure"===e.type())).map((e=>n.indexOf(r.indexOf(e)))),a={__root:{__id:"__root",qValues:[]}};for(let e=0;e<t.length;e++){const n=t[e];let r="__root",s=!1;for(let e=0;e<o.length;e++){var l;const t=n[o[e]],i="".concat(r,"__").concat(null!==(l=t.qElemNumber)&&void 0!==l?l:t.qElemNo);a[i]||(a[i]=Yt({__id:i,__parent:r,qValues:[]},t),s=!0),r=i}if(s)for(let e=0;e<i.length;e++){const t=n[i[e]];a[r].qValues.push(t)}}const s=Object.keys(a).map((e=>a[e]));return function(){var e,t=xn,n=qn;function r(r){var o,i,a,l,s,u,c,f,d=Array.from(r),p=t,h=n,m=new Map;if(null!=e){const t=d.map(((t,n)=>function(e){let t=(e=`${e}`).length;return Dn(e,t-1)&&!Dn(e,t-2)&&(e=e.slice(0,-1)),"/"===e[0]?e:`/${e}`}(e(t,n,r)))),n=t.map(wn),o=new Set(t).add("");for(const e of n)o.has(e)||(o.add(e),t.push(e),n.push(wn(e)),d.push(bn));p=(e,n)=>t[n],h=(e,t)=>n[t]}for(a=0,o=d.length;a<o;++a)i=d[a],u=d[a]=new mn(i),null!=(c=p(i,a,r))&&(c+="")&&(f=u.id=c,m.set(f,m.has(f)?gn:u)),null!=(c=h(i,a,r))&&(c+="")&&(u.parent=c);for(a=0;a<o;++a)if(c=(u=d[a]).parent){if(!(s=m.get(c)))throw new Error("missing: "+c);if(s===gn)throw new Error("ambiguous: "+c);s.children?s.children.push(u):s.children=[u],u.parent=s}else{if(l)throw new Error("multiple roots");l=u}if(!l)throw new Error("no root");if(null!=e){for(;l.data===bn&&1===l.children.length;)l=l.children[0],--o;for(let e=d.length-1;e>=0&&(u=d[e]).data===bn;--e)u.data=null}if(l.parent=yn,l.eachBefore((function(e){e.depth=e.parent.depth+1,--o})).eachBefore(hn),l.parent=null,o>0)throw new Error("cycle");return l}return r.id=function(e){return arguments.length?(t=vn(e),r):t},r.parentId=function(e){return arguments.length?(n=vn(e),r):n},r.path=function(t){return arguments.length?(e=vn(t),r):e},r}().id((e=>e.__id)).parentId((e=>e.__parent))(s)}const Rn=e=>{let{propsArr:t,props:n,cube:r,cache:o,itemDepthObject:i,f:a}=e;for(let e=0;e<t.length;e++){const l=n[t[e]],s=l.fields?l.fields:[l];for(let e=0;e<s.length;e++){const t=s[e];if(t.field!==a){const e=Ln(i,Nn(t.field,{cube:r,cache:o}));t.accessor=e.nodeFn,t.valueAccessor=e.valueFn,t.attrAccessor=e.attrFn}}}};function $n(){let 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;const o=t.raw(),i=t.key(),a="S"===o.qMode?jn(t):Fn(o,n,e);if(!a)return null;const l=a.height,s=[];for(let i=0;i<=l;i++){let a=null;if(i>0)if("S"===o.qMode){let e=An(o)[i-1];a=n.fields[e]}else{let e=o.qEffectiveInterColumnSortOrder[i-1];i>o.qEffectiveInterColumnSortOrder.length&&(e=o.qDimensionInfo.length),a=n.fields[e]}const{props:l,main:u}=r.normalizeConfig(Yt(Yt({},e),{},{field:a?a.key():void 0}),t),c=Object.keys(l);s[i]={propsArr:c,props:l,main:u};const f=a?Nn(a,{cube:o,cache:n}):{fieldDepth:0};Rn({propsArr:c,props:l,cube:o,cache:n,itemDepthObject:f,f:a})}const u=a.copy().descendants(),c=a.descendants();for(let e=0;e<c.length;e++){const t=s[c[e].depth].propsArr,n=s[c[e].depth].props,r=s[c[e].depth].main,o=u[e],a=o.data,l=Pn(r,a,{key:i});Tn({propsArr:t,props:n,item:o,itemData:a,ret:l,sourceKey:i,isTree:!0}),c[e].data=l}return a}function Hn(e,t,n,r){const o=Array.isArray(e)?e:[e];let i=[];for(let a=0;a<o.length;a++)if(void 0!==o[a].field){const l=t.raw(),s=t.key();if(!Fn(l,n,e))continue;const u="object"==typeof o[a].field?o[a].field:t.field(o[a].field),{props:c,main:f}=r.normalizeConfig(o[a],t),d=Object.keys(c),p=Nn(u,{cube:l,cache:n}),{nodeFn:h,attrFn:m,valueFn:v}=Ln({fieldDepth:0},p);Rn({propsArr:d,props:c,cube:l,cache:n,itemDepthObject:p,f:u});const y=!!o[a].trackBy,g=typeof o[a].trackBy,b={},x=[],q=h(n.tree),w=[];for(let e=0;e<q.length;e++){const t=q[e],n=m?m(v(t)):v(t);if(f.filter&&!f.filter(n))continue;const i=Pn(f,n,{key:s});Tn({propsArr:d,props:c,item:t,itemData:n,ret:i,sourceKey:s}),y&&r.track({cfg:o[a],itemData:n,obj:i,target:x,tracker:b,trackType:g}),w.push(i)}const D=y?r.collect(x,{main:f,propsArr:d,props:c}):w;i=[...i,...D]}return i}var _n,zn,Vn=(_n=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 s,useEffect as u,useStaleLayout as c,useTheme as f,useConstraints as d,useRect as p,usePlugins as h,useAppLayout as m,usePromise as v,onTakeSnapshot as y}from"@nebula.js/stardust";const g={fill:"steelblue",num:1},b=.9,x=150,q=(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"}},w=(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;const r=e.slice().reverse().map((e=>{const r={datum:e,s:n/t,e:e.num/t};return n=e.num,r}));return r.reverse()})(e),r=t.width*b,o=t.height*b,i=(t.width-r)/2,a=(t.height-o)/2,l=r-(r>x&&o>x?100:0),s=(o-1*(n.length-1))/n.length,u=[];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=s*r+1*r+a,p={bottomRight:{x:o[2],y:Math.round(d+s)},bottomLeft:{x:o[3],y:Math.round(d+s)},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`;u.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};s>12&&(p.bottomRight.x-p.bottomLeft.x>32&&u.push(q("labelCenter",p,m)),u.push(q("labelLeft",p,m)))})),u},D=(e,t,n,r)=>(r-e)/r*(t-n)+n,C=(e,t,n)=>{const r=e.filter((e=>"NaN"!==e.num&&e.num>0)),o=r.length,i=n.width*b,a=n.height*b,l=Math.round((n.width-i)/2),s=Math.round((n.height-a)/2),u=i-(i>x&&a>x?100:0),c=a-1*(o-1),f=[],d=r[0].data.num.value;let p=s;return r.forEach(((e,r)=>{const o=t[r]*c,i=Math.round(D(p-s,u,.2*u,a)/2),h=Math.round(D(p-s+o,u,.2*u,a)/2),m=l+Math.round(u/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},y=`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:y,data:e.data,fill:e.fill});const g={share:e.data.num.value/d,fill:e.fill,data:e.data};o>2&&(v.bottomRight.x-v.bottomLeft.x>32&&f.push(q("labelCenter",v,g)),f.push(q("labelLeft",v,g))),p+=o+1})),f},I=(e,t,n)=>{const r=e.filter((e=>"NaN"!==e.num&&e.num>0));if(r&&r.length>0)switch(t){case"WIDTH":default:return w(r,n);case"ORDER":return C(r,r.map((()=>1/r.length)),n);case"HEIGHT":return C(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 C(r,((e,t,n)=>{const r=e.reduce(((e,t)=>e+t.data.num.value),0),o=t.width*b,i=t.height*b,a=o*n,l=i*(o+a)/2,s=(o-a)/2/i,u=[];let c=0;for(let t=e.length-1;t>=0;t--){const n=e[t].data.num.value/r,o=2*s*c+a,f=-o/(2*s)+Math.sqrt(o*o/(4*s*s)+n*l/s);u[t]=f/i,c+=f}return u})(r,n,.2),n)}return[]};var M={require:["resolver"],defaultSettings:{settings:{},data:{},style:{item:"$shape"}},render({data:e}){const t=this.resolver.resolve({data:e,defaults:{...g,...this.style.item},settings:this.settings.settings});return I(t.items,this.settings.settings.mode,this.rect)}};const k={version:"1.7.0",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 S={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 title",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 O=[{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 E(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var A=Object.prototype.hasOwnProperty,N=Object.prototype.toString,L=Object.defineProperty,P=Object.getOwnPropertyDescriptor,T=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===N.call(e)},F=function(e){if(!e||"[object Object]"!==N.call(e))return!1;var t,n=A.call(e,"constructor"),r=e.constructor&&e.constructor.prototype&&A.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!r)return!1;for(t in e);return void 0===t||A.call(e,t)},j=function(e,t){L&&"__proto__"===t.name?L(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},R=function(e,t){if("__proto__"===t){if(!A.call(e,t))return;if(P)return P(e,t).value}return e[t]},$=function e(){var t,n,r,o,i,a,l=arguments[0],s=1,u=arguments.length,c=!1;for("boolean"==typeof l&&(c=l,l=arguments[1]||{},s=2),(null==l||"object"!=typeof l&&"function"!=typeof l)&&(l={});s<u;++s)if(null!=(t=arguments[s]))for(n in t)r=R(l,n),l!==(o=R(t,n))&&(c&&o&&(F(o)||(i=T(o)))?(i?(i=!1,a=r&&T(r)?r:[]):a=r&&F(r)?r:{},j(l,{name:n,newValue:e(c,a,o)})):void 0!==o&&j(l,{name:n,newValue:o}));return l},H=E($);function _(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 z(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_(Object(n),!0).forEach((function(t){Y(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function V(){V=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,o){var i=t&&t.prototype instanceof d?t:d,a=Object.create(i.prototype),l=new I(o||[]);return r(a,"_invoke",{value:q(e,n,l)}),a}function c(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var f={};function d(){}function p(){}function h(){}var m={};s(m,i,(function(){return this}));var v=Object.getPrototypeOf,y=v&&v(v(M([])));y&&y!==t&&n.call(y,i)&&(m=y);var g=h.prototype=d.prototype=Object.create(m);function b(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function o(r,i,a,l){var s=c(e[r],e,i);if("throw"!==s.type){var u=s.arg,f=u.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){o("next",e,a,l)}),(function(e){o("throw",e,a,l)})):t.resolve(f).then((function(e){u.value=e,a(u)}),(function(e){return o("throw",e,a,l)}))}l(s.arg)}var i;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){o(e,n,t,r)}))}return i=i?i.then(r,r):r()}})}function q(e,t,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return{value:void 0,done:!0}}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var l=w(a,n);if(l){if(l===f)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=c(e,t,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}function w(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var o=c(r,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,f;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function D(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(D,this),this.reset(!0)}function M(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,o=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:k}}function k(){return{value:void 0,done:!0}}return p.prototype=h,r(g,"constructor",{value:h,configurable:!0}),r(h,"constructor",{value:p,configurable:!0}),p.displayName=s(h,l,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,s(e,l,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},b(x.prototype),s(x.prototype,a,(function(){return this})),e.AsyncIterator=x,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new x(u(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},b(g),s(g,l,"Generator"),s(g,i,(function(){return this})),s(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},e.values=M,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(C),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var l=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(l&&s){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),C(n),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;C(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:M(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},e}function B(e){return B="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},B(e)}function U(e,t,n,r,o,i,a){try{var l=e[i](a),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(r,o)}function W(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){U(i,r,o,a,l,"next",e)}function l(e){U(i,r,o,a,l,"throw",e)}a(void 0)}))}}function Y(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function K(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 G(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,l=[],s=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return l}}(e,t)||J(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 Z(e){return function(e){if(Array.isArray(e))return X(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||J(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 J(e,t){if(e){if("string"==typeof e)return X(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)?X(e,t):void 0}}function X(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 Q=Object.prototype.hasOwnProperty,ee=Object.prototype.toString,te=Object.defineProperty,ne=Object.getOwnPropertyDescriptor,re=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===ee.call(e)},oe=function(e){if(!e||"[object Object]"!==ee.call(e))return!1;var t,n=Q.call(e,"constructor"),r=e.constructor&&e.constructor.prototype&&Q.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!r)return!1;for(t in e);return void 0===t||Q.call(e,t)},ie=function(e,t){te&&"__proto__"===t.name?te(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},ae=function(e,t){if("__proto__"===t){if(!Q.call(e,t))return;if(ne)return ne(e,t).value}return e[t]},le=function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}((function e(){var t,n,r,o,i,a,l=arguments[0],s=1,u=arguments.length,c=!1;for("boolean"==typeof l&&(c=l,l=arguments[1]||{},s=2),(null==l||"object"!=typeof l&&"function"!=typeof l)&&(l={});s<u;++s)if(null!=(t=arguments[s]))for(n in t)r=ae(l,n),l!==(o=ae(t,n))&&(c&&o&&(oe(o)||(i=re(o)))?(i?(i=!1,a=r&&re(r)?r:[]):a=r&&oe(r)?r:{},ie(l,{name:n,newValue:e(c,a,o)})):void 0!==o&&ie(l,{name:n,newValue:o}));return l}));function se(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 ue(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 ce(e,t,n,r,o){var i,a,l=o.byRow,s=o.byElemNo;if(r&&(t.input.persistent||e.hc.qDimensionInfo.length>1||void 0===n.activeDimensionIndex&&e.hc.qSize.qcy>((null===(a=(i=e.hc).qDataPages[0]||i.qStackedDataPages[0])||void 0===a?void 0:a.qArea.qHeight)||0)))return s(r,r.raw().qCardinal);if(r){var u=t.pic.extract({field:r.key(),trackBy:r.value}).length;return l(r,u)}return{}}function fe(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 de(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 pe(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function he(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function me(){}var ve=1/.7,ye="\\s*([+-]?\\d+)\\s*",ge="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",be="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",xe=/^#([0-9a-f]{3,8})$/,qe=new RegExp(`^rgb\\(${ye},${ye},${ye}\\)$`),we=new RegExp(`^rgb\\(${be},${be},${be}\\)$`),De=new RegExp(`^rgba\\(${ye},${ye},${ye},${ge}\\)$`),Ce=new RegExp(`^rgba\\(${be},${be},${be},${ge}\\)$`),Ie=new RegExp(`^hsl\\(${ge},${be},${be}\\)$`),Me=new RegExp(`^hsla\\(${ge},${be},${be},${ge}\\)$`),ke={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 Se(){return this.rgb().formatHex()}function Oe(){return this.rgb().formatRgb()}function Ee(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=xe.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?Ae(t):3===n?new Te(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?Ne(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?Ne(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=qe.exec(e))?new Te(t[1],t[2],t[3],1):(t=we.exec(e))?new Te(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=De.exec(e))?Ne(t[1],t[2],t[3],t[4]):(t=Ce.exec(e))?Ne(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=Ie.exec(e))?_e(t[1],t[2]/100,t[3]/100,1):(t=Me.exec(e))?_e(t[1],t[2]/100,t[3]/100,t[4]):ke.hasOwnProperty(e)?Ae(ke[e]):"transparent"===e?new Te(NaN,NaN,NaN,0):null}function Ae(e){return new Te(e>>16&255,e>>8&255,255&e,1)}function Ne(e,t,n,r){return r<=0&&(e=t=n=NaN),new Te(e,t,n,r)}function Le(e){return e instanceof me||(e=Ee(e)),e?new Te((e=e.rgb()).r,e.g,e.b,e.opacity):new Te}function Pe(e,t,n,r){return 1===arguments.length?Le(e):new Te(e,t,n,null==r?1:r)}function Te(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function Fe(){return`#${He(this.r)}${He(this.g)}${He(this.b)}`}function je(){const e=Re(this.opacity);return`${1===e?"rgb(":"rgba("}${$e(this.r)}, ${$e(this.g)}, ${$e(this.b)}${1===e?")":`, ${e})`}`}function Re(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function $e(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function He(e){return((e=$e(e))<16?"0":"")+e.toString(16)}function _e(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ve(e,t,n,r)}function ze(e){if(e instanceof Ve)return new Ve(e.h,e.s,e.l,e.opacity);if(e instanceof me||(e=Ee(e)),!e)return new Ve;if(e instanceof Ve)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,s=(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/=s<.5?i+o:2-i-o,a*=60):l=s>0&&s<1?0:a,new Ve(a,l,s,e.opacity)}function Ve(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function Be(e){return(e=(e||0)%360)<0?e+360:e}function Ue(e){return Math.max(0,Math.min(1,e||0))}function We(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}pe(me,Ee,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Se,formatHex:Se,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return ze(this).formatHsl()},formatRgb:Oe,toString:Oe}),pe(Te,Pe,he(me,{brighter(e){return e=null==e?ve:Math.pow(ve,e),new Te(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?.7:Math.pow(.7,e),new Te(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Te($e(this.r),$e(this.g),$e(this.b),Re(this.opacity))},displayable(){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:Fe,formatHex:Fe,formatHex8:function(){return`#${He(this.r)}${He(this.g)}${He(this.b)}${He(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:je,toString:je})),pe(Ve,(function(e,t,n,r){return 1===arguments.length?ze(e):new Ve(e,t,n,null==r?1:r)}),he(me,{brighter(e){return e=null==e?ve:Math.pow(ve,e),new Ve(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?.7:Math.pow(.7,e),new Ve(this.h,this.s,this.l*e,this.opacity)},rgb(){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 Te(We(e>=240?e-240:e+120,o,r),We(e,o,r),We(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new Ve(Be(this.h),Ue(this.s),Ue(this.l),Re(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Re(this.opacity);return`${1===e?"hsl(":"hsla("}${Be(this.h)}, ${100*Ue(this.s)}%, ${100*Ue(this.l)}%${1===e?")":`, ${e})`}`}}));const Ye=Math.PI/180,Ke=180/Math.PI,Ge=4/29,Ze=6/29,Je=3*Ze*Ze;function Xe(e){if(e instanceof Qe)return new Qe(e.l,e.a,e.b,e.opacity);if(e instanceof ot)return it(e);e instanceof Te||(e=Le(e));var t,n,r=rt(e.r),o=rt(e.g),i=rt(e.b),a=et((.2225045*r+.7168786*o+.0606169*i)/1);return r===o&&o===i?t=n=a:(t=et((.4360747*r+.3850649*o+.1430804*i)/.96422),n=et((.0139322*r+.0971045*o+.7141733*i)/.82521)),new Qe(116*a-16,500*(t-a),200*(a-n),e.opacity)}function Qe(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}function et(e){return e>.008856451679035631?Math.pow(e,1/3):e/Je+Ge}function tt(e){return e>Ze?e*e*e:Je*(e-Ge)}function nt(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function rt(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function ot(e,t,n,r){this.h=+e,this.c=+t,this.l=+n,this.opacity=+r}function it(e){if(isNaN(e.h))return new Qe(e.l,0,0,e.opacity);var t=e.h*Ye;return new Qe(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}pe(Qe,(function(e,t,n,r){return 1===arguments.length?Xe(e):new Qe(e,t,n,null==r?1:r)}),he(me,{brighter(e){return new Qe(this.l+18*(null==e?1:e),this.a,this.b,this.opacity)},darker(e){return new Qe(this.l-18*(null==e?1:e),this.a,this.b,this.opacity)},rgb(){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 Te(nt(3.1338561*(t=.96422*tt(t))-1.6168667*(e=1*tt(e))-.4906146*(n=.82521*tt(n))),nt(-.9787684*t+1.9161415*e+.033454*n),nt(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}})),pe(ot,(function(e,t,n,r){return 1===arguments.length?function(e){if(e instanceof ot)return new ot(e.h,e.c,e.l,e.opacity);if(e instanceof Qe||(e=Xe(e)),0===e.a&&0===e.b)return new ot(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*Ke;return new ot(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}(e):new ot(e,t,n,null==r?1:r)}),he(me,{brighter(e){return new ot(this.h,this.c,this.l+18*(null==e?1:e),this.opacity)},darker(e){return new ot(this.h,this.c,this.l-18*(null==e?1:e),this.opacity)},rgb(){return it(this).rgb()}}));var at=e=>()=>e;function lt(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):at(isNaN(e)?t:e)}var st=function e(t){var n=function(e){return 1==(e=+e)?lt: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):at(isNaN(t)?n:t)}}(t);function r(e,t){var r=n((e=Pe(e)).r,(t=Pe(t)).r),o=n(e.g,t.g),i=n(e.b,t.b),a=lt(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),ut=/^class(-pyramid)?/,ct=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,s=t.limits,u={},c="percent"===t.limitType?s.map((function(e){return o+(i-o)*e})):s,f=t.colors.map((function(t){return e.resolveUIColor(t)}));if(o=Math.min.apply(Math,[o].concat(Z(c))),i=Math.max.apply(Math,[i].concat(Z(c))),u.min=o,u.max=i,t.breakTypes&&-1===t.breakTypes.indexOf(!0))u.type="categorical",Object.assign(u,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 s=0;s<r.length;s++)t<r[s]&&r[s]<n&&(a.push(r[s]),i.push(o[s]));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 u=0;u<r.length;u++)if(r[u]>n){i.push(o[u]),i.push(o[u]);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:s}));else if(t.breakTypes){var d=t.breakTypes;u.type="continuous",u.domain=[o],u.range=[f[0]];for(var p=0;p<c.length;p+=1)if(d[p]){var h=f[p],m=f[p+1],v=st(h,m)(.5);u.range.push(v),u.domain.push(c[p]),p<c.length-1&&d[p+1]&&(u.range.push(f[p+1]),u.domain.push((c[p]+c[p+1])/2))}else u.range.push(f[p]),u.range.push(f[p+1]),u.domain.push(c[p]),u.domain.push(c[p]+Math.min(1e-6,(i-o)/1e6));u.range.push(f[f.length-1]),u.domain.push(i)}else u.domain=c,u.range=f;return u};function ft(e,t,n,r,o){var i,a,l,s=0,u=[],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)||(u[l]?u[l]+=1:u[l]=1);for(i=0;i<u.length;i+=1)u[i]&&(s+=1);return s<=r||s>=o?Math.max(s,r):ft(e,t,n,r+1,o)}var dt=function(e,t,n,r){var o,i,a=t.theme,l=t.hc,s=r.f,u={mode:"field",fieldType:"measure",field:s?s.key():void 0,reverse:n.input.reverseScheme||!1,type:"continuous",range:function(e){return e.resources.theme.palette("quant")}},c=[],f=!0;if(s){if(Number.isNaN(+s.min())||Number.isNaN(+s.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:s.key()},exclude:{fields:l.qDimensionInfo.map((function(e,t){return{field:"qDimensionInfo/".concat(t)}})),value:function(e){return Math.min.apply(Math,Z(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(u.min=n.input.measureMin,u.max=n.input.measureMax,u.max<u.min)return{invalid:!0}}else if(s&&!f)u.min=s.min(),u.max=s.max();else if(s){if(!c.length)return{invalid:!0};u.min=Math.min.apply(Math,Z(c)),u.max=Math.max.apply(Math,Z(c))}if(n.input.measureScheme&&(u.palettes={quant:n.input.measureScheme}),a){var d=a.getDataColorScales().filter((function(e){return e.key===n.input.measureScheme}))[0];u.type=d&&ut.test(d.type)?"categorical":"continuous","categorical"===u.type&&(i=d.colors.some((function(e){return Array.isArray(e)}))?Math.max.apply(Math,Z(d.colors.map((function(e){return e?e.length:0})))):d.colors.length)}if("categorical"===u.type){for(var p=f?ft(u.max,u.min,c,1,i):i,h=(u.max-u.min)/p,m=[],v=0;v<p+1;v+=1)m.push(u.min+h*v);u.domain=m,u.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 u};function pt(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 ht(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)),z(z({},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 z(z({},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 mt(e){e.measureOverrides.every((function(e){return!e}))&&(e.measureOverrides=null)}function vt(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 s=n.indexOf(i);-1!==s&&(n.splice(s,1),r.splice(s,1))}}return{domain:n,range:r,exclude:o}}function yt(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?pt:i,l=n.input.byMeasureDef||{activeMeasureIndex:0},s=a(n,l),u=dt(0,{theme:r,hc:o},n,{f:s});if(u.invalid)return u;"expression"===l.type&&(l.activeMeasureIndex<0||void 0===l.activeMeasureIndex)&&(u.label=l.label,s&&"color.altLabel"===s.raw().labelExpRef&&(u.label=n.input.altLabel)),!u.label&&s&&(u.label=s.title());var c=l.activeMeasureIndex>=0?s:null;if(!c&&s&&void 0!==s.raw().matchMeasure&&s.raw().matchMeasure>-1&&(c=n.pic.fields().filter((function(e){return"measure"===e.type()}))[s.raw().matchMeasure]),n.input.useMeasureGradient&&"libraryItem"===l.type)if(c){var f=c.raw().coloring;f&&f.gradient&&le(u,ct(e,f.gradient,u,c))}else u.auxiliary=l;return u}(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?fe:o,a=r.getCByField,l=void 0===a?de:a,s=r.getPersistence,u=void 0===s?ce:s,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),le(h,u(t,n,c,f,{byRow:ue,byElemNo:se})),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 s=dt(0,{hc:o,theme:i},n,{f:l});return s.invalid||(s.label=n.input.expressionLabel||a.get("Object.ChartTooltip.ColorExpression")),s}(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 s=[],u=[];"measure"===n.input.useBaseColors&&o.qMeasureInfo.forEach((function(t,n){if(t.baseColor||t.coloring&&t.coloring.baseColor){s.push(n);var o=e.resolveUIColor(t.baseColor||t.coloring.baseColor);"none"===o?u.push(r.primary):u.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:s.length?{domain:s,range:u}: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 ht({cm:e,input:n,defaults:r,index:o,pic:t.pic})})),function(e,t){var n,r,o,i=t.translator;if(mt(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=vt(e.measureOverrides,e.explicit),mt(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=vt(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 gt(e){var t=z({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(le(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=le(!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=le(!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||{}).key;if("measure"===e.fieldType)return r.getMeasure(o,t).catch((function(){}));if("dimension"===e.fieldType){var i="".concat(n,"/").concat(e.field).replace("qDimensionInfo","qDimensions").replace("qAttrDimInfo","qAttributeDimensions");return Promise.all([/qAttrDimInfo/.test(e.field)?r.getAttributeDimension(i,t).catch((function(){})):Promise.resolve(),o?r.getDimensionColorMap(o,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 ct(o,r.coloring.gradient,e,i)}return{}}if("dimension"===e.fieldType){var a={nil:e.nil,others:e.others},l=r[0],s=r[1]?r[1].colorMap:null;if(l){var u=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=u}return s?function(e,t,n,r){var o=r.external,i=r.field,a=z({},e);le(a,se(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,le(a,se(i)))):!1===t.autoFill&&t.single?a.range=[n.resolveUIColor(t.single)]:t.autoFill&&(l&&(a.palettes={categorical:l.key}),le(a,se(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 s=o.items[l],u=(s.text||s).label;r[u]&&-1===a.indexOf(s.value)&&(a.push(s.value),i.push(t.resolveUIColor(r[u])))}return a.push(-3,-2),i.push(n.others),i.push(n.nil),a},range:function(){return i}}}(t.colors,n,a)),a}(a,s,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=z(z({},e),r.getDataColorSpecials())),n.settings=le(e,yt(this,n,t,e))}return n.settings}};return o}var bt=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},xt=function(e){throw e.isHandled=!0,e},qt=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()},wt=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()},Dt=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(xt):Promise.reject()};function Ct(e){return function(t){return"object"===B(t.datum[e])?t.datum[e].value:void 0}}function It(e){return"object"===B(e.datum.isNull)?e.datum.isNull.value:-2===e.datum.value}function Mt(e){return-3===e.datum.value}var kt={TITLE:{COLOR:void 0,FONT_SIZE:"16px",FONT_FAMILY:"'Source Sans Pro', 'Arial', 'sans-serif'"},LABEL:{COLOR:void 0,FONT_SIZE:void 0,FONT_FAMILY:"'Source Sans Pro', 'Arial', 'sans-serif'"}};function St(e){var t=e.theme,n=e.key,r=e.styleOverrides,o={title:{color:kt.TITLE.COLOR,fontSize:kt.TITLE.FONT_SIZE,fontFamily:kt.TITLE.FONT_FAMILY},label:{color:kt.LABEL.COLOR,fontSize:kt.LABEL.FONT_SIZE,fontFamily:kt.LABEL.FONT_FAMILY}};if(!t&&!r)return o;var i=r||{},a=i.title,l=i.label,s=function(e){var t=e.theme,n=e.key;return function(e,r,o,i){return void 0!==e?e:t?t.getStyle(n,r,o):i}}({theme:t,key:n});return o.title.color=s(null==a?void 0:a.color,"legend.title","color",kt.TITLE.COLOR),o.title.fontSize=s(null==a?void 0:a.fontSize,"legend.title","fontSize",kt.TITLE.FONT_SIZE),o.title.fontFamily=s(null==a?void 0:a.fontFamily,"legend.title","fontFamily",kt.TITLE.FONT_FAMILY),o.label.color=s(null==l?void 0:l.color,"legend.label","color",kt.LABEL.COLOR),o.label.fontSize=s(null==l?void 0:l.fontSize,"legend.label","fontSize",kt.LABEL.FONT_SIZE),o.label.fontFamily=s(null==l?void 0:l.fontFamily,"legend.label","fontFamily",kt.LABEL.FONT_FAMILY),o}var Ot=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"},Et=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 At(e,t){var n=e.styleReference,r=e.styleOverrides,o=e.chart,i=e.rtl,a=t.legendProps,l=t.coloring,s=t.theme,u=t.hc,c=St({theme:s,key:n,styleOverrides:r});return{layout:{minimumLayoutMode:"MEDIUM",dock:Ot(a,o,i)},show:"function"==typeof a.show?function(){return Et(a,u,l)}:Et(a,u,l),renderer:"svg",mounted:function(e){e.childNodes[0].style.pointerEvents="none",e.style.overflow="hidden"},settings:{title:{show:!1!==a.showTitle,wordBreak:"break-word",maxLines:2,lineHeight:1.2,text:l.label||"",fill:c.title.color,fontSize:c.title.fontSize,fontFamily:c.title.fontFamily}}}}function Nt(e,t,n){return"categorical"===t.coloring.type?function(e,t,n){var r=At(e,t);if(!r.show)return!1;var o,i=e.key,a=e.styleReference,l=e.styleOverrides,s=e.viewState,u=e.rtl,c=e.settings,f=e.style,d=t.scaleKey,p=t.theme,h=t.scales,m=St({theme:p,key:a,styleOverrides:l}),v=r.layout.dock,y="left"===v||"right"===v?{maxLines:2,wordBreak:"break-word"}:{},g={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"};"dimension"===t.coloring.fieldType&&(o=function(e){return e.datum.value>=0||-3===e.datum.value});var b="".concat(d,"Legend");return le(!0,r,{type:"legend-cat",key:"".concat(i,"-cat"),scale:b in h?b:d,settings:{layout:{scrollOffset:function(){return s?s.get("legendScrollOffset"):void 0},size:-1!==["top","bottom"].indexOf(r.layout.dock)?2:1,direction:u?"rtl":"ltr",horizontal:20},item:{show:o,label:z({fill:m.label.color,fontSize:m.label.fontSize,fontFamily:m.label.fontFamily},y)},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:g[n]})])])}}}},brush:{consume:[{context:"selection",data:["",i],style:{inactive:{opacity:.3}}}]}},{settings:c,style:f})}(e,t,n):"continuous"===t.coloring.type&&function(e,t){var n,r=e.key,o=e.styleReference,i=e.styleOverrides,a=e.rtl,l=e.settings,s=e.style,u=t.scaleKey,c=t.theme,f="".concat(u,"Range"),d=At(e,t);if(!d.show)return!1;var p=St({theme:c,key:o,styleOverrides:i}),h=d.layout.dock,m="right"===h||"left"===h,v=null===(n=t.scales)||void 0===n?void 0:n[f];return m&&v&&(v.invert=!0),le(!0,d,{type:"legend-seq",key:"".concat(r,"-seq"),settings:{fill:u,major:f,length:1,tick:{fill:p.label.color,fontSize:p.label.fontSize,fontFamily:p.label.fontFamily},title:{anchor:!a||"top"!==d.layout.dock&&"bottom"!==d.layout.dock?void 0:"right",padding:parseFloat(d.settings.title.fontSize)||16}}},{settings:l,style:s})}(e,t)}function Lt(e,t,n){var r=[],o=[],i=Nt(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={},Y(e,"".concat(n,"start"),(function(e){e.preventDefault(),this.started!==n&&(this.started=n,this.chart.component("".concat(r,"-cat")).emit("panstart",e))})),Y(e,"".concat(n,"move"),(function(e){e.preventDefault(),this.chart.component("".concat(r,"-cat")).emit("panmove",e)})),Y(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 Pt=function(e){return"rgba(".concat([(16711680&e)>>16,(65280&e)>>8,255&e,((4278190080&e)>>>24)/255].join(","),")")};function Tt(e){var t=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.auto,n=gt(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 qt(e,{layout:n,app:r})})).getMeasure((function(e,t){var n=t.layout,r=t.app;return wt(e,{layout:n,app:r})})).getAttributeDimension((function(e,t){var n=t.layout,r=t.model,o=t.app;return Dt(e,{layout:n,model:r,app:o})}));return n.getSnapshotData=bt,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=z({},o),r={},!n.key)throw new Error("Missing key");t.set(z(z({},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=z(z({},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,s=r.getDataColorScales().filter((function(e){return e.key===l}))[0];if(s){var u=s.colors[0]?s.colors:[[]].concat(Z(s.colors.slice(1)));u=Array.isArray(u[0])?u.map((function(e){return e.slice().reverse()})):u.slice().reverse(),o.push({key:"quant",colors:u})}}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={},s=o;if(n){var u={override:!0,domain:n.explicit&&"function"==typeof n.explicit.domain?n.explicit.domain:[].concat(Z((n.explicit||{}).domain||[]),[-3,-2]),range:n.explicit&&"function"==typeof n.explicit.range?n.explicit.range:[].concat(Z((n.explicit||{}).range||[]),[n.others,n.nil])};if("field"===n.mode){if("dimension"===n.fieldType){var c,f=function(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}({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:u,type:"categorical-color",label:function(e){return e.datum.text&&e.datum.text.value?e.datum.text.value:e.datum.label}};l[s]=h,c&&(l["".concat(s,"Legend")]=z(z({},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[s]=le({},m,{type:"categorical"===n.type?"threshold-color":"sequential-color",range:n.range,domain:n.domain,invert:n.reverse}),"sequential-color"===l[s].type&&(l["".concat(s,"Range")]=le({},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:u,type:"categorical-color"};l[s]=v}else if("measure"===n.mode){var y={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:u,type:"categorical-color"};l[s]=y}}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=Ct(r),i=Ct("".concat(r,"IsAnOther")),a=function(e,t){var r=e.fieldType,a=e.invalid,l=e.mode,s=e.nil,u=e.others,c=e.primary,f=e.type;return a?function(e){return Mt(e)||i(e)?u:s}:n[t]?function(e){return Mt(e)?u:It(e)||-2===o(e)&&"dimension"===r||"NaN"===o(e)?s:i(e)?u:e.resources.scale(t)(o(e))||u}:"constant"===l?function(e){return Mt(e)||i(e)?u:It(e)?s:c}:"color"===f?function(e){return Mt(e)||i(e)?u:It(e)?s:o(e)||u}:null},l=a(t,r);if(t.measureOverrides){var s=Ct("".concat(r,"MeasureIdx")),u=t.measureOverrides.map((function(e){return e&&a(e)}));return function(e){var t=s(e);return u[t]?u[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,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,u=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?Pt(e.qNum):e.qText&&Ee(e.qText)?e.qText:c})):"dimension"===o.mode?n=void 0!==o.field?o.field:r.qDimensionInfo.length-1:"measure"===o.mode&&(n=s);var f=Y({},u,n);return r.qDimensionInfo.length>1&&(f["".concat(u,"IsAnOther")]={fields:r.qDimensionInfo.map((function(e,t){return{field:"qDimensionInfo/".concat(t)}})),value:function(e){return-1!==e.indexOf(-3)}}),l&&(f["".concat(u,"MeasureIdx")]=s),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,s=e.styleReference,u=void 0===s?"object.legend":s,c=e.styleOverrides,f=e.settings,d=void 0===f?{}:f,p=e.style,h=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Lt({eventName:t,key:r,rtl:l,viewState:i,chart:a,styleReference:u,styleOverrides:c,settings:d,style:void 0===p?{}:p},{legendProps:n.legendProps,scaleKey:n.key,coloring:o(),theme:n.theme,hc:n.hc,scales:this.scales()},h)}};return i}var Ft=function(e){return e.baseColor||e.coloring&&e.coloring.baseColor};function jt(e){var t=e.qHyperCube,n=t.qDimensionInfo,r=t.qMeasureInfo,o=n.some(Ft),i=r.some(Ft),a=e.color.useBaseColors;return"measure"===a&&!i||"dimension"===a&&!o?"off":a}function Rt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return z(z(z({},e),t),{},{colorProps:z(z({},e.colorProps),t.colorProps||{})})}var $t=function(e){return e.baseColor||e.coloring&&e.coloring.baseColor};function Ht(e){var t,n=e.qHyperCube.qDimensionInfo.some($t),r=e.qHyperCube.qMeasureInfo.some($t),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 _t=function(){};function zt(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}var Vt=["__proto__","constructor"];function Bt(e,t,n){if(void 0!==e&&void 0!==t){var r=t.split("."),o=r[r.length-1];if(!Vt.some((function(e){return r.includes(e)}))){for(var i=e,a=0;a<r.length-1;++a){var l=r[a];void 0===i[l]&&(i[l]=Number.isNaN(+r[a+1])?{}:[]),i=i[l]}void 0!==n?i[o]=n:delete i[o]}}}function Ut(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 Wt(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 Yt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Wt(Object(n),!0).forEach((function(t){Kt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Kt(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Gt=Object.prototype.hasOwnProperty,Zt=Object.prototype.toString,Jt=Object.defineProperty,Xt=Object.getOwnPropertyDescriptor,Qt=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===Zt.call(e)},en=function(e){if(!e||"[object Object]"!==Zt.call(e))return!1;var t,n=Gt.call(e,"constructor"),r=e.constructor&&e.constructor.prototype&&Gt.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!r)return!1;for(t in e);return void 0===t||Gt.call(e,t)},tn=function(e,t){Jt&&"__proto__"===t.name?Jt(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},nn=function(e,t){if("__proto__"===t){if(!Gt.call(e,t))return;if(Xt)return Xt(e,t).value}return e[t]},rn=function e(){var t,n,r,o,i,a,l=arguments[0],s=1,u=arguments.length,c=!1;for("boolean"==typeof l&&(c=l,l=arguments[1]||{},s=2),(null==l||"object"!=typeof l&&"function"!=typeof l)&&(l={});s<u;++s)if(null!=(t=arguments[s]))for(n in t)r=nn(l,n),l!==(o=nn(t,n))&&(c&&o&&(en(o)||(i=Qt(o)))?(i?(i=!1,a=r&&Qt(r)?r:[]):a=r&&en(r)?r:{},tn(l,{name:n,newValue:e(c,a,o)})):void 0!==o&&tn(l,{name:n,newValue:o}));return l};function on(e,t,n,r){if(!e)return-1;const o=n.cache,i=e.origin?e.origin():null;i&&(e=i);let a=o.fields.indexOf(e),l=-1,s=-1;if(-1===a)for(let t=0;t<o.wrappedFields.length;t++)if(s=o.wrappedFields[t].attrDims.map((e=>e.instance)).indexOf(e),l=o.wrappedFields[t].attrExps.map((e=>e.instance)).indexOf(e),-1!==s||-1!==l){a=t;break}if(Array.isArray(r)&&r.some(((e,t)=>e!==t))){const e=r.indexOf(a);-1!==e&&(a=e)}return a-=t.qArea.qLeft,a<0||a>=t.qArea.qWidth?-1:s>=0?e=>e[a].qAttrDims.qValues[s]:l>=0?e=>e[a].qAttrExps.qValues[l]:e=>e[a]}function an(e,t,n){let{key:r}=n;const 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 ln(e){let{cache:t,f:n,mainCell:r,p:o,prop:i,page:a,rowIdx:l,row:s,sourceKey:u,target:c,targetProp:f,columnOrder:d}=e,p=r;if(o.field&&o.field!==n){const e=on(o.field,a,{cache:t},d);if(-1===e)return;p=rn({qRow:l},e(s))}c[f]=an(o,p,{key:u})}function sn(e,t,n,r){const o=Array.isArray(e)?e:[e];let i=[];for(let e=0;e<o.length;e++)if(void 0!==o[e].field){const a=t.raw(),l=t.key(),s="object"==typeof o[e].field?o[e].field:t.field(o[e].field),{props:u,main:c}=r.normalizeConfig(o[e],t),f=Object.keys(u),d=!!o[e].trackBy,p=typeof o[e].trackBy,h={},m=[],v=[];for(let t=0;t<a.qDataPages.length;t++){const i=on(s,a.qDataPages[t],{cache:n},a.qColumnOrder);if(-1!==i)for(let y=0;y<a.qDataPages[t].qMatrix.length;y++){const g=a.qDataPages[t].qArea.qTop+y,b=rn({qRow:g},i(a.qDataPages[t].qMatrix[y])),x=an(c,b,{key:l});if(!c.filter||c.filter(b)){for(let e=0;e<f.length;e++){const r=u[f[e]];let o=r.fields||[r];r.fields&&(x[f[e]]=[]);for(let i=0;i<o.length;i++)ln({cache:n,f:s,mainCell:b,p:o[i],prop:f[e],props:u,page:a.qDataPages[t],rowIdx:g,row:a.qDataPages[t].qMatrix[y],sourceKey:l,target:r.fields?x[f[e]]:x,targetProp:r.fields?i:f[e],columnOrder:a.qColumnOrder});if(r.fields){const t=x[f[e]].map((e=>e.value)),n=x[f[e]].map((e=>e.label));x[f[e]]={value:"function"==typeof r.value?r.value(t):void 0!==r.value?r.value:t,label:"function"==typeof r.label?r.label(n):void 0!==r.label?String(r.label):String(x[f[e]].value)}}}d&&r.track({cfg:o[e],itemData:b,obj:x,target:m,tracker:h,trackType:p}),v.push(x)}}}const y=d?r.collect(m,{main:c,propsArr:f,props:u}):v;i=[...i,...y]}return i}function un(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 cn(e,t){e instanceof Map?(e=[void 0,e],void 0===t&&(t=dn)):void 0===t&&(t=fn);for(var n,r,o,i,a,l=new mn(e),s=[l];n=s.pop();)if((o=t(n.data))&&(a=(o=Array.from(o)).length))for(n.children=o,i=a-1;i>=0;--i)s.push(r=o[i]=new mn(o[i])),r.parent=n,r.depth=n.depth+1;return l.eachBefore(hn)}function fn(e){return e.children}function dn(e){return Array.isArray(e)?e[1]:null}function pn(e){void 0!==e.data.value&&(e.value=e.data.value),e.data=e.data.data}function hn(e){var t=0;do{e.height=t}while((e=e.parent)&&e.height<++t)}function mn(e){this.data=e,this.depth=this.height=0,this.parent=null}function vn(e){return null==e?null:function(e){if("function"!=typeof e)throw new Error;return e}(e)}mn.prototype=cn.prototype={constructor:mn,count:function(){return this.eachAfter(un)},each:function(e,t){let n=-1;for(const r of this)e.call(t,r,++n,this);return this},eachAfter:function(e,t){for(var n,r,o,i=this,a=[i],l=[],s=-1;i=a.pop();)if(l.push(i),n=i.children)for(r=0,o=n.length;r<o;++r)a.push(n[r]);for(;i=l.pop();)e.call(t,i,++s,this);return this},eachBefore:function(e,t){for(var n,r,o=this,i=[o],a=-1;o=i.pop();)if(e.call(t,o,++a,this),n=o.children)for(r=n.length-1;r>=0;--r)i.push(n[r]);return this},find:function(e,t){let n=-1;for(const r of this)if(e.call(t,r,++n,this))return r},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(){return Array.from(this)},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 cn(this).eachBefore(pn)},[Symbol.iterator]:function*(){var e,t,n,r,o=this,i=[o];do{for(e=i.reverse(),i=[];o=e.pop();)if(yield o,t=o.children)for(n=0,r=t.length;n<r;++n)i.push(t[n])}while(i.length)}};var yn={depth:-1},gn={},bn={};function xn(e){return e.id}function qn(e){return e.parentId}function wn(e){let t=e.length;if(t<2)return"";for(;--t>1&&!Dn(e,t););return e.slice(0,t)}function Dn(e,t){if("/"===e[t]){let n=0;for(;t>0&&"\\"===e[--t];)++n;if(0==(1&n))return!0}return!1}function Cn(e,t){"/"===e.charAt(0)&&(e=e.substring(1));const n=e.split("/");let r,o=t;for(let e=0;e<n.length;e++){if("*"===n[e]&&Array.isArray(o)){const t=[];r=n.slice(e+1).join("/");for(let e=0;e<o.length;e++){let n=Cn(r,o[e]);Array.isArray(n)?t.push(...n):t.push(n)}return t}if(!n[e]&&Array.isArray(o)){const t=new Array(o.length);r=n.slice(e+1).join("/");for(let e=0;e<o.length;e++)t[e]=Cn(r,o[e]);return t}n[e]in o&&(o=o[n[e]])}return o}function In(e,t,n){let r=[];if(!e||!e.length)return r;if(t<=0){const t=n>=0?[e[n]]:e;r=[...r,...t]}else for(let o=0;o<e.length;o++)e[o].children&&e[o].children.length&&(r=[...r,...In(e[o].children,t-1,n)]);return r}function Mn(e,t,n){if(e===t)return e=>e;if(e>t){const n=Math.max(0,Math.min(100,e-t));return e=>{let t=e;for(let e=0;e<n;++e)t=t.parent;return t}}if(t>e){const r=Math.max(0,Math.min(100,t-e));return e=>In(e.children,r-1,n)}return!1}const kn=/^qDimensionInfo(?:\/(\d+))?/,Sn=/^\/?qMeasureInfo\/(\d+)/,On=/\/qAttrExprInfo\/(\d+)/,En=/\/qAttrDimInfo\/(\d+)/;function An(e){return(e.qColumnOrder&&e.qColumnOrder.length?e.qColumnOrder:e.qDimensionInfo.map(((e,t)=>t))).filter((t=>t<e.qDimensionInfo.length))}function Nn(e,t){let{cube:n}=t;if(!e)return-1;let r=e.origin&&e.origin()?e.origin().key():e.key(),o=!1,i=-1,a=-1,l=-1,s=-1,u=-1,c=-1,f=r;const d=n.qEffectiveInterColumnSortOrder,p=An(n);return kn.test(f)&&(o=!0,i=+kn.exec(f)[1],f=r.replace(kn,"")),Sn.test(f)&&("K"===n.qMode?u=+Sn.exec(f)[1]:d&&-1!==d.indexOf(-1)?(u=+Sn.exec(f)[1],c=0):c=+Sn.exec(f)[1],f=f.replace(Sn,"")),f&&(En.exec(f)?l=+En.exec(f)[1]:On.exec(f)&&(a=+On.exec(f)[1])),s=o?"S"===n.qMode?p[i]:d?d.indexOf(i):i:d&&-1!==d.indexOf(-1)?d.indexOf(-1):n.qDimensionInfo.length-("K"===n.qMode?0:1),{fieldDepth:s+1,pseudoMeasureIndex:u,measureIdx:c,attrDimIdx:l,attrIdx:a}}function Ln(e,t){let n,r,o=Mn(e.fieldDepth,t.fieldDepth,t.pseudoMeasureIndex);return n=t.measureIdx>=0?e=>e.data.qValues[t.measureIdx]:e=>e.data,t.attrDimIdx>=0?r=e=>{var n;return null==e||null===(n=e.qAttrDims)||void 0===n?void 0:n.qValues[t.attrDimIdx]}:t.attrIdx>=0&&(r=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 Pn(e,t,n){let{key:r}=n;const 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 Tn(e){let{propsArr:t,props:n,item:r,itemData:o,ret:i,sourceKey:a}=e;for(let e=0;e<t.length;e++){const l=n[t[e]],s=l.fields||[l];let u,c;l.fields&&(u=[],c=[]);for(let n=0;n<s.length;n++){const f=s[n];let d,p,h,m,v,y;if("primitive"===f.type?(h=f.value,y=String(f.value)):("function"==typeof f.value&&(d=e=>f.value(e,r)),"function"==typeof f.label&&(p=e=>f.label(e,r)),f.accessor?(m=f.accessor(r),Array.isArray(m)?(v=m.map(f.valueAccessor),f.attrAccessor&&(v=v.map(f.attrAccessor)),d&&(h=v.map(d),d=null),p&&(y=v.map(p),p=null),h=f.reduce?f.reduce(h):h,y=f.reduceLabel?f.reduceLabel(y,h):String(h)):(h=f.attrAccessor?f.attrAccessor(f.valueAccessor(m)):f.valueAccessor(m),y=h)):(h=o,y=o)),l.fields){const e=d?d(h):h;u.push(e),c.push(p&&null!=y?p(y):null!=y?y:String(e))}else{const n=d?d(h):h;i[t[e]]={value:n,label:p?p(y):null!=y?y:String(n)},f.field&&(i[t[e]].source={field:f.field.key(),key:a})}}u&&(i[t[e]]={value:"function"==typeof l.value?l.value(u,r):u,label:"function"==typeof l.label?l.label(c,r):c})}}const Fn=(e,t,n)=>{const r="K"===e.qMode?"/qStackedDataPages/*/qData":"/qTreeDataPages/*",o="K"===e.qMode?"qSubNodes":"qNodes",i=Cn(r,e);return i&&i[0]?(t.tree=cn(i[0],n.children||(e=>e[o])),t.tree):null};function jn(e){const t=e.raw().qDataPages.length?e.raw().qDataPages[0].qMatrix:[],n=function(e){const t=e.raw().qColumnOrder,n=e.fields();return t&&t.length===n.length?t:n.map(((e,t)=>t))}(e),r=e.fields(),o=e.fields().filter((e=>"dimension"===e.type())).map((e=>n.indexOf(r.indexOf(e)))),i=e.fields().filter((e=>"measure"===e.type())).map((e=>n.indexOf(r.indexOf(e)))),a={__root:{__id:"__root",qValues:[]}};for(let e=0;e<t.length;e++){const n=t[e];let r="__root",s=!1;for(let e=0;e<o.length;e++){var l;const t=n[o[e]],i="".concat(r,"__").concat(null!==(l=t.qElemNumber)&&void 0!==l?l:t.qElemNo);a[i]||(a[i]=Yt({__id:i,__parent:r,qValues:[]},t),s=!0),r=i}if(s)for(let e=0;e<i.length;e++){const t=n[i[e]];a[r].qValues.push(t)}}const s=Object.keys(a).map((e=>a[e]));return function(){var e,t=xn,n=qn;function r(r){var o,i,a,l,s,u,c,f,d=Array.from(r),p=t,h=n,m=new Map;if(null!=e){const t=d.map(((t,n)=>function(e){let t=(e=`${e}`).length;return Dn(e,t-1)&&!Dn(e,t-2)&&(e=e.slice(0,-1)),"/"===e[0]?e:`/${e}`}(e(t,n,r)))),n=t.map(wn),o=new Set(t).add("");for(const e of n)o.has(e)||(o.add(e),t.push(e),n.push(wn(e)),d.push(bn));p=(e,n)=>t[n],h=(e,t)=>n[t]}for(a=0,o=d.length;a<o;++a)i=d[a],u=d[a]=new mn(i),null!=(c=p(i,a,r))&&(c+="")&&(f=u.id=c,m.set(f,m.has(f)?gn:u)),null!=(c=h(i,a,r))&&(c+="")&&(u.parent=c);for(a=0;a<o;++a)if(c=(u=d[a]).parent){if(!(s=m.get(c)))throw new Error("missing: "+c);if(s===gn)throw new Error("ambiguous: "+c);s.children?s.children.push(u):s.children=[u],u.parent=s}else{if(l)throw new Error("multiple roots");l=u}if(!l)throw new Error("no root");if(null!=e){for(;l.data===bn&&1===l.children.length;)l=l.children[0],--o;for(let e=d.length-1;e>=0&&(u=d[e]).data===bn;--e)u.data=null}if(l.parent=yn,l.eachBefore((function(e){e.depth=e.parent.depth+1,--o})).eachBefore(hn),l.parent=null,o>0)throw new Error("cycle");return l}return r.id=function(e){return arguments.length?(t=vn(e),r):t},r.parentId=function(e){return arguments.length?(n=vn(e),r):n},r.path=function(t){return arguments.length?(e=vn(t),r):e},r}().id((e=>e.__id)).parentId((e=>e.__parent))(s)}const Rn=e=>{let{propsArr:t,props:n,cube:r,cache:o,itemDepthObject:i,f:a}=e;for(let e=0;e<t.length;e++){const l=n[t[e]],s=l.fields?l.fields:[l];for(let e=0;e<s.length;e++){const t=s[e];if(t.field!==a){const e=Ln(i,Nn(t.field,{cube:r,cache:o}));t.accessor=e.nodeFn,t.valueAccessor=e.valueFn,t.attrAccessor=e.attrFn}}}};function $n(){let 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;const o=t.raw(),i=t.key(),a="S"===o.qMode?jn(t):Fn(o,n,e);if(!a)return null;const l=a.height,s=[];for(let i=0;i<=l;i++){let a=null;if(i>0)if("S"===o.qMode){let e=An(o)[i-1];a=n.fields[e]}else{let e=o.qEffectiveInterColumnSortOrder[i-1];i>o.qEffectiveInterColumnSortOrder.length&&(e=o.qDimensionInfo.length),a=n.fields[e]}const{props:l,main:u}=r.normalizeConfig(Yt(Yt({},e),{},{field:a?a.key():void 0}),t),c=Object.keys(l);s[i]={propsArr:c,props:l,main:u};const f=a?Nn(a,{cube:o,cache:n}):{fieldDepth:0};Rn({propsArr:c,props:l,cube:o,cache:n,itemDepthObject:f,f:a})}const u=a.copy().descendants(),c=a.descendants();for(let e=0;e<c.length;e++){const t=s[c[e].depth].propsArr,n=s[c[e].depth].props,r=s[c[e].depth].main,o=u[e],a=o.data,l=Pn(r,a,{key:i});Tn({propsArr:t,props:n,item:o,itemData:a,ret:l,sourceKey:i,isTree:!0}),c[e].data=l}return a}function Hn(e,t,n,r){const o=Array.isArray(e)?e:[e];let i=[];for(let a=0;a<o.length;a++)if(void 0!==o[a].field){const l=t.raw(),s=t.key();if(!Fn(l,n,e))continue;const u="object"==typeof o[a].field?o[a].field:t.field(o[a].field),{props:c,main:f}=r.normalizeConfig(o[a],t),d=Object.keys(c),p=Nn(u,{cube:l,cache:n}),{nodeFn:h,attrFn:m,valueFn:v}=Ln({fieldDepth:0},p);Rn({propsArr:d,props:c,cube:l,cache:n,itemDepthObject:p,f:u});const y=!!o[a].trackBy,g=typeof o[a].trackBy,b={},x=[],q=h(n.tree),w=[];for(let e=0;e<q.length;e++){const t=q[e],n=m?m(v(t)):v(t);if(f.filter&&!f.filter(n))continue;const i=Pn(f,n,{key:s});Tn({propsArr:d,props:c,item:t,itemData:n,ret:i,sourceKey:s}),y&&r.track({cfg:o[a],itemData:n,obj:i,target:x,tracker:b,trackType:g}),w.push(i)}const D=y?r.collect(x,{main:f,propsArr:d,props:c}):w;i=[...i,...D]}return i}var _n,zn,Vn=(_n=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,s,u,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\-\+#]/),y=d-v,g=e.substring(y,y+1),b=y+("."===g||","===g?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"),(!(u=t.split("."))[1]||u[1]&&u[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(;u[0].length<e[0].length-a;)u[0]="0"+u[0];else 0==+u[0]&&(u[0]="");if((t=t.split("."))[0]=u[0],s=c[1]&&c[c.length-1].length){for(m="",y=(f=t[0]).length%s,d=f.length,b=0;b<d;b++)m+=f.charAt(b),!((b-y+1)%s)&&b<d-s&&(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}},_n(zn={exports:{}}),zn.exports);function Bn(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}const Un={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"},Wn=/%\)?$/,Yn=/^\(r(0[2-9]|[12]\d|3[0-6])\)/i,Kn=/^\(oct\)/i,Gn=/^\(dec\)/i,Zn=/^\(hex\)/i,Jn=/^\(bin\)/i,Xn=/^\(rom\)/i,Qn=/^(\(rom\)|\(bin\)|\(hex\)|\(dec\)|\(oct\)|\(r(0[2-9]|[12]\d|3[0-6])\))/i,er=/#|0/g;function tr(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 nr(e,t,n){const r=Bn(e);return n?r:new RegExp(r||"",t)}function rr(e,t,n,r){let o,i,a,l,s,u,c,f,d,p=e.pattern;var h,m;r&&(e.abbreviate=!0),h=t,(m=n)&&(m=Bn(m)),h&&(h=Bn(h)),d=new RegExp("(?:[#0]+".concat(h,")?[#0]+(?:").concat(m,"[#0]+)?")),a=p.match(d),a=a?a[0]:"",l=a?p.substr(0,p.indexOf(a)):p,s=a?p.substring(p.indexOf(a)+a.length):"",a||(a=p?"#":"##########"),t&&t===n&&(o=a.split(n),i=o.pop(),a=o.join("")+n+i,t=""),u=t,t=/,/.test(n)?"¤":",",u&&(a=a.replace(nr(u,"g"),t)),c=n,n=".",c&&(a=a.replace(nr(c,"g"),n)),f=a.match(/#/g),f=f?f.length:0;const v=p.split(c);let y;v[1]&&(y=v[1].match(er)),e.prefix=l||"",e.postfix=s||"",e.pattern=p,e.maxPrecision=y?y.length:2,e.percentage=Wn.test(p),e.numericPattern=a||"",e.numericRegex=new RegExp("".concat(nr(t,null,!0),"|").concat(nr(n,null,!0)),"g"),e.groupTemp=u,e.decTemp=c,e.t=t,e.d=n,e.temp=f}class or{constructor(e,t,n,r,o){this.localeInfo=e,this.pattern=t,this.thousandDelimiter=n||",",this.decimalDelimiter=r||".",this.type=o||"numeric",this.patternSeparator=";",this.abbreviations=function(e,t){if(!e||!e.qNumericalAbbreviation)return Un;const n={};return e.qNumericalAbbreviation.split(t).forEach((e=>{let t=e.split(":");2===t.length&&(n[t[0]]=t[1])})),n}(e,this.patternSeparator),this.prepare()}clone(){const e=new or(this.localeInfo,this.pattern,this.thousandDelimiter,this.decimalDelimiter,this.type);return e.subtype=this.subtype,e}format(e,t,n,r){return this.prepare(t,n,r),this.formatValue(e)}prepare(e,t,n){let r;if(void 0===e&&(e=this.pattern),void 0===t&&(t=this.thousandDelimiter),void 0===n&&(n=this.decimalDelimiter),!e)return void(this._prepared={pattern:!1});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],Qn.test(e[0])&&(r.positive.isFunctional=!0),e[1]?Qn.test(e[1])&&(r.negative.isFunctional=!0):r.negative=!1,e[2]?Qn.test(e[2])&&(r.zero.isFunctional=!0):r.zero=!1;const o="U"===this.type;r.positive.isFunctional||rr(r.positive,t,n,o),r.negative&&!r.negative.isFunctional&&rr(r.negative,t,n,o),r.zero&&!r.zero.isFunctional&&rr(r.zero,t,n,o)}formatValue(e){let t,n,r,o,i,a,l,s,u,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,c.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){let r;return Yn.test(t)?e=tr(e,Number(/\d{2}/.exec(t)[0]),t,n):Kn.test(t)?e=tr(e,8,t,n):Gn.test(t)?e=tr(e,10,t,n):Zn.test(t)?e=tr(e,16,t,n):Jn.test(t)?e=tr(e,2,t,n):Xn.test(t)&&(r="",e<0&&(r="-",e=-e),0===(e=Math.floor(e))?e="0":e<=5e5?(e=function(e,t){let 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();for(;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),e=r+e):e=t+r+e.toExponential(0)),e}(e,c.pattern,i);else{if(c.percentage&&(e*=100),c.abbreviate){const t=Object.keys(this.abbreviations).map((e=>parseInt(e,10))).sort(((e,t)=>e-t));let r,o,i=t[0];for(l=0,n=Number(Number(e).toExponential().split("e")[1]);i<=n&&l<t.length;)l++,i=t[l];l>0&&(r=t[l-1]),r&&n>0&&r>0?o=r:(n<0&&r<0||!r)&&(i<0&&i-n<=c.maxPrecision?o=i:r<=n&&!(i>0&&-n<=c.maxPrecision)&&(o=r)),o&&(f=this.abbreviations[o],e/=10**o)}if(r=Math.abs(e),t=c.temp,s=c.numericPattern,u=s.split(i)[1],"I"===this.type&&(e=Math.round(e)),o=e,u||"#"!==s.slice(-1)[0])if(r>=1e15||r>0&&r<=1e-14)e=r?r.toExponential(15).replace(/\.?0+(?=e)/,""):"0";else{const t=Number(e.toFixed(Math.min(20,u?u.length:0)).split(".")[0]);let n=s.split(i)[0];if(n+=i,e=Vn(n,t)||"0",u){const t=Math.max(0,Math.min(14,u.length)),n=u.replace(/#+$/,"").length;let o=("I"===this.type?0:r%1).toFixed(t).slice(2).replace(/0+$/,"");for(l=o.length;l<n;l++)o+="0";o&&(e+=i+o)}else 0===t&&(o=0)}else if(r>=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(s+=i,t=Math.max(0,Math.min(20,t-Math.ceil(Math.log(r)/Math.log(10)))),l=0;l<t;l++)s+="#";e=Vn(s,e)}e=e.replace(c.numericRegex,(e=>e===a?c.groupTemp:e===i?c.decTemp:"")),o<0&&!/^-/.test(e)&&(e="-".concat(e))}return c.prefix+e+d+f+c.postfix}static getStaticFormatter(){return{prepare(){},formatValue:e=>"".concat(e)}}}function ir(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{size:n=5e3,multipleArguments:r=!1,toKey:o=(e=>e)}=t;let i,a,l=Object.create(null),s=Object.create(null),u=0,c=0;return i=r?function(){return a=o(...arguments),i.has(a)?i.get(a):i.set(a,e(...arguments))}:t=>(a=o(t),i.has(a)?i.get(a):i.set(a,e(t))),i.set=(e,t)=>(u>=n&&(delete l[s[c]],delete s[c],u--,c++),l[e]=t,s[u]=e,u++,t),i.get=e=>l[e],i.has=e=>e in l,i.clear=()=>{l=Object.create(null),s=Object.create(null),u=0,c=0},i.size=()=>u,i}function ar(e,t,n,r,o){const i=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return new or(...t)}(o,e,t,n,r),a=ir(i.formatValue.bind(i),{toKey:e=>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}const lr="IV",sr=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],ur=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],cr=["January","February","March","April","May","June","July","August","September","October","November","December"],fr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function dr(e,t){for(let n=e.length;n<t;n++)e="0".concat(e);return e}function pr(e){let t=e.toString().split(".");return t[1]?(t=Number("0.".concat(t[1])),t):0}class hr{constructor(e,t,n){const r=e||{};r.qCalendarStrings||(r.qCalendarStrings={qLongDayNames:sr,qDayNames:ur,qLongMonthNames:cr,qMonthNames:fr}),this.localeInfo=r,this.locale_days=r.qCalendarStrings.qLongDayNames.slice(),this.locale_days_abbr=r.qCalendarStrings.qDayNames.slice(),this.locale_months=r.qCalendarStrings.qLongMonthNames.slice(),this.locale_months_abbr=r.qCalendarStrings.qMonthNames.slice(),t||(t={T:r.qTimeFmt||"hh:mm:ss",D:r.qDateFmt||"YYYY-MM-DD",TS:r.qTimestampFmt||"YYYY-MM-DD hh:mm:ss"}[n]),this.pattern=t}clone(){const e=new hr(this.localeInfo,this.pattern);return e.subtype=this.subtype,e}format(e,t){t||(t=this.pattern?this.pattern:"YYYY-MM-DD hh:mm:ss"),t=t.replace(/\[.+]|\[|]/g,"");const n=/t+/gi.test(t);let r;e instanceof Date?r=function(e,t){let n=e.getUTCHours(),r=e.getUTCDay()-1;return t&&(n%=12,n||(n=12)),r<0&&(r=6),{year:e.getUTCFullYear(),month:e.getUTCMonth(),day:r,date:e.getUTCDate(),h:n,m:e.getUTCMinutes(),s:e.getUTCSeconds(),f:e.getUTCMilliseconds(),t:e.getUTCHours()>=12?"pm":"am"}}(e,n):(e<0&&(e=-e,t="-".concat(t)),r=function(e,t){let n,r=function(e){const t=e,n=24*pr(t),r=60*pr(n),o=60*pr(r),i=1e3*pr(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,s=r.f,u=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)&&(u=n?n.getDay()-1:0,u<0&&(u=6));let c="";return n&&(c=n.getUTCHours()>=12?"pm":"am"),{year:0,month:0,day:u,date:o,h:i,m:a,s:l,f:s,t:c}}(e,t));const o=(i=this,a=r,{"Y+|y+":{Y:"".concat(Number("".concat(a.year).slice(-2))),YY:dr("".concat(a.year).slice(-2),2),YYY:dr("".concat(a.year).slice(-3),3),def:e=>dr("".concat(a.year),e.length)},"M+":{M:a.month+1,MM:dr("".concat(a.month+1),2),MMM:i.locale_months_abbr[a.month],def:i.locale_months[a.month]},"W+|w+":{W:a.day,WW:dr("".concat(a.day),2),WWW:i.locale_days_abbr[a.day],def:i.locale_days[a.day]},"D+|d+":{D:a.date,def:e=>dr("".concat(a.date),e.length)},"h+|H+":{h:a.h,def:e=>dr("".concat(a.h),e.length)},"m+":{m:a.m,def:e=>dr("".concat(a.m),e.length)},"s+|S+":{s:a.s,def:e=>dr("".concat(a.s),e.length)},"f+|F+":{def(e){let t="".concat(a.f),n=e.length-t.length;if(n>0)for(let e=0;e<n;e++)t+="0";else n<0&&(t=t.slice(0,e.length));return t}},"t{1,2}|T{1,2}":{def(e){let t=a.t;return e[0].toUpperCase()===e[0]&&(t=t.toUpperCase()),t=t.slice(0,e.length),t}}});var i,a;const l=[];for(const e in o)Object.prototype.hasOwnProperty.call(o,e)&&l.push(e);const s=new RegExp(l.join("|"),"g");return t.replace(s,(e=>{let t,n,r;for(n in o)if(Object.prototype.hasOwnProperty.call(o,n)&&(t=new RegExp(n),t.test(e)))break;if(!t)return"";for(const t in o[n])if(t===e||t.toLowerCase()===e){r=o[n][t],void 0===r&&(r=o[n][t.toLowerCase()]);break}return void 0===r&&(r=o[n].def),"function"==typeof r&&(r=r(e)),r}))}}function mr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return new hr(...t)}function vr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"TS",n=mr(arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,e,t),r=ir(n.format.bind(n),{toKey:e=>"object"==typeof e&&"function"==typeof e.getTime?e.getTime():e});function o(e){return t!==lr?function(e){return new Date(Date.UTC(1899,11,30+Math.floor(e),0,0,0,Math.round(864e5*(e-Math.floor(e)))))}(e):e}function i(e){return e=o(e),r(e)}return i.format=function(e,t){return r.clear(),t=o(t),n.format(t,e)},i.locale=function(o){return n=mr(o,e,t),r=ir(n.format.bind(n),{toKey:e=>"object"==typeof e?e.getTime():e}),this},i.qtype=function(e){return void 0!==e&&(t=e,r.clear()),t},i}function yr(){let e,{meta:t,id:n,key:r,localeInfo:o,fieldExtractor:i,value:a,type:l,sourceField:s}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const u=a||("dimension"===l?e=>null==e?void 0:e.qElemNo:e=>null==e?void 0:e.qValue),c="dimension"===l?"first":"avg",f=function(e,t){if(e&&e.qNumFormat&&-1!==["D","T","TS","IV"].indexOf(e.qNumFormat.qType))return vr(e.qNumFormat.qFmt,e.qNumFormat.qType,t);let 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,"##"),i="U"),ar(n,r,o,i,t)}(t,o),d="dimension"===l?"first":(e,t)=>f(t),p={id:()=>n,key:()=>r,raw:()=>t,title:()=>t.qFallbackTitle||t.label,type:()=>l,origin:()=>s,items:()=>(e||(e=i(p)),e),min:()=>t.qMin,max:()=>t.qMax,value:u,label:e=>(null==e?void 0:e.qText)||"",reduce:c,reduceLabel:d,formatter:()=>f,tags:()=>t.qTags};return p}function gr(e,t,n,r,o){return(t[e]||[]).map(((t,i)=>{const a="".concat(r?"".concat(r,"/"):"").concat(e,"/").concat(i),l={instance:yr(rn({id:"".concat(n?"".concat(n,"/"):"").concat(a),key:a,meta:t},o))};return l.attrDims=gr("qAttrDimInfo",t,n,a,rn({},o,{value:e=>null==e?void 0:e.qElemNo,type:"dimension"})),l.attrExps=gr("qAttrExprInfo",t,n,a,rn({},o,{value:e=>null==e?void 0:e.qNum,type:"measure"})),l.measures=gr("qMeasureInfo",t,n,a,rn({},o,{value:e=>null==e?void 0:e.qValue,type:"measure"})),l}))}function br(){let{key:e,data:t,config:n={}}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const r={fields:[],wrappedFields:[],allFields:[],virtualFields:[]},o=t;if(!o)throw new Error('Missing "data" input');if(!o.qDimensionInfo)throw new Error('The "data" input is not recognized as a hypercube');const i=br.util,a={cache:r,cube:o,localeInfo:n.localeInfo,fieldExtractor:null,pages:null,hierarchy:()=>null,virtualFields:n.virtualFields},l={key:()=>e,raw:()=>o,field:e=>function(e,t){let{cache:n}=t;if("number"==typeof e)return n.fields[e];const r=n.allFields;if("function"==typeof e){for(let t=0;t<r.length;t++)if(e(r[t]))return r[t];return!1}if("string"==typeof e){for(let t=0;t<r.length;t++)if(r[t].key()===e||r[t].title()===e)return r[t]}else if(e&&-1!==r.indexOf(e))return e;throw Error("Field not found: ".concat(e))}(e,a),fields:()=>r.fields.slice(),extract:e=>a.extractor(e,l,r,i),hierarchy:e=>a.hierarchy(e,l,r,i),_cache:()=>r};"K"===o.qMode||"T"===o.qMode||!o.qMode&&o.qNodesOnDim?(a.extractor=Hn,a.hierarchy=$n,a.pages="K"===o.qMode?o.qStackedDataPages:o.qTreeDataPages):"S"===o.qMode?(a.extractor=sn,a.pages=o.qDataPages,a.hierarchy=$n):a.extractor=()=>[],a.fieldExtractor=e=>a.extractor({field:e},l,r,i);const s="S"===o.qMode?e=>e.qElemNumber:void 0,u="S"===o.qMode?e=>e.qNum:void 0;r.wrappedFields.push(...gr("qDimensionInfo",o,e,"",rn({},a,{value:s,type:"dimension"}))),r.wrappedFields.push(...gr("qMeasureInfo",o,e,"",rn({},a,{value:u,type:"measure"}))),r.fields=r.wrappedFields.map((e=>e.instance));const c=e=>{e.forEach((e=>{r.allFields.push(e.instance),c(e.measures),c(e.attrDims),c(e.attrExps)}))};return c(r.wrappedFields),(n.virtualFields||[]).forEach((t=>{const n=l.field(t.from),o=yr(Yt({meta:n.raw(),id:"".concat(e,"/").concat(t.key),sourceField:n,fieldExtractor:e=>a.extractor({field:e},l,r,i),key:t.key,type:n.type(),localeInfo:a.localeInfo,value:n.value},t.override||{}));r.virtualFields.push(o)})),r.allFields.push(...r.virtualFields),l}const xr=[["qHyperCube","qHyperCubeDef"],["qTreeData","qTreeDataDef"],["qDimensionInfo","qDimensions"],["qMeasureInfo","qMeasures"],["qAttrDimInfo","qAttributeDimensions"],["qAttrExprInfo","qAttributeExpressions"]],qr=/\/qDimensionInfo(?:\/(\d+))?/,wr=/\/qMeasureInfo\/(\d+)/,Dr=/\/qAttrDimInfo\/(\d+)(?:\/(\d+))?/,Cr=/\/qAttrExprInfo\/(\d+)/,Ir=/\/?qHyperCube/,Mr=/\/?qTreeData/,kr=e=>"".concat(e.substr(0,e.indexOf("/qHyperCubeDef")+14)),Sr=e=>"".concat(e.substr(0,e.indexOf("/qTreeDataDef")+13));function Or(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;const r=t.byCells,o=t.primarySource,i=[],a={},l=e.isActive();let s=!1;return e.brushes().forEach((e=>{const t=function(e,t){let n=e,r=-1,o=-1,i="",a=e=>e;Ir.test(e)?(i="".concat(n.substr(0,n.indexOf("qHyperCube")+10)),a=kr):Mr.test(e)&&(i="".concat(n.substr(0,n.indexOf("qTreeData")+9)),a=Sr);let l=!0;if(qr.test(e)&&(r=+qr.exec(e)[1]),wr.test(e)&&(o=+wr.exec(e)[1]),Dr.test(e)){o=-1,r=0;const e=+Dr.exec(n)[2];isNaN(e)||(r=e,n=n.replace(/\/\d+$/,"")),l=!1}if(Cr.test(e)){const e=o;if(t){o=0;const a=Cn(i,t);o+=(a.qMeasureInfo||[]).length,r>-1?(o=a.qDimensionInfo.slice(0,r).reduce(((e,t)=>e+t.qAttrExprInfo.length),o),r=-1):(o=a.qDimensionInfo.reduce(((e,t)=>e+t.qAttrExprInfo.length),o),o=a.qMeasureInfo.slice(0,e).reduce(((e,t)=>e+t.qAttrExprInfo.length),o)),o+=+Cr.exec(n)[1]}else r>-1?(r=-1,o=+Cr.exec(n)[1]):o+=+Cr.exec(n)[1]+1}return xr.forEach((e=>{let[t,r]=e;n=n.replace(t,r)})),l&&(n=a(n)),n&&"/"!==n[0]&&(n="/".concat(n)),{measureIdx:o,dimensionIdx:r,path:n}}(e.id,n);if("range"===e.type&&t.measureIdx>-1&&t.dimensionIdx>-1){const n=e.brush.ranges();n.length&&(s=!0,a.multiRangeSelectTreeDataValues||(a.multiRangeSelectTreeDataValues={path:t.path,ranges:[]}),n.forEach((e=>a.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){const n=e.brush.ranges();n.length&&(s=!0,a.rangeSelectHyperCubeValues||(a.rangeSelectHyperCubeValues={path:t.path,ranges:[]}),n.forEach((e=>a.rangeSelectHyperCubeValues.ranges.push({qMeasureIx:t.measureIdx,qRange:{qMin:e.min,qMax:e.max,qMinInclEq:!0,qMaxInclEq:!0}}))))}if("range"===e.type&&t.dimensionIdx>-1){const n=e.brush.ranges();n.length&&(s=!0,a.selectHyperCubeContinuousRange||(a.selectHyperCubeContinuousRange={path:t.path,ranges:[]}),n.forEach((e=>a.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(r)if(n&&n.qHyperCube&&("P"===n.qHyperCube.qMode||"T"===n.qHyperCube.qMode||"K"===n.qHyperCube.qMode)){const r=n.qHyperCube,i=r.qNoOfLeftDims,l=r.qEffectiveInterColumnSortOrder.indexOf(t.dimensionIdx);if(a.selectPivotCells||(a.selectPivotCells={path:t.path,cells:[]}),e.id===o||!o){const n=e.brush.values().map((e=>+e)).filter((e=>!isNaN(e)));(0===i||l>=i)&&i>-1?n.forEach((e=>{a.selectPivotCells.cells.push({qType:"T",qCol:e,qRow:l-i})})):n.forEach((e=>{a.selectPivotCells.cells.push({qType:"L",qCol:t.dimensionIdx,qRow:e})})),s=!!a.selectPivotCells.cells.length}}else a.selectHyperCubeCells||(a.selectHyperCubeCells={path:t.path,cols:[]}),a.selectHyperCubeCells.cols.push(t.dimensionIdx),e.id!==o&&(o||a.selectHyperCubeCells.values)||(a.selectHyperCubeCells.values=e.brush.values().map((e=>+e)).filter((e=>!isNaN(e))),s=!!a.selectHyperCubeCells.values.length);else{const n=e.brush.values().map((e=>+e)).filter((e=>!isNaN(e)));s=!!n.length,i.push({params:[t.path,t.dimensionIdx,n,!1],method:"selectHyperCubeValues"})}}})),!s&&l?[{method:"resetMadeSelections",params:[]}]:(a.rangeSelectHyperCubeValues&&i.push({method:"rangeSelectHyperCubeValues",params:[a.rangeSelectHyperCubeValues.path,a.rangeSelectHyperCubeValues.ranges,[],null===(u=t.orMode)||void 0===u||u]}),a.selectHyperCubeContinuousRange&&i.push({method:"selectHyperCubeContinuousRange",params:[a.selectHyperCubeContinuousRange.path,a.selectHyperCubeContinuousRange.ranges]}),a.selectHyperCubeCells&&i.push({method:"selectHyperCubeCells",params:[a.selectHyperCubeCells.path,a.selectHyperCubeCells.values,a.selectHyperCubeCells.cols]}),a.selectPivotCells&&i.push({method:"selectPivotCells",params:[a.selectPivotCells.path,a.selectPivotCells.cells]}),a.multiRangeSelectTreeDataValues&&i.push({method:"multiRangeSelectTreeDataValues",params:[a.multiRangeSelectTreeDataValues.path,a.multiRangeSelectTreeDataValues.ranges]}),i);var u}function Er(e){br.util=e.data("matrix").util,e.data("q",br),e.formatter("q-number",ar),e.formatter("q-time",vr)}function Ar(e){var t=zt(e.layout||{},e.path.split("/").join("."));if(!t)return!1;var n=t.qIsOneAndOnlyOne;return void 0!==n&&n}function Nr(){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"===B(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 Lr(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))}Er.qBrushHelper=Or,Er.selections=Or;var Pr="Shift";function Tr(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 s=e.filter((function(e){return-2!==e.value}));if(s.length>1){var u=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=Ar({layout:n,path:e}),r=o.filter((function(t){return t.key===e})),i=t?[r.pop()]:r;a.push.apply(a,Z(i))})),a.filter(Boolean)}({layout:l,values:s});return u}return s},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 Fr=function e(t,n){return n[t]?e(t+1,n):t},jr=function(e,t){var n=t.reduce((function(e,t){return e[t]=!0,e}),{});return e.reduce((function(e,t,r){var o=Fr(r,n);return n[o]=!0,e[r]=o,e}),{})};function Rr(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.layout,n=e.filtered,r=void 0===n?{}:n,o=(null==t?void 0:t.qHyperCube)||{},i=o.qDimensionInfo,a=void 0===i?[]:i,l=o.qMeasureInfo,s=void 0===l?[]:l;return{dimensions:jr(a,r.dimensions||[]),measures:jr(s,r.measures||[])}}var $r="selectHyperCubeValues",Hr="selectHyperCubeContinuousRange";function _r(e){var t=e.selection,n=e.fieldMap,r=t.method,o=t.params;if(r===$r){var i=n.dimensions[o[1]];void 0!==i&&(o[1]=i)}return r===Hr&&o[1].forEach((function(e){var t=n.dimensions[e.qDimIx];void 0!==t&&(e.qDimIx=t)})),t}var zr=[],Vr=0,Br=function(e){var t=zr.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()})))},Ur=function(){document.addEventListener("keyup",Br)},Wr=function(){document.removeEventListener("keyup",Br)},Yr=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 Gr(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,s=e.emit,u=void 0===s?"rangeClear":s,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(u),"string"==typeof l&&t.brush(l).clear(),d)}var Zr=["chart","document","selections","selectionInfo"],Jr=function(e){e.chart,e.document,e.selections,e.selectionInfo;var t=K(e,Zr);t.clearDiscrete(),t.clearContinuous(),t.clearMinor(),t.clearRange(),t.clearTap(),t.clearLegend()};function Xr(e){var t,n=e.lasso;null!=n&&null!==(t=n.active)&&void 0!==t&&t.call(n)&&(null==n||n.action(!1))}function Qr(e){var t,n=e.chart,r=e.selectionInfo,o=e.selectionActions,i=e.actions,a=void 0===i?{}:i,l=e.selections,s=e.selectionEvents;if(!1===o||!1===s)return function(){};var u=o.reset,c=void 0===u?Xr:u,f=o.clear,d=!1!==f&&function(e){var t=e.clear,n=void 0===t?Jr: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(z({clearDiscrete:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(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,s=e.cleared;return Gr({selectionInfo:t,chart:n,document:r,eventName:void 0!==s&&s?void 0:i,componentName:l,emit:"areaClear",brushName:e.brushName})}(z(z({},t),e))},clearContinuous:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(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,s=e.cleared;return Gr({selectionInfo:t,chart:n,document:r,eventName:void 0!==s&&s?void 0:i,componentName:l,brushName:e.brushName})}(z(z({},t),e))},clearMinor:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(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,s=e.cleared,u=void 0!==s&&s,c=e.brushName,f=Gr({selectionInfo:t,chart:n,document:r,eventName:u?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),y=v.brushes().filter((function(e){return"range"===e.type&&m.some((function(t){return t===e.id}))}));v&&y.length&&y.forEach((function(e){v.removeRanges(e.brush.ranges().map((function(t){return{key:e.id,range:t}})))}))}}(z(z({},t),e))},clearRange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(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;Gr({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()}(z(z({},t),e))},clearTap:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(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 s=n.currentComponent;n.previousComponent!==s&&(r.clear(),l.forEach((function(e){return t.brush(e).end()})))}}(z(z({},t),e))},clearLegend:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(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,s=void 0===l?"legend-range-brush":l,u=e.cleared,c=void 0!==u&&u,f=e.brushName;Gr({selectionInfo:t,chart:n,document:r,eventName:c?void 0:a,componentName:s,brushName:void 0!==f&&f})&&o.clear()}(z(z({},t),e))}},t))}}({clear:f,selections:l,selectionInfo:r,chart:n}),p=function(e){var t=e.chart,n=e.actions,r=e.reset,o=e.clear,i=!1,a={deactivated:function(e){var t=(n||{}).lasso;r({e:e,lasso:void 0!==t&&t})},canceled:function(e){var i=(n||{}).lasso;r({e:e,lasso:void 0!==i&&i}),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:d,reset:c,actions:a}),h={};Object.entries(p).forEach((function(e){var t=G(e,2),n=t[0],r=t[1];h[n]=function(e,t){return t?function(n){return t({event:n,defaultFunc:e})}:e}(r,s[n])}));var m=function(e){var t=e.selectionEvents,n=e.selections,r=e.selectionInfo,o=e.clear,i=e.chart,a=e.document,l=t.start,s={selections:n,selectionInfo:r,chart:i,document:a},u=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)(z(z({},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:u})}};return"function"==typeof l?function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];l(z(z({defaultFunc:c({event:e,components:t}),setSelectionInfo:u,clear:o},s),{},{event:e,components:t}))}:function(e){c({event:e,components:arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]})()}}({selectionEvents:s,selections:l,selectionInfo:r,clear:d,chart:n,document:document});return null==a||null===(t=a.select)||void 0===t||t.on("start",m),Object.entries(h).forEach((function(e){var t=G(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",m),Object.entries(h).forEach((function(e){var t=G(e,2),n=t[0],r=t[1];null==l||l.removeListener(n,r)}))}}var eo=[{key:"qHyperCube/qDimensionInfo/0:numeric",includeMax:!1}];function to(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,s=i.majorScale,u=void 0===s?void 0:s,c=i.selectionActions,f=void 0===c?{}:c,d=f.clear,p=f.reset,h=i.selectionEvents,m=void 0===h?{deactivated:void 0,canceled:void 0,cleared:void 0,start:void 0}:h,v=i.brushEvents,y=void 0===v?{}:v,g=i.brushName,b=void 0===g?"selection":g,x=i.brushMaxListeners,q=void 0===x?20:x,w=i.brushRanges,D=void 0!==w&&w,C=i.interceptors,I=void 0===C?{}:C,M=i.selectionsFn,k=void 0===M?o.selections:M,S=t.brush(b);if("number"==typeof q&&S.setMaxListeners(q),D){var O=!0===D?eo:D;S.configure({ranges:O})}var E={canSelect:!0,getIsSelectionLocked:!1,isInnerDimensionLocked:!1,lockedDimensions:[],singleSelectIndex:0,selectionInfo:{colorField:void 0,components:[],event:void 0,currentComponent:void 0,previousComponent:void 0}},A=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,s=void 0===l?"/qHyperCubeDef":l;if(!n)return{layout:function(){},filteredFields:function(){},allowSimultaneous:function(){},release:function(){}};var u=++Vr,c=null,f={dimensions:[],measures:[]},d=[],p={};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 h=Tr({brush:r,getConfig:function(){return{layout:c,allowSimultaneous:d}}}),m=h.rangeInterceptor,v=h.interceptor;r.intercept("set-ranges",m),r.intercept("toggle-ranges",m),r.intercept("toggle-values",v),r.intercept("set-values",v),r.intercept("add-values",v),r.on("start",(function(){return n.begin(s)}));var y={activate:function(){},deactivated:function(){return r.end()},cleared:function(){return r.clear()},canceled:function(){return r.end()}};Yr(n,y);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&&(p=(e=i.select).getBrushOptions.apply(e,arguments))})),i.select.on("end",(function(){var e=a(r,p,c),t=Rr({layout:c,filtered:f});e.forEach((function(e){var r=_r({selection:e,fieldMap:t});(function(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)}}})(r,i.select.brushSelectionIncludeMax,g),n.select(r)}))}))):r.on("update",(function(){var e=a(r,p,c),t=Rr({layout:c,filtered:f});e.forEach((function(e){n.select(_r({selection:e,fieldMap:t}))}))})),0===zr.length&&Ur(),zr.push({key:u,selections:n}),{layout:function(e){c=e},filteredFields:function(e){f=e},allowSimultaneous:function(e){d=e},release:function(){c=null;var e=zr.indexOf(zr.filter((function(e){return e.key===u}))[0]);-1!==e&&zr.splice(e,1),zr.length||Wr(),Kr(n,y)}}}({brush:S,majorScale:u,actions:n,selections:r,picassoQ:o,selectionsFn:k});!function(e){var t=e.brush,n=e.interceptors,r=void 0===n?{}:n;Object.entries(r).forEach((function(e){var n=G(e,2),r=n[0],o=n[1];(Array.isArray(o)?o:[o]).forEach((function(e){t.intercept(r,e)}))}))}({brush:S,interceptors:I});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,s=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=G(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=G(e,2),r=n[0],o=n[1];t.removeListener(r,o)}))}}({brush:r,chart:t,selectionInfo:i,brushEvents:e.brushEvents}),u=Qr({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||e.key!==Pr||(t.lasso.action(!0),n=!0)},o=function(e){e.key===Pr&&(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(){s(),u(),c()}}({chart:t,brush:S,actions:n,selections:r,selectionInfo:E.selectionInfo,selectionActions:{clear:d,reset:p},selectionEvents:m,brushEvents:y});if(l){var L=!0===l?Z(Array(15)).map((function(e,t){return"qHyperCube/qMeasureInfo/".concat(t)})):l;A.allowSimultaneous(L)}return{unbindEvents:N,state:E,picassoSelections:A,brush:S}}var no=["colorField","useLegendCube"];function ro(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=to({chart:t,actions:o,selections:n,picassoQ:Er,config:a}),s=l.unbindEvents,u=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,y=void 0===v?Lr:v;return{getIsDimensionLocked:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return u.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:Nr(r)},getIsSingleSelect:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:u.singleSelectIndex;return u.singleSelectDimensions[e]},getCanSelect:function(){return u.canSelect},getSelectionInfo:function(){return u.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 s=(null!==(n=null==a?void 0:a.qHyperCube)&&void 0!==n?n:{}).qDimensionInfo,u=void 0===s?[]:s;return l.lockedDimensions=u.map((function(e){return!!e.qLocked})),l.singleSelectDimensions=u.map((function(e,t){return Ar({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===u.length||u.some((function(e){return!e.qLocked})),l.dimensionLocked=!(null===(r=u[0])||void 0===r||!r.qLocked),l}({selections:n,picassoSelections:c,layout:e});Object.assign(u,t)},setFilteredFields:function(e){c.filteredFields(e)},setBrushAliases:function(e){var t=e.colorField,n=e.useLegendCube,r=void 0!==n&&n,o=K(e,no),i=z({useLegendCube:r,colorField:t,brush:f,legendAlias:m},o);y(z(z({},i),{},{defaultFunc:function(){return Lr(i)}}))},destroy:function(){s(),c.release()},custom:z({},p)}}var oo={dataRelatedPropertiesPaths:["qHyperCube.qGrandTotalRow","qHyperCube.qHasOtherValues","qHyperCube.qSize","qHyperCube.qDimensionInfo[].qAttrDimInfo","qHyperCube.qDimensionInfo[].qCardinalities","qHyperCube.qDimensionInfo[].qMax","qHyperCube.qDimensionInfo[].qMin","qHyperCube.qDimensionInfo[].qStateCounts","qHyperCube.qMeasureInfo[].qApprMaxGlyphCount","qHyperCube.qMeasureInfo[].qAttrExprInfo","qHyperCube.qMeasureInfo[].qMax","qHyperCube.qMeasureInfo[].qMin","qHyperCube.qMeasureInfo[].qTrendLines","qHyperCube.qTreeNodesOnDim","qSelectionInfo"]};function io(e){const{qHyperCube:t,...n}=e,{qAxisData:r,qDataPages:o,qStackedDataPages:i,qTreeDataPages:a,...l}=t,s=H(!0,{},{...n,qHyperCube:{...l,qAxisData:null,qDataPages:null,qStackedDataPages:null,qTreeDataPages:null}}),{dataRelatedPropertiesPaths:u}=oo;return u.forEach((e=>{const t=e.split("[");if(1===t.length)void 0!==zt(s,e)&&Bt(s,e,null);else{const e=t[0],n=t[1].split("].")[1];zt(s,e,[]).forEach((e=>{void 0!==zt(e,n)&&Bt(e,n,null)}))}})),s}var ao={axes:{trackBy:function({isTime:e,isContinuous:t,isMeasure:n,isMajor:r}){return o=>{if(e||t||n){var i;if("line"===o.type)return null!==(i=o.tickValue)&&void 0!==i?i:"axis";if("text"===o.type)return`${o.tickValue} ${o.text}`;if("container"===o.type){const e=o.children.filter((e=>"text"===e.type)).map((e=>e.text));return`${o.data.value} ${e.join("")}`}return Math.random()}if(r){if("line"===o.type&&void 0===o.tickValue)return"axis";const e=o.transform&&o.transform.match(/rotate/gi)?"rotated":"horizontal";return`${o.data.group?`${o.data.group.value} `:""}${o.data.value} ${o.text} ${e}`}return Math.random()}},compensateForLayoutChanges:function({isMeasure:e,isTime:t,isContinuous:n,isHorizontal:r,dock:o}){return({currentNodes:i,currentRect:a,previousRect:l})=>{const s=a.x-l.x,u=a.y-l.y,c=a.width-l.width,f=a.height-l.height;e?("left"===o&&i.forEach((e=>{"line"===e.type?(e.x1+=c,e.x2+=c):"text"===e.type&&(e.x+=c)})),"left"!==o&&"right"!==o||i.forEach((e=>{var t;("line"===e.type&&(e.x1===e.x2?(e.y1=a.y,e.y2=e.y1+a.height):(Math.round(e.y1)<a.y||e.y1>a.y+a.height)&&(e.strokeWidth=0)),"text"===e.type)&&((e.y<a.y||e.y>a.y+a.height)&&(e.fontSize="1px","#"===(null===(t=e.fill)||void 0===t?void 0:t[0])&&(e.fill=`${e.fill.slice(0,1)}00${e.fill.slice(1)}`)))})),"top"!==o&&"bottom"!==o||i.forEach((e=>{var t;("line"===e.type&&(e.y1===e.y2?(e.x1=a.x,e.x2=e.x1+a.width):(Math.round(e.x1)<a.x||e.x1>a.x+a.width)&&(e.strokeWidth=0)),"text"===e.type)&&((e.x<a.x||e.x>a.x+a.width)&&(e.fontSize="1px","#"===(null===(t=e.fill)||void 0===t?void 0:t[0])&&(e.fill=`${e.fill.slice(0,1)}00${e.fill.slice(1)}`)))}))):t?i.forEach((e=>{"line"===e.type?e.y1===e.y2?e.x2+=c:e.x1===e.x2&&(e.x1-=s,e.x2-=s):"text"===e.type&&(e.x-=s)})):n||r?i.forEach((e=>{"line"===e.type&&e.y1===e.y2&&(e.x1+=s,e.x2+=s+c)})):i.forEach((e=>{"line"===e.type&&e.x1===e.x2&&(e.y1+=u,e.y2+=u+f)}))}}},bars:{trackBy:function(e){return e.data.measureIndex?`${e.data.value} ${e.data.measureIndex.value}`:e.data.group?`${e.data.value} ${e.data.group.value}`:e.data.stack?`${e.data.value} ${e.data.stack.value}`:`${e.data.value}`},compensateForLayoutChanges:function({currentNodes:e,currentRect:t,previousRect:n}){const r=t.x-n.x,o=t.y-n.y;0===r&&0===o||e.forEach((e=>{e.children&&e.children.length>0&&e.children.forEach((e=>{void 0!==e.x&&void 0!==e.y?(e.x-=r,e.y-=o):e.transform=`translate(${-r}, ${-o})`}))}))}},barOobs:{compensateForLayoutChanges:function({currentNodes:e,currentRect:t,previousRect:n}){const r=t.x-n.x;0===t.y-n.y&&0===r||e.forEach((e=>{e.children&&e.children.length>0&&e.children.forEach((e=>{e.opacity=0}))}))}},labels:{trackBy:function(e){if("rect"===e.type)return"-3"===e.data?Math.random():`${e.type} ${e.data} ${e.rotation}`;const t=e.transform&&e.transform.match(/rotate/gi)?"rotated":"horizontal";return`${e.type} ${e.data} ${e.text} ${t}`},compensateForLayoutChanges:function({currentNodes:e,currentRect:t,previousRect:n}){const r=t.x-n.x,o=t.y-n.y;0===r&&0===o||e.forEach((e=>{e.transform&&e.transform.match(/rotate\(-90/gi)?(e.x+=o,e.y-=r):(e.x-=r,e.y-=o)}))},linkData:function(e){return e.data.measureIndex?`${e.data.value} ${e.data.measureIndex.value}`:e.data.group?`${e.data.value} ${e.data.group.value}`:e.data.stack?`${e.data.value} ${e.data.stack.value}`:`${e.data.value}`}},lines:{trackBy:function(e){var t;return"line"===e.type?null!==(t=e.value)&&void 0!==t?t:Math.random():"path"===e.type?`${e.generatorType} ${e.layerObj.id} ${e.data.source.key}`:Math.random()},compensateForLayoutChanges:function({currentNodes:e,currentRect:t,previousRect:n}){const r=t.x-n.x,o=t.y-n.y;e.forEach((e=>{if(void 0!==e.x1&&void 0!==e.y1)e.y1===e.y2?(e.x2=e.x1+t.width,e.y1-=o,e.y2-=o):e.x1===e.x2&&(e.y2=e.y1+t.height,e.x1-=r,e.x2-=r);else{const t="x"===e.major.p?r/e.major.size:o/e.major.size,n="y"===e.minor.p?o/e.minor.size:r/e.minor.size;e.points.forEach((e=>{e.modified||(e.major-=t,e.minor-=n,e.minor0-=n,e.modified=!0)}))}}))}},lineOobs:{compensateForLayoutChanges:function({currentNodes:e,currentRect:t,previousRect:n}){const r=t.x-n.x;0===t.y-n.y&&0===r||e.forEach((e=>{e.opacity=0}))}},points:{trackBy:function(e){return e.data.line?`${e.data.line.value} ${e.data.major.value}`:`${e.data.major.value}`},compensateForLayoutChanges:function({currentNodes:e,currentRect:t,previousRect:n}){const r=t.x-n.x,o=t.y-n.y;0===r&&0===o||e.forEach((e=>{e.cx-=r,e.cy-=o}))}},refLineLabels:{trackBy:function(e){if(void 0!==e.value){if("rect"===e.type)return`${e.value}`;if("text"===e.type)return`${e.value} ${e.text}`}return Math.random()},compensateForLayoutChanges:function({currentNodes:e,currentRect:t,previousRect:n}){const r=t.x-n.x,o=t.y-n.y,i=t.width-n.width,a=t.height-n.height;let l=-r,s=-o;e.forEach((e=>{switch(e.dock){case"right":r>0&&(l=t.width);break;case"left":i<0&&(l=-n.width);break;case"top":a<0&&(s=-n.height);break;case"bottom":o>0&&(s=t.height)}switch(e.type){case"text":case"rect":e.x+=l,e.y+=s;break;case"circle":e.cx+=l,e.cy+=s;break;case"path":e.transform=`translate(${l}, ${s})`}}))}},shadowBars:{trackBy:function(){return Math.random()}},cacheProperties:function({viewCache:e,layout:t}){const n=io(t);e.set("dataIndependentProperties",JSON.stringify(n))},propertiesHaveChanged:function({viewCache:e,layout:t}){const n=io(t);return e.get("dataIndependentProperties")!==JSON.stringify(n)},nonUpdatingNode:{trackBy:function(){return Math.random()}}};function lo(e){const t=e.node.desc&&e.node.desc.share;return t?e.formatter("share")(t):""}function so(e){return e.formatter("num")(e.node.data.num.value)}function uo({data:e}){return e?e.label:""}function co(e){if(e.dataPoint.auto)return lo;switch(e.dataPoint.labelMode){case"share":default:return lo;case"value":return so;case"none":return null}}function fo(e,t,n){const r=(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:co(e)}]:[{label:uo}],linkData:t=>".labelCenter"===n?"none"===e.dataPoint.labelMode?Math.random():`${t.data.value} ${co(e)(t)}`:`${t.data.value} ${uo(t)}`}}});return{key:"funnel-labels",type:"labels",layout:{displayOrder:2},settings:{sources:[r(".labelLeft",0),r(".labelCenter",.5)]},animations:{enabled:n,trackBy:e=>e.data}}}function po(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"}}}function ho({picasso:e}){const t=n(),c=r(),f=o(),d=i(),p=a(),h=l(),[m,v]=s(),[y,g]=s(),[b,x]=s(),[q,w]=s();return u((()=>{const n=function(e){var t,n,r,o,i=e.picasso,a=e.model,l=e.app,s=e.translator,u=e.layoutService,c=void 0===u?void 0:u,f=e.createConfig,d=void 0===f?_t:f,p=e.config,h=void 0===p?{}:p,m=e.custom,v=void 0===m?{}:m,y=h.localeInfo,g=h.key,b=h.theme,x=void 0===b?void 0:b,q=h.auto,w=void 0===q?void 0:q,D=h.definitionPath,C=null==c||null===(t=c.getLayout)||void 0===t?void 0:t.call(c),I={theme:x,key:g,localeInfo:y,layout:C,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:z(z({},null==c||null===(o=c.getLayoutValue)||void 0===o?void 0:o.call(c,"color")),{},{useBaseColors:C?jt(C):void 0})},M=Tt({picasso:i,model:a,app:l,translator:s,auto:w});!1!==w&&M.auto((function(e){return w?w({layout:e,defaultAuto:Ht}):Ht(e)}));var k=!1,S={getColor:function(){return M.color()},getPaletteColor:function(e){var t=e.index,n=e.color;return M.resolveUIColor({index:t,color:n})},getData:function(){return M.data()},getDatumProps:function(e){return M.datumProps(e)},getSnapshotData:function(){return M.getSnapshotData(D)},getSettingsForMeasure:function(e){return M.settingsForMeasure(e)},getSettings:function(){return M.settings()},getLegend:function(e,t){return M.legend(e,t)},getScales:function(){return M.scales()},getPalettes:function(){return M.palettes()},isSelectionLocked:function(e){var t=e.isMeasureSelectionLocked;return M.isSelectionLocked({isMeasureSelectionLocked:t})},isInitialized:function(){return k},custom:z({},v),initialize:function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).createConfig,t=(void 0===e?d:e)({getUseBaseColors:jt}),n=Rt(I,t);return M.config(n),M.getAuxiliarySettings(D).then((function(){k=!0}))}};return S}({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=ro({chart:r,selections:c,config:{selectionActions:!1}});return x(o),g(n),v(r),w(function(){var e={};return{get:function(t){return e[t]},set:function(t,n){return e[t]=n,n},has:function(t){return t in e},remove:function(t){delete e[t]},empty:function(){e={}}}}()),()=>{o.destroy(),r.destroy()}}),[]),[m,y,b,q]}function mo({picasso:e,flags:t}){const n=c(),r=f(),o=d(),i=p(),a=h(),s=m().qLocaleInfo,[g,b,x,q]=ho({picasso:e,layout:n}),w=l(),D=()=>{const e=g.element.clientWidth!==q.get("width")||g.element.clientHeight!==q.get("height");return!1!==w.chartAnimations&&t.isEnabled("IM_1355_ANIMATIONS_FUNNEL")&&!e&&!ao.propertiesHaveChanged({viewCache:q,layout:n})},[C]=v((()=>{if(!b)return Promise.resolve();const t=function(e){return{layout:e,keys:{SCALE:{FILL:"fill"},COMPONENT:{FUNNEL:"fun",FUNNEL_LABELS:"funnel-labels",DIMENSION_TITLE:"dimension-title"}}}}(n),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 W(V().mark((function e(){var r,a,l,s;return V().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=W(V().mark((function e(n){var r;return V().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(z({},o));case 4:if("object"===B(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(z({},o))}))),e.next=6,Promise.all([a,l]);case 6:s=e.sent,i.initialized=!0,(r=i.definitions).push.apply(r,Z(s[1]));case 9:case"end":return e.stop()}}),e)})))()},extendComponents:function(e){return i.initialized?(i.definitions.filter(Boolean).forEach((function(t){var n=G(e.filter((function(e){return e.key&&e.key===t.key})),1)[0];if(n){var r=le(!0,{},n.brush);le(!0,n,t),t.brush&&(n.brush=function(e,t){return"object"===B(e)&&Object.keys(e).length?(Array.isArray(t.consume)&&(e.consume=Ut({originalArray:e.consume,newArray:t.consume,matchKey:"context"})),Array.isArray(t.trigger)&&(e.trigger=Ut({originalArray:e.trigger,newArray:t.trigger,matchKey:"on"})),e):t}(r,t.brush))}else e.push(t)})),e):e}}}({picassoInstance:e,plugins:a,pluginArgs:t});return Promise.all([b.initialize({createConfig:({getUseBaseColors:e})=>({theme:r,colorProps:{...n.color,useBaseColors:e(n)},layout:n,hc:n.qHyperCube})}),o.initialize()]).then((()=>o))}),[n,b]);u((()=>{if(!g||!b||!C)return;const e=[{type:"q",key:"qHyperCube",data:n.qHyperCube,config:{localeInfo:s}},...b.getData()],t=function({layout:e,constraints:t,colorService:n,theme:r,pluginService:o,animationsEnabled:i}){const a=function(e){return{...e.getScales()}}(n),l=n.getPalettes(),s=function({layout:e,constraints:t,colorService:n,animationsEnabled:r}){const o=n.getDatumProps(),i=n.getColor(),a={type:"funnel",key:"fun",data:{extract:{field:"qDimensionInfo/0",props:{num:{field:"qMeasureInfo/0"},...o}}},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:i,mode:e.funnel.mode},animations:{enabled:r,isMainComponent:!0,trackBy:e=>`${e.tag}: ${e.data.value}`}};return a}({layout:e,constraints:t,colorService:n,animationsEnabled:i}),u=[s,fo(e,r,i),po(e)];return{palettes:l,style:{"$font-family":r.getStyle("","","fontFamily"),"$font-color":r.getStyle("","","color"),"$font-size":r.getStyle("","","fontSize")},scales:a,components:o.extendComponents(u),formatters:{share:{type:"d3-number",format:".1%"},num:{data:{field:"qMeasureInfo/0"}}}}}({layout:n,constraints:o,colorService:b,theme:r,pluginService:C,animationsEnabled:D});g.update({data:e,settings:t}),q.set("width",g.element.clientWidth),q.set("height",g.element.clientHeight),ao.cacheProperties({viewCache:q,layout:n})}),[g,b,r.name(),C,o]),u((()=>{g&&(g.update(),q.set("width",g.element.clientWidth),q.set("height",g.element.clientHeight))}),[i.width,i.height]),u((()=>{x&&x.setLayout(n)}),[n]),y((e=>b.getSnapshotData().then((t=>(e.snapshotData=e.snapshotData||{},e.snapshotData.content=e.snapshotData.content||{},e.snapshotData.content.chartData=t,e))).catch((()=>e))))}function vo(n){const r=e();r.use(t),r.component("funnel",M);const{flags:o}=n;return{ext:S,qae:{properties:{initial:k},data:{targets:O}},component(){mo({picasso:r,flags:o})}}}export{vo as default};