@spectrum-charts/vega-spec-builder 1.19.0-alpha → 1.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  /*! For license information please see index.js.LICENSE.txt */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@spectrum-charts/constants"),require("@spectrum-charts/themes"),require("@spectrum-charts/utils")):"function"==typeof define&&define.amd?define(["@spectrum-charts/constants","@spectrum-charts/themes","@spectrum-charts/utils"],t):"object"==typeof exports?exports.spectrumChartsVegaSpecBuilder=t(require("@spectrum-charts/constants"),require("@spectrum-charts/themes"),require("@spectrum-charts/utils")):e.spectrumChartsVegaSpecBuilder=t(e["@spectrum-charts/constants"],e["@spectrum-charts/themes"],e["@spectrum-charts/utils"])}(this,((e,t,a)=>(()=>{var n={743:e=>{"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===a}(e)}(e)},a="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function n(e,t){return!1!==t.clone&&t.isMergeableObject(e)?s((a=e,Array.isArray(a)?[]:{}),e,t):e;var a}function r(e,t,a){return e.concat(t).map((function(e){return n(e,a)}))}function i(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return Object.propertyIsEnumerable.call(e,t)})):[]}(e))}function o(e,t){try{return t in e}catch(e){return!1}}function s(e,a,l){(l=l||{}).arrayMerge=l.arrayMerge||r,l.isMergeableObject=l.isMergeableObject||t,l.cloneUnlessOtherwiseSpecified=n;var c=Array.isArray(a);return c===Array.isArray(e)?c?l.arrayMerge(e,a,l):function(e,t,a){var r={};return a.isMergeableObject(e)&&i(e).forEach((function(t){r[t]=n(e[t],a)})),i(t).forEach((function(i){(function(e,t){return o(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,i)||(o(e,i)&&a.isMergeableObject(t[i])?r[i]=function(e,t){if(!t.customMerge)return s;var a=t.customMerge(e);return"function"==typeof a?a:s}(i,a)(e[i],t[i],a):r[i]=n(t[i],a))})),r}(e,a,l):n(a,l)}s.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,a){return s(e,a,t)}),{})};var l=s;e.exports=l},561:function(e,t){!function(e){"use strict";function t(e){for(var t=new Array(e),a=0;a<e;++a)t[a]=0;return t}function a(e,t){for(var a=0,n=0;n<e.length;++n)a+=e[n]*t[n];return a}function n(e){return Math.sqrt(a(e,e))}function r(e,t,a){for(var n=0;n<t.length;++n)e[n]=t[n]*a}function i(e,t,a,n,r){for(var i=0;i<e.length;++i)e[i]=t*a[i]+n*r[i]}function o(e,t,n,r,o,s,l){var c=n.fx,u=a(n.fxprime,t),d=c,m=c,p=u,h=0;function g(m,h,g){for(var f=0;f<16;++f)if(o=(m+h)/2,i(r.x,1,n.x,o,t),d=r.fx=e(r.x,r.fxprime),p=a(r.fxprime,t),d>c+s*o*u||d>=g)h=o;else{if(Math.abs(p)<=-l*u)return o;p*(h-m)>=0&&(h=m),m=o,g=d}return 0}o=o||1,s=s||1e-6,l=l||.1;for(var f=0;f<10;++f){if(i(r.x,1,n.x,o,t),d=r.fx=e(r.x,r.fxprime),p=a(r.fxprime,t),d>c+s*o*u||f&&d>=m)return g(h,o,m);if(Math.abs(p)<=-l*u)return o;if(p>=0)return g(o,h,d);m=d,h=o,o*=2}return o}e.bisect=function(e,t,a,n){var r=(n=n||{}).maxIterations||100,i=n.tolerance||1e-10,o=e(t),s=e(a),l=a-t;if(o*s>0)throw"Initial bisect points must have opposite signs";if(0===o)return t;if(0===s)return a;for(var c=0;c<r;++c){var u=t+(l/=2),d=e(u);if(d*o>=0&&(t=u),Math.abs(l)<i||0===d)return u}return t+l},e.nelderMead=function(e,t,a){var n,r=(a=a||{}).maxIterations||200*t.length,o=a.nonZeroDelta||1.05,s=a.zeroDelta||.001,l=a.minErrorDelta||1e-6,c=a.minErrorDelta||1e-5,u=void 0!==a.rho?a.rho:1,d=void 0!==a.chi?a.chi:2,m=void 0!==a.psi?a.psi:-.5,p=void 0!==a.sigma?a.sigma:.5,h=t.length,g=new Array(h+1);g[0]=t,g[0].fx=e(t),g[0].id=0;for(var f=0;f<h;++f){var y=t.slice();y[f]=y[f]?y[f]*o:s,g[f+1]=y,g[f+1].fx=e(y),g[f+1].id=f+1}function v(e){for(var t=0;t<e.length;t++)g[h][t]=e[t];g[h].fx=e.fx}for(var b=function(e,t){return e.fx-t.fx},S=t.slice(),E=t.slice(),_=t.slice(),T=t.slice(),O=0;O<r;++O){if(g.sort(b),a.history){var $=g.map((function(e){var t=e.slice();return t.fx=e.fx,t.id=e.id,t}));$.sort((function(e,t){return e.id-t.id})),a.history.push({x:g[0].slice(),fx:g[0].fx,simplex:$})}for(n=0,f=0;f<h;++f)n=Math.max(n,Math.abs(g[0][f]-g[1][f]));if(Math.abs(g[0].fx-g[h].fx)<l&&n<c)break;for(f=0;f<h;++f){S[f]=0;for(var x=0;x<h;++x)S[f]+=g[x][f];S[f]/=h}var I=g[h];if(i(E,1+u,S,-u,I),E.fx=e(E),E.fx<g[0].fx)i(T,1+d,S,-d,I),T.fx=e(T),T.fx<E.fx?v(T):v(E);else if(E.fx>=g[h-1].fx){var L=!1;if(E.fx>I.fx?(i(_,1+m,S,-m,I),_.fx=e(_),_.fx<I.fx?v(_):L=!0):(i(_,1-m*u,S,m*u,I),_.fx=e(_),_.fx<E.fx?v(_):L=!0),L){if(p>=1)break;for(f=1;f<g.length;++f)i(g[f],1-p,g[0],p,g[f]),g[f].fx=e(g[f])}}else v(E)}return g.sort(b),{fx:g[0].fx,x:g[0]}},e.conjugateGradient=function(e,t,s){var l,c,u,d={x:t.slice(),fx:0,fxprime:t.slice()},m={x:t.slice(),fx:0,fxprime:t.slice()},p=t.slice(),h=1;u=(s=s||{}).maxIterations||20*t.length,d.fx=e(d.x,d.fxprime),r(l=d.fxprime.slice(),d.fxprime,-1);for(var g=0;g<u;++g){if(h=o(e,l,d,m,h),s.history&&s.history.push({x:d.x.slice(),fx:d.fx,fxprime:d.fxprime.slice(),alpha:h}),h){i(p,1,m.fxprime,-1,d.fxprime);var f=a(d.fxprime,d.fxprime);i(l,Math.max(0,a(p,m.fxprime)/f),l,-1,m.fxprime),c=d,d=m,m=c}else r(l,d.fxprime,-1);if(n(d.fxprime)<=1e-5)break}return s.history&&s.history.push({x:d.x.slice(),fx:d.fx,fxprime:d.fxprime.slice(),alpha:h}),d},e.gradientDescent=function(e,t,a){for(var r=(a=a||{}).maxIterations||100*t.length,o=a.learnRate||.001,s={x:t.slice(),fx:0,fxprime:t.slice()},l=0;l<r&&(s.fx=e(s.x,s.fxprime),a.history&&a.history.push({x:s.x.slice(),fx:s.fx,fxprime:s.fxprime.slice()}),i(s.x,1,s.x,-o,s.fxprime),!(n(s.fxprime)<=1e-5));++l);return s},e.gradientDescentLineSearch=function(e,t,a){a=a||{};var i,s={x:t.slice(),fx:0,fxprime:t.slice()},l={x:t.slice(),fx:0,fxprime:t.slice()},c=a.maxIterations||100*t.length,u=a.learnRate||1,d=t.slice(),m=a.c1||.001,p=a.c2||.1,h=[];if(a.history){var g=e;e=function(e,t){return h.push(e.slice()),g(e,t)}}s.fx=e(s.x,s.fxprime);for(var f=0;f<c&&(r(d,s.fxprime,-1),u=o(e,d,s,l,u,m,p),a.history&&(a.history.push({x:s.x.slice(),fx:s.fx,fxprime:s.fxprime.slice(),functionCalls:h,learnRate:u,alpha:u}),h=[]),i=s,s=l,l=i,!(0===u||n(s.fxprime)<1e-5));++f);return s},e.zeros=t,e.zerosM=function(e,a){return t(e).map((function(){return t(a)}))},e.norm2=n,e.weightedSum=i,e.scale=r}(t)},542:function(e){e.exports=(()=>{"use strict";var e={d:(t,a)=>{for(var n in a)e.o(a,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:a[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{getLocale:()=>r,numberLocales:()=>a,timeLocales:()=>n});const a={"ar-AE":JSON.parse('{"decimal":"٫","thousands":"٬","grouping":[3],"currency":[""," د.إ."],"numerals":["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"]}'),"ar-BH":JSON.parse('{"decimal":"٫","thousands":"٬","grouping":[3],"currency":[""," د.ب."],"numerals":["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"]}'),"ar-DJ":JSON.parse('{"decimal":"٫","thousands":"٬","grouping":[3],"currency":["‏Fdj ",""],"numerals":["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"]}'),"ar-DZ":JSON.parse('{"decimal":",","thousands":".","grouping":[3],"currency":["د.ج. ",""]}'),"ar-EG":JSON.parse('{"decimal":"٫","thousands":"٬","grouping":[3],"currency":[""," ج.م."],"numerals":["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"]}'),"ar-IL":JSON.parse('{"decimal":"٫","thousands":"٬","grouping":[3],"currency":["₪ ",""],"numerals":["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"]}'),"ar-IQ":JSON.parse('{"decimal":"٫","thousands":"٬","grouping":[3],"currency":[""," د.ع."],"numerals":["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"]}'),"ar-JO":JSON.parse('{"decimal":"٫","thousands":"٬","grouping":[3],"currency":[""," د.أ."],"numerals":["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"]}'),"ar-KM":JSON.parse('{"decimal":"٫","thousands":"٬","grouping":[3],"currency":[""," ف.ج.ق."],"numerals":["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"]}'),"ar-KW":JSON.parse('{"decimal":"٫","thousands":"٬","grouping":[3],"currency":[""," د.ك."],"numerals":["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"]}'),"ar-LB":JSON.parse('{"decimal":"٫","thousands":"٬","grouping":[3],"currency":[""," ل.ل."],"numerals":["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"]}'),"ar-LY":JSON.parse('{"decimal":",","thousands":".","grouping":[3],"currency":["د.ل. ",""]}'),"ar-MA":JSON.parse('{"decimal":",","thousands":".","grouping":[3],"currency":["د.م. ",""]}'),"ar-OM":JSON.parse('{"decimal":"٫","thousands":"٬","grouping":[3],"currency":[""," ر.ع."],"numerals":["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"]}'),"ar-PS":JSON.parse('{"decimal":"٫","thousands":"٬","grouping":[3],"currency":["₪ ",""],"numerals":["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"]}'),"ar-QA":JSON.parse('{"decimal":"٫","thousands":"٬","grouping":[3],"currency":[""," ر.ق."],"numerals":["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"]}'),"ar-SA":JSON.parse('{"decimal":"٫","thousands":"٬","grouping":[3],"currency":[""," ر.س."],"numerals":["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"]}'),"ar-SD":JSON.parse('{"decimal":"٫","thousands":"٬","grouping":[3],"currency":[""," ج.س."],"numerals":["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"]}'),"ar-SO":JSON.parse('{"decimal":"٫","thousands":"٬","grouping":[3],"currency":["‏S ",""],"numerals":["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"]}'),"ar-SS":JSON.parse('{"decimal":"٫","thousands":"٬","grouping":[3],"currency":["£ ",""],"numerals":["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"]}'),"ar-SY":JSON.parse('{"decimal":"٫","thousands":"٬","grouping":[3],"currency":[""," ل.س."],"numerals":["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"]}'),"ar-TD":JSON.parse('{"decimal":"٫","thousands":"٬","grouping":[3],"currency":["‏FCFA ",""],"numerals":["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"]}'),"ar-TN":JSON.parse('{"decimal":",","thousands":".","grouping":[3],"currency":["د.ت. ",""]}'),"ar-YE":JSON.parse('{"decimal":"٫","thousands":"٬","grouping":[3],"currency":[""," ر.ى."],"numerals":["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"]}'),"ca-ES":JSON.parse('{"decimal":",","thousands":".","grouping":[3],"currency":[""," €"]}'),"cs-CZ":JSON.parse('{"decimal":",","thousands":" ","grouping":[3],"currency":[""," Kč"]}'),"da-DK":JSON.parse('{"decimal":",","thousands":".","grouping":[3],"currency":[""," kr"]}'),"de-CH":JSON.parse('{"decimal":",","thousands":"\'","grouping":[3],"currency":[""," CHF"]}'),"de-DE":JSON.parse('{"decimal":",","thousands":".","grouping":[3],"currency":[""," €"]}'),"en-CA":JSON.parse('{"decimal":".","thousands":",","grouping":[3],"currency":["$",""]}'),"en-GB":JSON.parse('{"decimal":".","thousands":",","grouping":[3],"currency":["£",""]}'),"en-IE":JSON.parse('{"decimal":".","thousands":",","grouping":[3],"currency":["€",""]}'),"en-IN":JSON.parse('{"decimal":".","thousands":",","grouping":[3,2,2,2,2,2,2,2,2,2],"currency":["₹",""]}'),"en-US":JSON.parse('{"decimal":".","thousands":",","grouping":[3],"currency":["$",""]}'),"es-BO":JSON.parse('{"decimal":",","thousands":".","grouping":[3],"currency":["Bs ",""],"percent":" %"}'),"es-ES":JSON.parse('{"decimal":",","thousands":".","grouping":[3],"currency":[""," €"]}'),"es-MX":JSON.parse('{"decimal":".","thousands":",","grouping":[3],"currency":["$",""]}'),"fi-FI":JSON.parse('{"decimal":",","thousands":" ","grouping":[3],"currency":[""," €"]}'),"fr-CA":JSON.parse('{"decimal":",","thousands":" ","grouping":[3],"currency":["","$"]}'),"fr-FR":JSON.parse('{"decimal":",","thousands":" ","grouping":[3],"currency":[""," €"],"percent":" %"}'),"he-IL":JSON.parse('{"decimal":".","thousands":",","grouping":[3],"currency":["₪",""]}'),"hu-HU":JSON.parse('{"decimal":",","thousands":" ","grouping":[3],"currency":[""," Ft"]}'),"it-IT":JSON.parse('{"decimal":",","thousands":".","grouping":[3],"currency":["€",""]}'),"ja-JP":JSON.parse('{"decimal":".","thousands":",","grouping":[3],"currency":["","円"]}'),"ko-KR":JSON.parse('{"decimal":".","thousands":",","grouping":[3],"currency":["₩",""]}'),"mk-MK":JSON.parse('{"decimal":",","thousands":".","grouping":[3],"currency":[""," ден."]}'),"nl-NL":JSON.parse('{"decimal":",","thousands":".","grouping":[3],"currency":["€ ",""]}'),"pl-PL":JSON.parse('{"decimal":",","thousands":".","grouping":[3],"currency":["","zł"]}'),"pt-BR":JSON.parse('{"decimal":",","thousands":".","grouping":[3],"currency":["R$",""]}'),"pt-PT":JSON.parse('{"decimal":",","thousands":" ","grouping":[3],"currency":[""," €"]}'),"ru-RU":JSON.parse('{"decimal":",","thousands":" ","grouping":[3],"currency":[""," ₽"]}'),"sl-SI":JSON.parse('{"decimal":",","thousands":".","grouping":[3],"currency":[""," €"]}'),"sv-SE":JSON.parse('{"decimal":",","thousands":" ","grouping":[3],"currency":[""," kr"]}'),"uk-UA":JSON.parse('{"decimal":",","thousands":" ","grouping":[3],"currency":[""," ₴."]}'),"zh-CN":JSON.parse('{"decimal":".","thousands":",","grouping":[3],"currency":["¥",""]}')},n={"ar-EG":JSON.parse('{"dateTime":"%x, %X","date":"%-d/%-m/%Y","time":"%-I:%M:%S %p","periods":["ص","م"],"days":["الأحد","الإثنين","الثلاثاء","الأربعاء","الخميس","الجمعة","السبت"],"shortDays":["أحد","إثنين","ثلاثاء","أربعاء","خميس","جمعة","سبت"],"months":["يناير","فبراير","مارس","أبريل","مايو","يونيو","يوليو","أغسطس","سبتمبر","أكتوبر","نوفمبر","ديسمبر"],"shortMonths":["يناير","فبراير","مارس","أبريل","مايو","يونيو","يوليو","أغسطس","سبتمبر","أكتوبر","نوفمبر","ديسمبر"]}'),"ar-SY":JSON.parse('{"dateTime":"%x, %X","date":"%-d/%-m/%Y","time":"%-I:%M:%S %p","periods":["ص","م"],"days":["الأحد","الإثنين","الثلاثاء","الأربعاء","الخميس","الجمعة","السبت"],"shortDays":["أحد","إثنين","ثلاثاء","أربعاء","خميس","جمعة","سبت"],"months":["كانون الثاني","شباط","آذار","نيسان","أيار","حزيران","تموز","آب","أيلول","تشرين الأول","تشرين الثاني","كانون الأول"],"shortMonths":["ك٢","شباط","آذار","نيسان","أيار","حزيران","تموز","آب","أيلول","ت١","ت٢","ك١"]}'),"ca-ES":JSON.parse('{"dateTime":"%A, %e de %B de %Y, %X","date":"%d/%m/%Y","time":"%H:%M:%S","periods":["AM","PM"],"days":["diumenge","dilluns","dimarts","dimecres","dijous","divendres","dissabte"],"shortDays":["dg.","dl.","dt.","dc.","dj.","dv.","ds."],"months":["gener","febrer","març","abril","maig","juny","juliol","agost","setembre","octubre","novembre","desembre"],"shortMonths":["gen.","febr.","març","abr.","maig","juny","jul.","ag.","set.","oct.","nov.","des."]}'),"cs-CZ":JSON.parse('{"dateTime":"%A,%e.%B %Y, %X","date":"%-d.%-m.%Y","time":"%H:%M:%S","periods":["AM","PM"],"days":["neděle","pondělí","úterý","středa","čvrtek","pátek","sobota"],"shortDays":["ne.","po.","út.","st.","čt.","pá.","so."],"months":["leden","únor","březen","duben","květen","červen","červenec","srpen","září","říjen","listopad","prosinec"],"shortMonths":["led","úno","břez","dub","kvě","čer","červ","srp","zář","říj","list","pros"]}'),"da-DK":JSON.parse('{"dateTime":"%A den %d %B %Y %X","date":"%d-%m-%Y","time":"%H:%M:%S","periods":["AM","PM"],"days":["søndag","mandag","tirsdag","onsdag","torsdag","fredag","lørdag"],"shortDays":["søn","man","tir","ons","tor","fre","lør"],"months":["januar","februar","marts","april","maj","juni","juli","august","september","oktober","november","december"],"shortMonths":["jan","feb","mar","apr","maj","jun","jul","aug","sep","okt","nov","dec"]}'),"de-CH":JSON.parse('{"dateTime":"%A, der %e. %B %Y, %X","date":"%d.%m.%Y","time":"%H:%M:%S","periods":["AM","PM"],"days":["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],"shortDays":["So","Mo","Di","Mi","Do","Fr","Sa"],"months":["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],"shortMonths":["Jan","Feb","Mrz","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"]}'),"de-DE":JSON.parse('{"dateTime":"%A, der %e. %B %Y, %X","date":"%d.%m.%Y","time":"%H:%M:%S","periods":["AM","PM"],"days":["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],"shortDays":["So","Mo","Di","Mi","Do","Fr","Sa"],"months":["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],"shortMonths":["Jan","Feb","Mrz","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"]}'),"en-CA":JSON.parse('{"dateTime":"%a %b %e %X %Y","date":"%Y-%m-%d","time":"%H:%M:%S","periods":["AM","PM"],"days":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"shortDays":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"months":["January","February","March","April","May","June","July","August","September","October","November","December"],"shortMonths":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}'),"en-GB":JSON.parse('{"dateTime":"%a %e %b %X %Y","date":"%d/%m/%Y","time":"%H:%M:%S","periods":["AM","PM"],"days":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"shortDays":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"months":["January","February","March","April","May","June","July","August","September","October","November","December"],"shortMonths":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}'),"en-US":JSON.parse('{"dateTime":"%x, %X","date":"%-m/%-d/%Y","time":"%-I:%M:%S %p","periods":["AM","PM"],"days":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"shortDays":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"months":["January","February","March","April","May","June","July","August","September","October","November","December"],"shortMonths":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}'),"es-ES":JSON.parse('{"dateTime":"%A, %e de %B de %Y, %X","date":"%d/%m/%Y","time":"%H:%M:%S","periods":["AM","PM"],"days":["domingo","lunes","martes","miércoles","jueves","viernes","sábado"],"shortDays":["dom","lun","mar","mié","jue","vie","sáb"],"months":["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"],"shortMonths":["ene","feb","mar","abr","may","jun","jul","ago","sep","oct","nov","dic"]}'),"es-MX":JSON.parse('{"dateTime":"%x, %X","date":"%d/%m/%Y","time":"%-I:%M:%S %p","periods":["AM","PM"],"days":["domingo","lunes","martes","miércoles","jueves","viernes","sábado"],"shortDays":["dom","lun","mar","mié","jue","vie","sáb"],"months":["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"],"shortMonths":["ene","feb","mar","abr","may","jun","jul","ago","sep","oct","nov","dic"]}'),"fa-IR":JSON.parse('{"dateTime":"%x, %X","date":"%-d/%-m/%Y","time":"%-I:%M:%S %p","periods":["صبح","عصر"],"days":["یکشنبه","دوشنبه","سه شنبه","چهارشنبه","پنجشنبه","جمعه","شنبه"],"shortDays":["یکشنبه","دوشنبه","سه شنبه","چهارشنبه","پنجشنبه","جمعه","شنبه"],"months":["ژانویه","فوریه","مارس","آوریل","مه","ژوئن","ژوئیه","اوت","سپتامبر","اکتبر","نوامبر","دسامبر"],"shortMonths":["ژانویه","فوریه","مارس","آوریل","مه","ژوئن","ژوئیه","اوت","سپتامبر","اکتبر","نوامبر","دسامبر"]}'),"fi-FI":JSON.parse('{"dateTime":"%A, %-d. %Bta %Y klo %X","date":"%-d.%-m.%Y","time":"%H:%M:%S","periods":["a.m.","p.m."],"days":["sunnuntai","maanantai","tiistai","keskiviikko","torstai","perjantai","lauantai"],"shortDays":["Su","Ma","Ti","Ke","To","Pe","La"],"months":["tammikuu","helmikuu","maaliskuu","huhtikuu","toukokuu","kesäkuu","heinäkuu","elokuu","syyskuu","lokakuu","marraskuu","joulukuu"],"shortMonths":["Tammi","Helmi","Maalis","Huhti","Touko","Kesä","Heinä","Elo","Syys","Loka","Marras","Joulu"]}'),"fr-CA":JSON.parse('{"dateTime":"%a %e %b %Y %X","date":"%Y-%m-%d","time":"%H:%M:%S","periods":["",""],"days":["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],"shortDays":["dim","lun","mar","mer","jeu","ven","sam"],"months":["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"],"shortMonths":["jan","fév","mar","avr","mai","jui","jul","aoû","sep","oct","nov","déc"]}'),"fr-FR":JSON.parse('{"dateTime":"%A %e %B %Y à %X","date":"%d/%m/%Y","time":"%H:%M:%S","periods":["AM","PM"],"days":["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],"shortDays":["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],"months":["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"],"shortMonths":["janv.","févr.","mars","avr.","mai","juin","juil.","août","sept.","oct.","nov.","déc."]}'),"he-IL":JSON.parse('{"dateTime":"%A, %e ב%B %Y %X","date":"%d.%m.%Y","time":"%H:%M:%S","periods":["AM","PM"],"days":["ראשון","שני","שלישי","רביעי","חמישי","שישי","שבת"],"shortDays":["א׳","ב׳","ג׳","ד׳","ה׳","ו׳","ש׳"],"months":["ינואר","פברואר","מרץ","אפריל","מאי","יוני","יולי","אוגוסט","ספטמבר","אוקטובר","נובמבר","דצמבר"],"shortMonths":["ינו׳","פבר׳","מרץ","אפר׳","מאי","יוני","יולי","אוג׳","ספט׳","אוק׳","נוב׳","דצמ׳"]}'),"hr-HR":JSON.parse('{"dateTime":"%A, %e. %B %Y., %X","date":"%d. %m. %Y.","time":"%H:%M:%S","periods":["AM","PM"],"days":["Nedjelja","Ponedjeljak","Utorak","Srijeda","Četvtrak","Petak","Subota"],"shortDays":["Ne","Po","Ut","Sr","Če","Pe","Su"],"months":["Siječanj","Veljača","Ožujak","Travanj","Svibanj","Lipanj","Srpanj","Kolovoz","Rujan","Listopad","Studeni","Prosinac"],"shortMonths":["Sij","Velj","Ožu","Tra","Svi","Lip","Srp","Kol","Ruj","Lis","Stu","Pro"]}'),"hu-HU":JSON.parse('{"dateTime":"%Y. %B %-e., %A %X","date":"%Y. %m. %d.","time":"%H:%M:%S","periods":["de.","du."],"days":["vasárnap","hétfő","kedd","szerda","csütörtök","péntek","szombat"],"shortDays":["V","H","K","Sze","Cs","P","Szo"],"months":["január","február","március","április","május","június","július","augusztus","szeptember","október","november","december"],"shortMonths":["jan.","feb.","már.","ápr.","máj.","jún.","júl.","aug.","szept.","okt.","nov.","dec."]}'),"it-IT":JSON.parse('{"dateTime":"%A %e %B %Y, %X","date":"%d/%m/%Y","time":"%H:%M:%S","periods":["AM","PM"],"days":["Domenica","Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato"],"shortDays":["Dom","Lun","Mar","Mer","Gio","Ven","Sab"],"months":["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"],"shortMonths":["Gen","Feb","Mar","Apr","Mag","Giu","Lug","Ago","Set","Ott","Nov","Dic"]}'),"ja-JP":JSON.parse('{"dateTime":"%x %a %X","date":"%Y/%m/%d","time":"%H:%M:%S","periods":["AM","PM"],"days":["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"],"shortDays":["日","月","火","水","木","金","土"],"months":["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],"shortMonths":["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"]}'),"ko-KR":JSON.parse('{"dateTime":"%Y/%m/%d %a %X","date":"%Y/%m/%d","time":"%H:%M:%S","periods":["오전","오후"],"days":["일요일","월요일","화요일","수요일","목요일","금요일","토요일"],"shortDays":["일","월","화","수","목","금","토"],"months":["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],"shortMonths":["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"]}'),"mk-MK":JSON.parse('{"dateTime":"%A, %e %B %Y г. %X","date":"%d.%m.%Y","time":"%H:%M:%S","periods":["AM","PM"],"days":["недела","понеделник","вторник","среда","четврток","петок","сабота"],"shortDays":["нед","пон","вто","сре","чет","пет","саб"],"months":["јануари","февруари","март","април","мај","јуни","јули","август","септември","октомври","ноември","декември"],"shortMonths":["јан","фев","мар","апр","мај","јун","јул","авг","сеп","окт","ное","дек"]}'),"nb-NO":JSON.parse('{"dateTime":"%A den %d. %B %Y %X","date":"%d.%m.%Y","time":"%H:%M:%S","periods":["AM","PM"],"days":["søndag","mandag","tirsdag","onsdag","torsdag","fredag","lørdag"],"shortDays":["søn","man","tir","ons","tor","fre","lør"],"months":["januar","februar","mars","april","mai","juni","juli","august","september","oktober","november","desember"],"shortMonths":["jan","feb","mars","apr","mai","juni","juli","aug","sep","okt","nov","des"]}'),"nl-BE":JSON.parse('{"dateTime":"%a %e %B %Y %X","date":"%d/%m/%Y","time":"%H:%M:%S","periods":["AM","PM"],"days":["zondag","maandag","dinsdag","woensdag","donderdag","vrijdag","zaterdag"],"shortDays":["zo","ma","di","wo","do","vr","za"],"months":["januari","februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december"],"shortMonths":["jan","feb","mrt","apr","mei","jun","jul","aug","sep","okt","nov","dec"]}'),"nl-NL":JSON.parse('{"dateTime":"%a %e %B %Y %X","date":"%d-%m-%Y","time":"%H:%M:%S","periods":["AM","PM"],"days":["zondag","maandag","dinsdag","woensdag","donderdag","vrijdag","zaterdag"],"shortDays":["zo","ma","di","wo","do","vr","za"],"months":["januari","februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december"],"shortMonths":["jan","feb","mrt","apr","mei","jun","jul","aug","sep","okt","nov","dec"]}'),"pl-PL":JSON.parse('{"dateTime":"%A, %e %B %Y, %X","date":"%d/%m/%Y","time":"%H:%M:%S","periods":["AM","PM"],"days":["Niedziela","Poniedziałek","Wtorek","Środa","Czwartek","Piątek","Sobota"],"shortDays":["Niedz.","Pon.","Wt.","Śr.","Czw.","Pt.","Sob."],"months":["Styczeń","Luty","Marzec","Kwiecień","Maj","Czerwiec","Lipiec","Sierpień","Wrzesień","Październik","Listopad","Grudzień"],"shortMonths":["Stycz.","Luty","Marz.","Kwie.","Maj","Czerw.","Lipc.","Sierp.","Wrz.","Paźdz.","Listop.","Grudz."]}'),"pt-BR":JSON.parse('{"dateTime":"%A, %e de %B de %Y. %X","date":"%d/%m/%Y","time":"%H:%M:%S","periods":["AM","PM"],"days":["Domingo","Segunda","Terça","Quarta","Quinta","Sexta","Sábado"],"shortDays":["Dom","Seg","Ter","Qua","Qui","Sex","Sáb"],"months":["Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"],"shortMonths":["Jan","Fev","Mar","Abr","Mai","Jun","Jul","Ago","Set","Out","Nov","Dez"]}'),"ru-RU":JSON.parse('{"dateTime":"%A, %e %B %Y г. %X","date":"%d.%m.%Y","time":"%H:%M:%S","periods":["AM","PM"],"days":["воскресенье","понедельник","вторник","среда","четверг","пятница","суббота"],"shortDays":["вс","пн","вт","ср","чт","пт","сб"],"months":["января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"],"shortMonths":["янв","фев","мар","апр","май","июн","июл","авг","сен","окт","ноя","дек"]}'),"sv-SE":JSON.parse('{"dateTime":"%A den %d %B %Y %X","date":"%Y-%m-%d","time":"%H:%M:%S","periods":["fm","em"],"days":["Söndag","Måndag","Tisdag","Onsdag","Torsdag","Fredag","Lördag"],"shortDays":["Sön","Mån","Tis","Ons","Tor","Fre","Lör"],"months":["Januari","Februari","Mars","April","Maj","Juni","Juli","Augusti","September","Oktober","November","December"],"shortMonths":["Jan","Feb","Mar","Apr","Maj","Jun","Jul","Aug","Sep","Okt","Nov","Dec"]}'),"tr-TR":JSON.parse('{"dateTime":"%a %e %b %X %Y","date":"%d/%m/%Y","time":"%H:%M:%S","periods":["AM","PM"],"days":["Pazar","Pazartesi","Salı","Çarşamba","Perşembe","Cuma","Cumartesi"],"shortDays":["Paz","Pzt","Sal","Çar","Per","Cum","Cmt"],"months":["Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eylül","Ekim","Kasım","Aralık"],"shortMonths":["Oca","Şub","Mar","Nis","May","Haz","Tem","Ağu","Eyl","Eki","Kas","Ara"]}'),"uk-UA":JSON.parse('{"dateTime":"%A, %e %B %Y р. %X","date":"%d.%m.%Y","time":"%H:%M:%S","periods":["дп","пп"],"days":["неділя","понеділок","вівторок","середа","четвер","п\'ятниця","субота"],"shortDays":["нд","пн","вт","ср","чт","пт","сб"],"months":["січня","лютого","березня","квітня","травня","червня","липня","серпня","вересня","жовтня","листопада","грудня"],"shortMonths":["січ.","лют.","бер.","квіт.","трав.","черв.","лип.","серп.","вер.","жовт.","лист.","груд."]}'),"zh-CN":JSON.parse('{"dateTime":"%x %A %X","date":"%Y年%-m月%-d日","time":"%H:%M:%S","periods":["上午","下午"],"days":["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],"shortDays":["周日","周一","周二","周三","周四","周五","周六"],"months":["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],"shortMonths":["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]}'),"zh-TW":JSON.parse('{"dateTime":"%x %A %X","date":"%Y年%-m月%-d日","time":"%H:%M:%S","periods":["上午","下午"],"days":["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],"shortDays":["日","一","二","三","四","五","六"],"months":["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],"shortMonths":["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"]}')},r=(e="en-US")=>{var t,r;return"string"==typeof e?{number:null!==(t=a[e])&&void 0!==t?t:a["en-US"],time:null!==(r=n[e])&&void 0!==r?r:n["en-US"]}:{number:i(e.number),time:o(e.time)}},i=e=>{var t;return"string"==typeof e?null!==(t=a[e])&&void 0!==t?t:a["en-US"]:e},o=e=>{var t;return"string"==typeof e?null!==(t=n[e])&&void 0!==t?t:n["en-US"]:e};return t})()},633:t=>{"use strict";t.exports=e},274:e=>{"use strict";e.exports=t},365:e=>{"use strict";e.exports=a}},r={};function i(e){var t=r[e];if(void 0!==t)return t.exports;var a=r[e]={exports:{}};return n[e].call(a.exports,a,a.exports,i),a.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var a in t)i.o(t,a)&&!i.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{"use strict";i.r(o),i.d(o,{addData:()=>os,baseData:()=>ce,buildSpec:()=>zo,expressionFunctions:()=>js,formatHorizontalTimeAxisLabels:()=>As,formatLocaleCurrency:()=>Ls,formatShortNumber:()=>Is,formatTimeDurationLabels:()=>Rs,formatVerticalAxisTimeLabels:()=>Ds,getChartConfig:()=>he,getColorScale:()=>Xo,getD3FormatSpecifierFromNumberFormat:()=>pe,getDefaultSignals:()=>Vo,getDimensionField:()=>me,getExpressionFunctions:()=>xs,getFacetsFromOptions:()=>te,getFacetsFromScales:()=>ae,getLineTypeScale:()=>Zo,getLineWidthPixelsFromLineWidth:()=>re,getLineWidthScale:()=>as,getLinearColorScale:()=>qo,getOpacityScale:()=>ns,getPathFromIcon:()=>oe,getPathFromSymbolShape:()=>ie,getStrokeDashFromLineType:()=>ne,getSymbolPathWidthScale:()=>ts,getSymbolShapeScale:()=>Qo,getSymbolSizeScale:()=>es,getSymbolWidthFromRscSymbolSize:()=>le,getTwoDimensionalColorScheme:()=>Wo,getTwoDimensionalLineTypes:()=>Jo,getTwoDimensionalOpacities:()=>Yo,getVegaEmbedOptions:()=>ks,getVegaSymbolSizeFromRscSymbolSize:()=>se,initializeSpec:()=>ue,isColorScale:()=>ss,isColors:()=>ls,isLineTypeArray:()=>cs,isNumberArray:()=>ds,isStrokeDashArray:()=>us,isSymbolShapeArray:()=>ms,mergeValuesIntoData:()=>de,removeUnusedScales:()=>Bo});var e=Symbol.for("immer-nothing"),t=Symbol.for("immer-draftable"),a=Symbol.for("immer-state");function n(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var r=Object.getPrototypeOf;function s(e){return!!e&&!!e[a]}function l(e){return!!e&&(u(e)||Array.isArray(e)||!!e[t]||!!e.constructor?.[t]||g(e)||f(e))}var c=Object.prototype.constructor.toString();function u(e){if(!e||"object"!=typeof e)return!1;const t=r(e);if(null===t)return!0;const a=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return a===Object||"function"==typeof a&&Function.toString.call(a)===c}function d(e,t){0===m(e)?Reflect.ownKeys(e).forEach((a=>{t(a,e[a],e)})):e.forEach(((a,n)=>t(n,a,e)))}function m(e){const t=e[a];return t?t.type_:Array.isArray(e)?1:g(e)?2:f(e)?3:0}function p(e,t){return 2===m(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function h(e,t,a){const n=m(e);2===n?e.set(t,a):3===n?e.add(a):e[t]=a}function g(e){return e instanceof Map}function f(e){return e instanceof Set}function y(e){return e.copy_||e.base_}function v(e,t){if(g(e))return new Map(e);if(f(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=u(e);if(!0===t||"class_only"===t&&!n){const t=Object.getOwnPropertyDescriptors(e);delete t[a];let n=Reflect.ownKeys(t);for(let a=0;a<n.length;a++){const r=n[a],i=t[r];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(t[r]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[r]})}return Object.create(r(e),t)}{const t=r(e);if(null!==t&&n)return{...e};const a=Object.create(t);return Object.assign(a,e)}}function b(e,t=!1){return E(e)||s(e)||!l(e)||(m(e)>1&&(e.set=e.add=e.clear=e.delete=S),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>b(t,!0)))),e}function S(){n(2)}function E(e){return Object.isFrozen(e)}var _,T={};function O(e){const t=T[e];return t||n(0),t}function $(){return _}function x(e,t){t&&(O("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function I(e){L(e),e.drafts_.forEach(D),e.drafts_=null}function L(e){e===_&&(_=e.parent_)}function A(e){return _={drafts_:[],parent_:_,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function D(e){const t=e[a];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function R(t,r){r.unfinalizedDrafts_=r.drafts_.length;const i=r.drafts_[0];return void 0!==t&&t!==i?(i[a].modified_&&(I(r),n(4)),l(t)&&(t=M(r,t),r.parent_||N(r,t)),r.patches_&&O("Patches").generateReplacementPatches_(i[a].base_,t,r.patches_,r.inversePatches_)):t=M(r,i,[]),I(r),r.patches_&&r.patchListener_(r.patches_,r.inversePatches_),t!==e?t:void 0}function M(e,t,n){if(E(t))return t;const r=t[a];if(!r)return d(t,((a,i)=>C(e,r,t,a,i,n))),t;if(r.scope_!==e)return t;if(!r.modified_)return N(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const t=r.copy_;let a=t,i=!1;3===r.type_&&(a=new Set(t),t.clear(),i=!0),d(a,((a,o)=>C(e,r,t,a,o,n,i))),N(e,t,!1),n&&e.patches_&&O("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function C(e,t,a,n,r,i,o){if(s(r)){const o=M(e,r,i&&t&&3!==t.type_&&!p(t.assigned_,n)?i.concat(n):void 0);if(h(a,n,o),!s(o))return;e.canAutoFreeze_=!1}else o&&a.add(r);if(l(r)&&!E(r)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;M(e,r),t&&t.scope_.parent_||"symbol"==typeof n||!Object.prototype.propertyIsEnumerable.call(a,n)||N(e,r)}}function N(e,t,a=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&b(t,a)}var j={get(e,t){if(t===a)return e;const n=y(e);if(!p(n,t))return function(e,t,a){const n=H(t,a);return n?"value"in n?n.value:n.get?.call(e.draft_):void 0}(e,n,t);const r=n[t];return e.finalized_||!l(r)?r:r===P(e.base_,t)?(F(e),e.copy_[t]=G(r,e)):r},has:(e,t)=>t in y(e),ownKeys:e=>Reflect.ownKeys(y(e)),set(e,t,n){const r=H(y(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=P(y(e),t),s=r?.[a];if(s&&s.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(((i=n)===(o=r)?0!==i||1/i==1/o:i!=i&&o!=o)&&(void 0!==n||p(e.base_,t)))return!0;F(e),w(e)}var i,o;return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==P(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,F(e),w(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const a=y(e),n=Reflect.getOwnPropertyDescriptor(a,t);return n?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:n.enumerable,value:a[t]}:n},defineProperty(){n(11)},getPrototypeOf:e=>r(e.base_),setPrototypeOf(){n(12)}},k={};function P(e,t){const n=e[a];return(n?y(n):e)[t]}function H(e,t){if(!(t in e))return;let a=r(e);for(;a;){const e=Object.getOwnPropertyDescriptor(a,t);if(e)return e;a=r(a)}}function w(e){e.modified_||(e.modified_=!0,e.parent_&&w(e.parent_))}function F(e){e.copy_||(e.copy_=v(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function G(e,t){const a=g(e)?O("MapSet").proxyMap_(e,t):f(e)?O("MapSet").proxySet_(e,t):function(e,t){const a=Array.isArray(e),n={type_:a?1:0,scope_:t?t.scope_:$(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=n,i=j;a&&(r=[n],i=k);const{revoke:o,proxy:s}=Proxy.revocable(r,i);return n.draft_=s,n.revoke_=o,s}(e,t);return(t?t.scope_:$()).drafts_.push(a),a}function z(e){if(!l(e)||E(e))return e;const t=e[a];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=v(e,t.scope_.immer_.useStrictShallowCopy_)}else n=v(e,!0);return d(n,((e,t)=>{h(n,e,z(t))})),t&&(t.finalized_=!1),n}d(j,((e,t)=>{k[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),k.deleteProperty=function(e,t){return k.set.call(this,e,t,void 0)},k.set=function(e,t,a){return j.set.call(this,e[0],t,a,e[0])};var B=new class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,a,r)=>{if("function"==typeof t&&"function"!=typeof a){const e=a;a=t;const n=this;return function(t=e,...r){return n.produce(t,(e=>a.call(this,e,...r)))}}let i;if("function"!=typeof a&&n(6),void 0!==r&&"function"!=typeof r&&n(7),l(t)){const e=A(this),n=G(t,void 0);let o=!0;try{i=a(n),o=!1}finally{o?I(e):L(e)}return x(e,r),R(i,e)}if(!t||"object"!=typeof t){if(i=a(t),void 0===i&&(i=t),i===e&&(i=void 0),this.autoFreeze_&&b(i,!0),r){const e=[],a=[];O("Patches").generateReplacementPatches_(t,i,e,a),r(e,a)}return i}n(1)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...a)=>this.produceWithPatches(t,(t=>e(t,...a)));let a,n;return[this.produce(e,t,((e,t)=>{a=e,n=t})),a,n]},"boolean"==typeof t?.autoFreeze&&this.setAutoFreeze(t.autoFreeze),"boolean"==typeof t?.useStrictShallowCopy&&this.setUseStrictShallowCopy(t.useStrictShallowCopy)}createDraft(e){var t;l(e)||n(8),s(e)&&(s(t=e)||n(10),e=z(t));const r=A(this),i=G(e,void 0);return i[a].isManual_=!0,L(r),i}finishDraft(e,t){const r=e&&e[a];r&&r.isManual_||n(9);const{scope_:i}=r;return x(i,t),R(void 0,i)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let a;for(a=t.length-1;a>=0;a--){const n=t[a];if(0===n.path.length&&"replace"===n.op){e=n.value;break}}a>-1&&(t=t.slice(a+1));const n=O("Patches").applyPatches_;return s(e)?n(e,t):this.produce(e,(e=>n(e,t)))}},U=B.produce;B.produceWithPatches.bind(B),B.setAutoFreeze.bind(B),B.setUseStrictShallowCopy.bind(B),B.applyPatches.bind(B),B.createDraft.bind(B),B.finishDraft.bind(B);var V=i(633),W=i(274),J=i(365);const Y=U(((e,t)=>{-1===e.findIndex((e=>"timeunit"===e.type))&&(e.push({type:"formula",expr:`toDate(datum["${t}"])`,as:t}),e.push({type:"timeunit",field:t,units:["year","month","date","hours","minutes","seconds"],as:[V.DEFAULT_TRANSFORMED_TIME_DIMENSION,`${V.DEFAULT_TIME_DIMENSION}1`]}))})),K=e=>{if(e)return{field:e}},X=e=>e.find((e=>e.name===V.TABLE)),q=e=>e.find((e=>e.name===V.FILTERED_TABLE)),Z=e=>{if(0===e.length)return[];const t=e.map((e=>`datum.${e}`)).join(' + " | " + ');return[{type:"formula",as:V.SERIES_ID,expr:t}]},Q=e=>{var t;const a=null===(t=e[0])||void 0===t?void 0:t.excludeDataKeys,n=null==a?void 0:a.map((e=>({type:"filter",expr:`!datum.${e}`})));return{name:`${V.FILTERED_TABLE}ForTooltip`,source:V.FILTERED_TABLE,transform:n}},ee=require("vega"),te=({color:e,lineType:t,opacity:a,size:n})=>{let r=[e,t,a,n].map((e=>Array.isArray(e)?e[0]:e)).filter((e=>"string"==typeof e));r=[...new Set(r)];let i=[e,t,a].map((e=>Array.isArray(e)?e[1]:void 0)).filter((e=>"string"==typeof e));return i=[...new Set(i)],{facets:r,secondaryFacets:i}},ae=(e=[])=>{const t=[V.COLOR_SCALE,V.LINE_TYPE_SCALE,V.OPACITY_SCALE,"secondaryColor","secondaryLineType","secondaryOpacity"].reduce(((t,a)=>{const n=e.find((e=>e.name===a));return(null==n?void 0:n.domain)&&"fields"in n.domain&&n.domain.fields.length?[...t,n.domain.fields[0].toString()]:t}),[]);return[...new Set(t)]},ne=e=>{if(Array.isArray(e))return e;switch(e){case"dashed":return[7,4];case"dotted":return[2,3];case"dotDash":return[2,3,7,4];case"shortDash":return[3,4];case"longDash":return[11,4];case"twoDash":return[5,2,11,2];default:return[]}},re=e=>{if("number"==typeof e)return e;switch(e){case"XS":return 1;case"S":return 1.5;case"L":return 3;case"XL":return 4;default:return 2}},ie=e=>"rounded-square"===e?V.ROUNDED_SQUARE_PATH:e,oe=e=>({date:V.DATE_PATH,sentimentNegative:V.SENTIMENT_NEGATIVE_PATH,sentimentNeutral:V.SENTIMENT_NEUTRAL_PATH,sentimentPositive:V.SENTIMENT_POSITIVE_PATH}[e]||e),se=e=>Math.pow(le(e),2),le=e=>{if("number"==typeof e)return e;switch(e){case"XS":return 6;case"S":return 8;case"L":return 12;case"XL":return 16;default:return 10}},ce=[{name:V.TABLE,values:[],transform:[{type:"identifier",as:V.MARK_ID}]},{name:V.FILTERED_TABLE,source:V.TABLE}],ue=(e={},t={})=>{const{backgroundColor:a,colorScheme:n="light",description:r,title:i}=t,o={usermeta:{},title:i||void 0,description:r,data:ce,background:a?(0,W.getColorValue)(a,n):void 0};return Object.assign(Object.assign({},o),e||{})},de=(e,t)=>e.map((e=>{const a=t[e.name];return a&&(e.values=a),e})),me=(e,t)=>"time"===t?V.DEFAULT_TRANSFORMED_TIME_DIMENSION:e,pe=e=>{switch(e){case"currency":return"$,.2f";case"standardNumber":return",";default:return e}};function he(e,t){const a=(0,W.getSpectrumVegaConfig)(t);return e?(0,ee.mergeConfig)(a,e):a}const ge=(e,t,a,n,r)=>{const i=n||(0,J.toCamelCase)(`${a} ${t}`);let o=e.findIndex((e=>e.name===i));return-1===o&&(o=e.length,e.push(_e(t,a,Object.assign({name:i},r?{domain:{data:r,fields:[]}}:{})))),o},fe=(e,t,a)=>{let n=e.findIndex((e=>e.name===t));return-1===n&&(n=e.length,e.push({name:t,type:a})),n},ye=U(((e,t)=>(t.forEach((t=>{Le(e.domain)?e.domain.fields.includes(t)||e.domain.fields.push(t):e.domain={data:V.TABLE,fields:[t]}})),e))),ve=(e,{scaleType:t,dimension:a,padding:n})=>{const r=ge(e,t,"x"),i=[me(a,t)];e[r]=ye(e[r],i),void 0!==n&&(e[r]=be(e[r],n))},be=U(((e,t)=>{"padding"in e&&(e.padding=t),"paddingOuter"in e&&(e.paddingOuter=t)})),Se=(e,t,a="y",n,r)=>{const i=ge(e,"linear",a,n,r);e[i]=ye(e[i],t)},Ee=(e,t,a)=>{if("string"==typeof a||Array.isArray(a)&&a.length){const n=fe(e,t),r=Array.isArray(a)?a[0]:a;e[n]=ye(e[n],[r])}},_e=(e,t,a)=>Object.assign(Object.assign({},Te(e,t)),a),Te=(e,t,a="vertical")=>{const n=t==={vertical:"x",horizontal:"y"}[a],r=Object.assign({name:(0,J.toCamelCase)(`${t} ${e}`),type:e,range:"x"===t?"width":"height",domain:{data:V.FILTERED_TABLE,fields:[]}},n?Oe(e):{});if("ordinal"===r.type){const{name:e,type:t,domain:a}=r;return{name:e,type:t,domain:a}}return"linear"!==r.type||n?r:Object.assign(Object.assign({},r),{nice:!0,zero:!0})},Oe=e=>{switch(e){case"band":{const{paddingInner:e,paddingOuter:t}=$e(V.PADDING_RATIO);return{paddingInner:e,paddingOuter:t}}case"linear":case"time":return{padding:V.LINEAR_PADDING};case"point":return{paddingOuter:V.DISCRETE_PADDING};default:return{}}},$e=(e,t)=>{const a=e;return{paddingInner:a,paddingOuter:void 0===t?V.DISCRETE_PADDING-(1-a)/2:t}},xe=(e,t)=>(0,J.toCamelCase)(`${e} ${t}`),Ie=(e,t)=>({name:e,type:"ordinal",range:t,domain:{data:V.TABLE,fields:[]}}),Le=e=>Boolean(e&&!Array.isArray(e)&&"data"in e&&"fields"in e),Ae=(e,t)=>{if(t||e.length)return{value:"pointer"}};function De(e,t,a){if(e.length){const n={signal:`merge(datum${a?".datum":""}, {'${V.COMPONENT_NAME}': '${t}'})`},r=e[0].excludeDataKeys;return(null==r?void 0:r.length)?[...r.map((e=>({test:`datum.${e}`,signal:"false"}))),n]:n}}const Re=(e,t=!1)=>e?{stroke:{signal:V.BACKGROUND_COLOR},strokeWidth:{value:t?1.5:1},strokeJoin:{value:"round"}}:{},Me=e=>{const t="hasOnClick"in e&&e.hasOnClick,a="metricRanges"in e&&e.metricRanges||[],n="trendlines"in e&&e.trendlines||[];return t||Ce(e)||Ne(e)||n.some((e=>e.displayOnHover))||a.some((e=>e.displayOnHover))},Ce=e=>{var t;return Boolean("chartPopovers"in e&&(null===(t=e.chartPopovers)||void 0===t?void 0:t.length))},Ne=e=>{var t;return Boolean("chartTooltips"in e&&(null===(t=e.chartTooltips)||void 0===t?void 0:t.length))},je=(e,t,a="ordinal")=>{const n="linear"===a?V.LINEAR_COLOR_SCALE:V.COLOR_SCALE;return Array.isArray(e)?{signal:`scale('colors', datum.${e[0]})[indexof(domain('secondaryColor'), datum.${e[1]})% length(scale('colors', datum.${e[0]}))]`}:"string"==typeof e?{scale:n,field:e}:{value:(0,W.getColorValue)(e.value,t)}},ke=e=>{if(e)return Array.isArray(e)?{signal:`scale('lineWidths', datum.${e[0]})[indexof(domain('secondaryLineWidth'), datum.${e[1]})% length(scale('lineWidths', datum.${e[0]}))]`}:"string"==typeof e?{scale:V.LINE_WIDTH_SCALE,field:e}:{value:re(e.value)}},Pe=e=>Array.isArray(e)?{signal:`scale('opacities', datum.${e[0]})[indexof(domain('secondaryOpacity'), datum.${e[1]})% length(scale('opacities', datum.${e[0]}))]`}:"string"==typeof e?{signal:`scale('${V.OPACITY_SCALE}', datum.${e})`}:{value:e.value},He=e=>"string"==typeof e?{scale:V.SYMBOL_SIZE_SCALE,field:e}:{value:se(e.value)},we=e=>Array.isArray(e)?{signal:`scale('lineTypes', datum.${e[0]})[indexof(domain('secondaryLineType'), datum.${e[1]})% length(scale('lineTypes', datum.${e[0]}))]`}:"string"==typeof e?{scale:V.LINE_TYPE_SCALE,field:e}:{value:ne(e.value)},Fe=(e,t)=>{const a=xe("x",e);return"time"===e?{scale:a,field:V.DEFAULT_TRANSFORMED_TIME_DIMENSION}:{scale:a,field:t}},Ge=(e,t)=>({scale:e||"yLinear",field:t}),ze=(e,t,a,n,r,i)=>({name:`${n}_pointsForVoronoi`,description:`${n}_pointsForVoronoi`,type:"symbol",from:{data:e},interactive:!1,encode:{enter:{y:Ge(i,a),fill:{value:"transparent"},stroke:{value:"transparent"}},update:{x:Fe(r,t)}}}),Be=(e,t)=>{const{chartPopovers:a,chartTooltips:n,name:r}=e,i="hasOnClick"in e&&e.hasOnClick;return{name:`${r}_voronoi`,description:`${r}_voronoi`,type:"path",from:{data:t},encode:{enter:{fill:{value:"transparent"},stroke:{value:"transparent"},isVoronoi:{value:!0},tooltip:De(null!=n?n:[],r,!0)},update:{cursor:Ae(null!=a?a:[],i)}},transform:[{type:"voronoi",x:"datum.x",y:"datum.y",size:[{signal:"max(width, 1)"},{signal:"max(height, 1)"}]}]}},Ue=(e,t,a,n,r,i,o)=>({name:`${r}_hoverGroup`,type:"group",marks:We().map(((s,l)=>({name:Ve(r,l),type:"symbol",from:{data:t},encode:{enter:{shape:{value:V.HOVER_SHAPE},y:Ge(o,n),fill:{value:"transparent"},stroke:{value:"transparent"},tooltip:De(e,r,!1),size:Ye(s)},update:{x:Fe(i,a)}}})))}),Ve=(e,t)=>`${e}_hover${t}`,We=()=>[...new Array(V.HOVER_SHAPE_COUNT)].map(((e,t)=>V.HOVER_SIZE/2**t)),Je=e=>[...new Array(V.HOVER_SHAPE_COUNT)].map(((t,a)=>Ve(e,a))),Ye=e=>({signal:`${e} * max(width, 1) / 1000`}),Ke=e=>{const{highlightedItem:t,idKey:a,name:n}=e,r=[V.DEFAULT_OPACITY_RULE];return Me(e)||void 0!==t?(it(r,e),Ce(e)?[{test:`!isValid(${V.SELECTED_GROUP}) && ${V.SELECTED_ITEM} && ${V.SELECTED_ITEM} !== datum.${a}`,value:1/V.HIGHLIGHT_CONTRAST_RATIO},Object.assign({test:`isValid(${V.SELECTED_ITEM}) && ${V.SELECTED_ITEM} === datum.${a}`},V.DEFAULT_OPACITY_RULE),{test:`isValid(${V.SELECTED_GROUP}) && ${V.SELECTED_GROUP} === datum.${n}_selectedGroupId`,value:1},{test:`isValid(${V.SELECTED_GROUP}) && ${V.SELECTED_GROUP} !== datum.${n}_selectedGroupId`,value:1/V.HIGHLIGHT_CONTRAST_RATIO},...r]:r):r},Xe=(e,t)=>{var a;return Me(e)||void 0!==e.highlightedItem?t:"trendlines"in e&&(null===(a=e.trendlines)||void 0===a?void 0:a.some((e=>Me(e))))?`${t}Trendline`:void 0};const qe=e=>e.chartTooltips.map((t=>Ze(t,e.name))),Ze=(e,t)=>{var{highlightBy:a="item"}=e,n=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]])}return a}(e,["highlightBy"]);return Object.assign({highlightBy:a,markName:t},n)},Qe=(e,t,a=!0)=>{const n=qe(t);for(const{highlightBy:r,markName:i}of n){if("item"===r)return;const n=q(e);n.transform||(n.transform=[]),"dimension"===r&&"donut"!==t.markType&&"venn"!==t.markType?n.transform.push(et([t.dimension],i)):"series"===r?n.transform.push(et([V.SERIES_ID],i)):Array.isArray(r)&&n.transform.push(et(r,i)),a&&e.push(tt(i))}},et=(e,t)=>({type:"formula",as:`${t}_highlightGroupId`,expr:e.map((e=>`datum.${e}`)).join(' + " | " + ')}),tt=e=>({name:`${e}_highlightedData`,source:V.FILTERED_TABLE,transform:[{type:"filter",expr:`${V.HIGHLIGHTED_GROUP} === datum.${e}_highlightGroupId`}]}),at=e=>qe(e).some((({highlightBy:e})=>e&&"item"!==e)),nt=(e,t)=>{if(at(t)){const a=e.find((e=>e.name===V.HIGHLIGHTED_GROUP));let n=t.name,r=`datum.${n}_highlightGroupId`;"interactionMode"in t&&t.interactionMode===V.INTERACTION_MODE.ITEM&&Je(n).forEach((e=>{rt(a,e,r)})),["scatter","line"].includes(t.markType)&&(r=`datum.${r}`,n+="_voronoi"),rt(a,n,r)}},rt=(e,t,a)=>{void 0===e.on&&(e.on=[]),e.on.push({events:`@${t}:mouseover`,update:a},{events:`@${t}:mouseout`,update:"null"})},it=(e,t)=>{if(e.unshift({test:`isArray(${V.HIGHLIGHTED_ITEM}) && length(${V.HIGHLIGHTED_ITEM}) > 0 && indexof(${V.HIGHLIGHTED_ITEM}, datum.${t.idKey}) === -1`,value:1/V.HIGHLIGHT_CONTRAST_RATIO},{test:`!isArray(${V.HIGHLIGHTED_ITEM}) && isValid(${V.HIGHLIGHTED_ITEM}) && ${V.HIGHLIGHTED_ITEM} !== datum.${t.idKey}`,value:1/V.HIGHLIGHT_CONTRAST_RATIO}),at(t)){const{name:a}=t;e.unshift(Object.assign({test:`${V.HIGHLIGHTED_GROUP} === datum.${a}_highlightGroupId`},V.DEFAULT_OPACITY_RULE))}},ot=(e,t,a)=>{const n=`domain("${e}Entries")[datum.index]`;return t?(null==a?void 0:a.length)?`indexof(pluck(data("${V.FILTERED_TABLE}"),"${e}_highlightGroupId"), ${n}) !== -1 ? ${n} : null`:`indexof(hiddenSeries, ${n}) === -1 ? ${n} : null`:n},st=(e,t=null)=>({name:e,value:t}),lt=(e,t,a,n=1,r)=>{const i=e.find((e=>e.name===V.HIGHLIGHTED_ITEM));if(i){void 0===i.on&&(i.on=[]);const e=new Array(n).fill("datum.").join(""),o=null==r?void 0:r.map((t=>`${e}${t}`)).join(" || ");i.on.push({events:`@${t}:mouseover`,update:(null==r?void 0:r.length)?`(${o}) ? null : ${e}${a}`:`${e}${a}`},{events:`@${t}:mouseout`,update:"null"})}},ct=(e,t,a=1,n)=>{const r=e.find((e=>e.name===V.HIGHLIGHTED_SERIES));if(r){void 0===r.on&&(r.on=[]);const e=new Array(a).fill("datum.").join(""),i=null==n?void 0:n.map((t=>`${e}${t}`)).join(" || ");r.on.push({events:`@${t}:mouseover`,update:(null==n?void 0:n.length)?`(${i}) ? null : ${e}${V.SERIES_ID}`:`${e}${V.SERIES_ID}`},{events:`@${t}:mouseout`,update:"null"})}},ut=(e,t=`${e.name}_facet`)=>{const{name:a,chartPopovers:n,chartTooltips:r,color:i,colorScheme:o,metricStart:s,metricEnd:l,isStacked:c,scaleType:u,dimension:d,opacity:m}=e;return{name:a,description:a,type:"area",from:{data:t},interactive:Me(e),encode:{enter:Object.assign({y:{scale:"yLinear",field:s},y2:{scale:"yLinear",field:l},fill:je(i,o),tooltip:De(null!=r?r:[],a)},Re(c,!0)),update:{x:mt(u,d),cursor:Ae(null!=n?n:[]),fillOpacity:{value:m},opacity:dt(e)}}}};function dt(e){const{chartPopovers:t,displayOnHover:a,isHighlightedByGroup:n,isMetricRange:r,highlightedItem:i,name:o}=e,s=1/V.HIGHLIGHT_CONTRAST_RATIO;if(r&&a)return[{test:`isValid(${V.HIGHLIGHTED_SERIES}) && ${V.HIGHLIGHTED_SERIES} === datum.${V.SERIES_ID}`,value:1},{test:`isValid(${V.HIGHLIGHTED_ITEM}) && indexof(pluck(data('${o}_highlightedData'), '${V.SERIES_ID}'), datum.${V.SERIES_ID}) > -1`},{test:`isValid(${V.SELECTED_SERIES}) && ${V.SELECTED_SERIES} === datum.${V.SERIES_ID}`,value:1},{value:0}];if(!Me(e)&&!i)return[V.DEFAULT_OPACITY_RULE];const l=[];return n&&l.push({test:`indexof(pluck(data('${o}_highlightedData'), '${V.SERIES_ID}'), datum.${V.SERIES_ID}) !== -1`,value:1}),!r&&(null==t?void 0:t.length)?[...l,{test:`!isValid(${V.SELECTED_SERIES}) && isValid(${V.HIGHLIGHTED_SERIES}) && ${V.HIGHLIGHTED_SERIES} !== datum.${V.SERIES_ID}`,value:s},{test:`!isValid(${V.SELECTED_SERIES}) && length(data('${o}_highlightedData')) > 0 && indexof(pluck(data('${o}_highlightedData'), '${V.SERIES_ID}'), datum.${V.SERIES_ID}) === -1`,value:s},{test:`isValid(${V.SELECTED_SERIES}) && ${V.SELECTED_SERIES} !== datum.${V.SERIES_ID}`,value:s},V.DEFAULT_OPACITY_RULE]:[...l,{test:`isValid(${V.HIGHLIGHTED_SERIES}) && ${V.HIGHLIGHTED_SERIES} !== datum.${V.SERIES_ID}`,value:s},{test:`length(data('${o}_highlightedData')) > 0 && indexof(pluck(data('${o}_highlightedData'), '${V.SERIES_ID}'), datum.${V.SERIES_ID}) === -1`,value:s},V.DEFAULT_OPACITY_RULE]}const mt=(e,t)=>"time"===e?{scale:"xTime",field:V.DEFAULT_TRANSFORMED_TIME_DIMENSION}:"linear"===e?{scale:"xLinear",field:t}:{scale:"xPoint",field:t};const pt=U(((e,t)=>{var a,n,r,i,{chartPopovers:o=[],chartTooltips:s=[],color:l=V.DEFAULT_COLOR,colorScheme:c=V.DEFAULT_COLOR_SCHEME,dimension:u=V.DEFAULT_TIME_DIMENSION,index:d=0,metric:m=V.DEFAULT_METRIC,metricStart:p,metricEnd:h,name:g,opacity:f=.8,scaleType:y="time"}=t,v=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]])}return a}(t,["chartPopovers","chartTooltips","color","colorScheme","dimension","index","metric","metricStart","metricEnd","name","opacity","scaleType"]);const b=Object.assign({chartPopovers:o,chartTooltips:s,color:l,colorScheme:c,dimension:u,index:d,metric:m,name:(0,J.toCamelCase)(g||`area${d}`),scaleType:y,opacity:f,metricStart:p,metricEnd:h},v);return!p&&!h||p&&h||(console.error(`${h?"metricEnd":"metricStart"} is defined but ${h?"metricStart":"metricEnd"} is not. Both must be defined in order to use the "start and end" method. Defaulting back to 'metric = ${m}'`),b.metricEnd=void 0,b.metricStart=void 0),e.data=ht(null!==(a=e.data)&&void 0!==a?a:[],b),e.signals=ft(null!==(n=e.signals)&&void 0!==n?n:[],b),e.scales=vt(null!==(r=e.scales)&&void 0!==r?r:[],b),e.marks=bt(null!==(i=e.marks)&&void 0!==i?i:[],b),e})),ht=U(((e,t)=>{var a,n;const{color:r,dimension:i,highlightedItem:o,metric:s,metricEnd:l,metricStart:c,name:u,order:d,scaleType:m}=t;if("time"===m){const t=X(e);t.transform=Y(null!==(a=t.transform)&&void 0!==a?a:[],i)}if(!l||!c){const t=q(e);t.transform=[...null!==(n=t.transform)&&void 0!==n?n:[],{type:"stack",groupby:[i],field:s,sort:K(d),as:[`${s}0`,`${s}1`]}]}if(Me(t)||void 0!==o){const a=Ce(t),n=Ne(t);e.push(gt(u,t.idKey,n,a,at(t))),a&&e.push({name:`${u}_selectedDataSeries`,source:V.FILTERED_TABLE,transform:[{type:"filter",expr:`isValid(${V.SELECTED_SERIES}) && ${V.SELECTED_SERIES} === datum.${r}`}]})}Qe(e,t,!1)})),gt=(e,t,a,n,r)=>{let i="";return r?i+=`${e}_controlledHoveredGroup === datum.${e}_highlightGroupId`:(i+=`isArray(${V.HIGHLIGHTED_ITEM}) && indexof(${V.HIGHLIGHTED_ITEM}, datum.${t}) > -1 || ${V.HIGHLIGHTED_ITEM} === datum.${t}`,a&&(i=`${e}_controlledHoveredId === datum.${t} || ${i}`)),n&&(i=`isValid(${V.SELECTED_ITEM}) && ${V.SELECTED_ITEM} === datum.${t} || !isValid(${V.SELECTED_ITEM}) && ${i}`),{name:`${e}_highlightedData`,source:V.FILTERED_TABLE,transform:[{type:"filter",expr:i}]}},ft=U(((e,t)=>{var a;const{chartTooltips:n,name:r}=t;Me(t)&&(ct(e,r,1,null===(a=n[0])||void 0===a?void 0:a.excludeDataKeys),t.highlightedItem&&yt(e,r),at(t)?e.push((e=>({name:`${e}_controlledHoveredGroup`,value:null,on:[{events:`@${e}:mouseout`,update:"null"}]}))(r)):e.push((e=>({name:`${e}_controlledHoveredId`,value:null,on:[{events:`@${e}:mouseout`,update:"null"}]}))(r)),nt(e,t))})),yt=(e,t)=>{const a=e.find((e=>e.name===V.HIGHLIGHTED_ITEM));a&&(void 0===a.on&&(a.on=[]),a.on.push({events:`@${t}:mouseover`,update:"null"}))},vt=U(((e,{metric:t,metricEnd:a,metricStart:n,dimension:r,color:i,scaleType:o,padding:s})=>(ve(e,{scaleType:o,dimension:r,padding:s}),Ee(e,V.COLOR_SCALE,i),a&&n||(n=`${t}0`,a=`${t}1`),Se(e,[n,a]),e))),bt=U(((e,t)=>{const{chartPopovers:a,chartTooltips:n,color:r,colorScheme:i,dimension:o,highlightedItem:s,metric:l,name:c,opacity:u,scaleType:d}=t;let{metricStart:m,metricEnd:p}=t,h=!1;return p&&m||(h=!0,m=`${l}0`,p=`${l}1`),e.push({name:`${c}_group`,type:"group",from:{facet:{name:`${c}_facet`,data:V.FILTERED_TABLE,groupby:r}},marks:[ut({chartPopovers:a,chartTooltips:n,color:r,colorScheme:i,dimension:o,isHighlightedByGroup:at(t),isStacked:h,highlightedItem:s,metricStart:m,metricEnd:p,name:c,opacity:u,scaleType:d}),...St(t)]},..._t({chartPopovers:a,name:c,scaleType:d,color:r,dimension:o,metricEnd:p,metricStart:m}),...Et(t)),e})),St=e=>{const{name:t,dimension:a,metric:n,scaleType:r}=e;return Me(e)?[{name:`${t}_anchorPoint`,type:"symbol",from:{data:`${t}_highlightedData`},interactive:!1,encode:{enter:{y:{scale:"yLinear",field:`${n}1`},stroke:{value:"transparent"},fill:{value:"transparent"}},update:{x:mt(r,a)}}}]:[]},Et=e=>{const{name:t,dimension:a,highlightedItem:n,metric:r,scaleType:i,color:o}=e;if(!Me(e)&&void 0===n)return[];const s=[{name:`${t}_point`,type:"symbol",from:{data:`${t}_highlightedData`},interactive:!1,encode:{enter:{y:{scale:"yLinear",field:`${r}1`},stroke:{scale:V.COLOR_SCALE,field:o},fill:{signal:V.BACKGROUND_COLOR}},update:{x:mt(i,a)}}}];return(qe(e).some((({highlightBy:e})=>"string"==typeof e&&["dimension","item"].includes(e)))||n)&&s.unshift({name:`${t}_rule`,type:"rule",from:{data:`${t}_highlightedData`},interactive:!1,encode:{enter:{y:{value:0},y2:{signal:"height"},strokeWidth:{value:1}},update:{x:mt(i,a)}}}),s},_t=({chartPopovers:e,name:t,scaleType:a,color:n,dimension:r,metricEnd:i,metricStart:o})=>e.length?[{name:`${t}_selectBorder`,type:"area",from:{data:`${t}_selectedDataSeries`},interactive:!1,encode:{enter:{y:{scale:"yLinear",field:o},y2:{scale:"yLinear",field:i},fill:{scale:V.COLOR_SCALE,field:n},stroke:{value:W.spectrumColors.light["static-blue"]},strokeWidth:{value:2},strokeJoin:{value:"round"}},update:{x:mt(a,r)}}}]:[];var Tt=i(743),Ot=i.n(Tt);const $t=({axisAnnotations:e,colorScheme:t,name:a,position:n,scaleType:r})=>"bottom"!==n?[]:e.map(((e,n)=>xt(e,n,a,t,r))),xt=({chartPopovers:e=[],chartTooltips:t=[],name:a,format:n,offset:r=V.DEFAULT_AXIS_ANNOTATION_OFFSET,color:i=V.DEFAULT_AXIS_ANNOTATION_COLOR,dataKey:o="annotations",options:s=[]},l,c,u,d)=>({chartPopovers:e,chartTooltips:t,color:i,colorScheme:u,dataKey:o,name:null!=a?a:`${c}Annotation${l}`,offset:r,options:s,axisName:c,format:null!=n?n:"time"===d?"span":"summary"});function It(e){const t=`${e}Primary`,a=`${e}Secondary`;return{primaryScale:t,secondaryScale:a,primaryDomain:`${t}Domain`,secondaryDomain:`${a}Domain`}}const Lt=(e,t="value",a,n)=>{const r=`isNumber(datum['${t}'])`;return"shortNumber"===e?[{test:r,signal:`formatShortNumber(datum['${t}'])`}]:"shortCurrency"===e?[{test:`${r} && abs(datum['${t}']) >= 1000`,signal:`upper(replace(format(datum['${t}'], '$.3~s'), /(\\d+)G/, '$1B'))`},{test:r,signal:`format(datum['${t}'], '$')`}]:n&&a?[{test:r,signal:`formatLocaleCurrency(datum, "${a}", "${n}", "${e}")`}]:[{test:r,signal:`format(datum['${t}'], '${pe(e)}')`}]},At=(e,t)=>{const{grid:a,hideDefaultLabels:n,labelAlign:r,labelFontWeight:i,labelOrientation:o,tickCountLimit:s,position:l,scaleType:c,ticks:u,tickMinStep:d,title:m,vegaLabelAlign:p,vegaLabelBaseline:h,vegaLabelOffset:g,vegaLabelPadding:f}=e;return Object.assign(Object.assign({scale:t,orient:l,grid:a,ticks:u,tickCount:wt(l,s,a),tickMinStep:"linear"!==c?void 0:d,title:m,labelAngle:Wt(o),labelFontWeight:i,labelOffset:Jt(r,t,g),labelPadding:f,labels:!n},Bt(l,o,r,p,h)),{encode:{labels:{update:{text:Yt(e,t)}}}})},Dt=(e,{granularity:t,grid:a,labelAlign:n,labelOrientation:r,position:i,ticks:o,title:s,vegaLabelAlign:l,vegaLabelBaseline:c})=>{const{tickCount:u}=Gt(t);return Object.assign(Object.assign({scale:e,orient:i,grid:a,ticks:o,tickCount:e.includes("Time")?u:void 0,title:s,formatType:"time",labelAngle:Wt(r),labelSeparation:12},Rt(t,i)),Bt(i,r,n,l,c))},Rt=(e,t)=>{const{secondaryLabelFormat:a,primaryLabelFormat:n}=Gt(e);return["left","right"].includes(t)?{format:`${n} ${a}`,encode:{labels:{update:{text:{signal:"formatVerticalAxisTimeLabels(datum)"}}}}}:{format:a}},Mt=(e,{granularity:t,labelAlign:a,labelOrientation:n,labelFontWeight:r,position:i,ticks:o,vegaLabelAlign:s,vegaLabelBaseline:l})=>{if(["left","right"].includes(i))return[];const{primaryLabelFormat:c,tickCount:u}=Gt(t);return[Object.assign(Object.assign({scale:e,orient:i,format:c,tickCount:e.includes("Time")?u:void 0,formatType:"time",labelOverlap:"greedy",labelFontWeight:r,labelAngle:Wt(n)},Bt(i,n,a,s,l)),{encode:{labels:{enter:{dy:{value:(o?28:20)*("top"===i?-1:1)}},update:{text:{signal:"formatHorizontalTimeAxisLabels(datum)"}}}}})]},Ct=(e,t)=>{var a;const n=e.filter((e=>"range"in e&&e.range===Nt(t)));let r;return r=n.length>1&&null!==(a=e.find((e=>e.name.includes("Trellis"))))&&void 0!==a?a:n[0],r||(r={name:Pt(t),type:"linear",range:Nt(t)},e.push(r),r)},Nt=e=>"left"===e||"right"===e?"height":"width",jt=e=>"left"===e||"right"===e?"width":"height",kt=e=>["left","right"].includes(e),Pt=e=>kt(e)?"yLinear":"xLinear",Ht=e=>kt(e)?"xLinear":"yLinear",wt=(e,t,a)=>{const n=["top","bottom"].includes(e)?"width":"height";return void 0!==t?{signal:`clamp(ceil(${n}/100), 2, ${t})`}:a?{signal:`clamp(ceil(${n}/100), 2, 10)`}:void 0},Ft=({subLabels:e,labelOrientation:t})=>Boolean(e.length&&"horizontal"===t),Gt=e=>{switch(e){case"second":return{secondaryLabelFormat:":%S",primaryLabelFormat:"%-I:%M %p",tickCount:"second"};case"minute":return{secondaryLabelFormat:"%-I:%M %p",primaryLabelFormat:"%b %-d",tickCount:"minute"};case"hour":return{secondaryLabelFormat:"%-I %p",primaryLabelFormat:"%b %-d",tickCount:"hour"};case"day":default:return{secondaryLabelFormat:"%-d",primaryLabelFormat:"%b",tickCount:"day"};case"week":return{secondaryLabelFormat:"%-d",primaryLabelFormat:"%b",tickCount:"week"};case"month":return{secondaryLabelFormat:"%b",primaryLabelFormat:"%Y",tickCount:"month"};case"quarter":return{secondaryLabelFormat:"Q%q",primaryLabelFormat:"%Y",tickCount:{interval:"month",step:3}};case"year":return{secondaryLabelFormat:"%Y",primaryLabelFormat:"",tickCount:"year"}}},zt=(e,t,a)=>a?Ut(e,t,a):{align:void 0,baseline:void 0},Bt=(e,t,a,n,r)=>{const{align:i,baseline:o}=Ut(e,t,a);return{labelAlign:null!=n?n:i,labelBaseline:null!=r?r:o}},Ut=(e,t,a)=>{let n,r;return Vt(e,t)?(n={start:"left",center:"center",end:"right"}[a],r=["top","left"].includes(e)?"bottom":"top"):(r={start:"top",center:"middle",end:"bottom"}[a],n=["bottom","left"].includes(e)?"right":"left"),{align:n,baseline:r}},Vt=(e,t)=>(["top","bottom"].includes(e)?"horizontal":"vertical")===t,Wt=e=>"horizontal"===e?0:270,Jt=(e,t,a)=>{if(void 0!==a)return a;switch(e){case"start":return{signal:`bandwidth('${t}') / -2`};case"end":return{signal:`bandwidth('${t}') / 2`};default:return}},Yt=({labelFormat:e,labelOrientation:t,numberFormat:a,position:n,truncateLabels:r,currencyLocale:i,currencyCode:o},s)=>"percentage"===e?[{test:"isNumber(datum.value)",signal:"format(datum.value, '~%')"},{signal:"datum.value"}]:"duration"===e?{signal:"formatTimeDurationLabels(datum)"}:[...Lt(a,void 0,i,o),...r&&s.includes("Band")&&Vt(n,t)?[{signal:'truncateText(datum.value, bandwidth("xBand")/(1- paddingInner), "normal", 14)'}]:[{signal:"datum.value"}]],Kt=(e,t,a,n,r,i)=>({update:Object.assign({text:[{test:`indexof(pluck(${i}, 'value'), datum.value) !== -1`,signal:`${i}[indexof(pluck(${i}, 'value'), datum.value)].${a}`},{signal:"datum.value"}],fontWeight:[{test:`indexof(pluck(${i}, 'value'), datum.value) !== -1 && ${i}[indexof(pluck(${i}, 'value'), datum.value)].fontWeight`,signal:`${i}[indexof(pluck(${i}, 'value'), datum.value)].fontWeight`},{value:t}]},Xt(r,i,n,e))}),Xt=(e,t,a,n)=>{const r=`indexof(pluck(${t}, 'value'), datum.value) !== -1 && ${t}[indexof(pluck(${t}, 'value'), datum.value)]`,i=`${t}[indexof(pluck(${t}, 'value'), datum.value)]`,{align:o,baseline:s}=Ut(e,a,n);return{align:[{test:`${r}.align`,signal:`${i}.align`},{value:o}],baseline:[{test:`${r}.baseline`,signal:`${i}.baseline`},{value:s}]}},qt=e=>e.referenceLines.map(((t,a)=>Zt(t,e,a))),Zt=(e,t,a)=>{var n,r,i;return Object.assign(Object.assign({},e),{color:e.color||"gray-800",colorScheme:t.colorScheme,iconColor:e.iconColor||V.DEFAULT_FONT_COLOR,labelColor:e.labelColor||V.DEFAULT_FONT_COLOR,labelFontWeight:null!==(n=e.labelFontWeight)&&void 0!==n?n:V.DEFAULT_LABEL_FONT_WEIGHT,layer:null!==(r=e.layer)&&void 0!==r?r:"front",name:`${t.name}ReferenceLine${a}`,lineType:null!==(i=e.lineType)&&void 0!==i?i:"solid"})},Qt=e=>Boolean(e&&["band","linear","point","time","utc"].includes(e)),ea=({scaleType:e},{value:t,position:a},n)=>{const r="string"==typeof t?`'${t}'`:t,i=`paddingInner * bandwidth('${n}') / (2 * (1 - paddingInner))`;return"band"===e?"before"===a?{signal:`scale('${n}', ${r}) - ${i}`}:"after"===a?{signal:`scale('${n}', ${r}) + bandwidth('${n}') + ${i}`}:{signal:`scale('${n}', ${r}) + bandwidth('${n}') / 2`}:{scale:n,value:t}},ta=({position:e,ticks:t},{color:a,colorScheme:n,name:r,lineType:i},o)=>{const s=t?9:0,l={top:{x:o,y:{value:-s},y2:{signal:"height"}},bottom:{x:o,y:{value:0},y2:{signal:`height + ${s}`}},left:{x:{value:-s},x2:{signal:"width"},y:o},right:{x:{value:0},x2:{signal:`width + ${s}`},y:o}};return{name:r,type:"rule",interactive:!1,encode:{enter:{stroke:{value:(0,W.getColorValue)(a,n)},strokeDash:{value:ne(null!=i?i:"solid")}},update:Object.assign({},l[e])}}},aa=(e,t,a)=>({top:{x:t,y:{value:-e}},bottom:{x:t,y:{signal:`height + ${e}`}},left:{x:{value:-e},y:Object.assign(Object.assign({},t),{offset:a})},right:{x:{signal:`width + ${e}`},y:Object.assign(Object.assign({},t),{offset:a})}}),na=({colorScheme:e,position:t},{icon:a,iconColor:n,name:r},i)=>{if(!a)return[];const o=aa(24,i);return[{name:`${r}_symbol`,type:"symbol",encode:{enter:{shape:{value:oe(a)},size:{value:324},fill:{value:(0,W.getColorValue)(n,e)}},update:Object.assign({},o[t])}}]},ra=(e,t,a)=>{const{label:n,name:r}=t;return n?[{name:`${r}_label`,type:"text",encode:Object.assign({},ia(e,Object.assign(Object.assign({},t),{label:n}),a))}]:[]},ia=({position:e},{colorScheme:t,icon:a,label:n,labelColor:r,labelFontWeight:i},o)=>{const{verticalOffset:s,horizontalOffset:l}=((e,t)=>{const a=kt(e);let n=a?40:28,r=a?4:5;return t&&(n+=a?25:20,a||(r+=25,n+=2)),{verticalOffset:n,horizontalOffset:r}})(e,a),c=aa(s,o,l);return{update:Object.assign(Object.assign({text:[{value:n}],fontWeight:[{value:i}],fill:{value:(0,W.getColorValue)(r,t)}},oa(e)),c[e])}},oa=e=>{switch(e){case"top":case"bottom":return{align:{value:"center"}};case"left":case"right":return{baseline:{value:"center"}}}},sa=e=>/[xy]TrellisGroup/g.test(JSON.stringify(e));var la=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]])}return a};const ca=U(((e,t)=>{var a,n,r,i,o,s,l,{name:c,axisAnnotations:u=[],baseline:d=!1,baselineOffset:m=0,colorScheme:p=V.DEFAULT_COLOR_SCHEME,granularity:h=V.DEFAULT_GRANULARITY,grid:g=!1,hideDefaultLabels:f=!1,index:y=0,labelAlign:v=V.DEFAULT_LABEL_ALIGN,labelFontWeight:b=V.DEFAULT_LABEL_FONT_WEIGHT,labelOrientation:S=V.DEFAULT_LABEL_ORIENTATION,labels:E=[],numberFormat:_="shortNumber",position:T,range:O,referenceLines:$=[],subLabels:x=[],ticks:I=!1}=t,L=la(t,["name","axisAnnotations","baseline","baselineOffset","colorScheme","granularity","grid","hideDefaultLabels","index","labelAlign","labelFontWeight","labelOrientation","labels","numberFormat","position","range","referenceLines","subLabels","ticks"]);const A=Ct(null!==(a=e.scales)&&void 0!==a?a:[],T),D=c||A.name,R=A.type,M=((e,t)=>{let a=e.find((e=>"range"in e&&e.range===jt(t)));return a||(a={name:Ht(t),type:"linear",range:jt(t)},e.push(a)),a.type})(null!==(n=e.scales)&&void 0!==n?n:[],T),C=Object.assign({axisAnnotations:u,baseline:d,baselineOffset:m,colorScheme:p,granularity:h,grid:g,hideDefaultLabels:f,index:y,labelAlign:v,labelFontWeight:b,labelOrientation:S,labels:E,name:`axis${y}`,numberFormat:_,position:T,range:O,referenceLines:$,subLabels:x,ticks:I,scaleType:null!=R?R:"linear"},L),N=null===(r=e.signals)||void 0===r?void 0:r.some((e=>"firstRscSeriesId"===e.name));e.data=ua(null!==(i=e.data)&&void 0!==i?i:[],Object.assign(Object.assign({},C),{scaleType:null!=R?R:"linear"})),e.signals=da(null!==(o=e.signals)&&void 0!==o?o:[],C),!O||"linear"!==R&&"time"!==R||(A.domain=O);const j=e.usermeta;return e.axes=pa(null!==(s=e.axes)&&void 0!==s?s:[],Object.assign(Object.assign({},C),{scaleName:D,opposingScaleType:M,usermeta:j,grid:C.grid&&!sa(e),dualMetricAxis:N})),e.marks=ga(null!==(l=e.marks)&&void 0!==l?l:[],Object.assign(Object.assign({},C),{usermeta:j,scaleName:D,opposingScaleType:M,dualMetricAxis:N})),e})),ua=U(((e,t)=>{$t(t).forEach((t=>{((e,{name:t,dataKey:a,color:n,colorScheme:r,options:i,format:o})=>{e.push(((e,t,a)=>({name:`${e}_details`,values:t.map((e=>Object.assign(Object.assign({},e),{color:(0,W.getColorValue)(e.color,a)})))}))(t,i,r)),"summary"===o?e.push(((e,t,a,n)=>({name:`${e}_summary`,source:V.FILTERED_TABLE,transform:[{type:"filter",expr:`datum.${t}`},{type:"flatten",fields:[t],as:[`${e}_id`]},{type:"aggregate",groupby:[`${e}_id`]},{type:"aggregate",groupby:["center"],fields:[t,t],ops:["count","values"],as:["number","annotations"]},{type:"formula",expr:`datum.annotations[0].${e}_id`,as:"id"},{type:"lookup",from:`${e}_details`,key:"id",values:["color"],fields:["id"]},{type:"formula",expr:`datum.number > 1 || datum.color == null ? '${(0,W.getColorValue)(a,n)}' : datum.color`,as:"color"}]}))(t,a,n,r)):e.push(((e,t,a,n)=>({name:`${e}_aggregate`,source:V.FILTERED_TABLE,transform:[{type:"filter",expr:`datum.${t}`},{type:"flatten",fields:[t],as:[`${e}_id`]},{type:"aggregate",groupby:[`${e}_id`],fields:["datetime","datetime"],ops:["min","max"]},{type:"formula",expr:"datum.max_datetime - datum.min_datetime",as:"width"},{type:"formula",expr:"datum.width / 2 + datum.min_datetime",as:"center"},{type:"aggregate",groupby:["center"],fields:["min_datetime","max_datetime","width",t,t],ops:["min","max","max","count","values"],as:["lower","upper","width","number","annotations"]},{type:"formula",expr:`datum.annotations[0].${e}_id`,as:"id"},{type:"lookup",from:`${e}_details`,key:"id",values:["color"],fields:["id"]},{type:"formula",expr:`datum.number > 1 || datum.color == null ? '${(0,W.getColorValue)(a,n)}' : datum.color`,as:"color"}]}))(t,a,n,r),(e=>({name:`${e}_range`,source:`${e}_aggregate`,transform:[{type:"filter",expr:`${e}_highlighted && datum.center == ${e}_highlighted.center && ${e}_highlighted.width > 0`}]}))(t))})(e,t)}))})),da=U(((e,t)=>{const{name:a,labels:n,position:r,subLabels:i,labelOrientation:o}=t;(null==n?void 0:n.length)&&e.push(st(`${a}_labels`,ma(n,r,o))),Ft(t)&&e.push(st(`${a}_subLabels`,i.map((e=>Object.assign(Object.assign({},e),zt(r,o,e.align)))))),$t(t).forEach((t=>{((e,{name:t,format:a})=>{"span"===a&&e.push((e=>({name:`${e}_highlighted`,value:null,on:[{events:`@${e}_icon:mouseover`,update:"datum"},{events:`@${e}_icon:mouseout`,update:`${e}_clicked`}]}))(t),(e=>({name:`${e}_clicked`,value:{},on:[{events:{markname:`${e}_icon`,type:"mousedown",between:[{type:"mousedown"},{type:"mouseup"}]},update:"datum"},{events:"window:mouseup",update:"{}"}]}))(t),(e=>({name:`${e}_selected`,update:`${e}_clicked.center`}))(t))})(e,t)}))})),ma=(e,t,a)=>e.map((e=>{if("object"==typeof e)return Object.assign(Object.assign({},e),zt(t,a,e.align))})).filter(Boolean);const pa=U(((e,t)=>{var{scaleName:a,opposingScaleType:n,dualMetricAxis:r}=t,i=la(t,["scaleName","opposingScaleType","dualMetricAxis"]);const o=[];i=Object.assign(Object.assign({},i),(e=>{let t={};if(e.includes("TrellisBand")){const a=`bandwidth('${e}') / -2`,n=e.startsWith("x")?"x":"y";t={position:"x"===n?"top":"left",labelFontWeight:"bold",labelAlign:void 0,title:void 0,vegaLabelAlign:"left",vegaLabelBaseline:"bottom",vegaLabelOffset:"x"===n?{signal:a}:{signal:`${a} - 8`},vegaLabelPadding:"x"===n?8:0}}return t})(a));const{baseline:s,colorScheme:l,usermeta:c,labelAlign:u,labelFontWeight:d,labelFormat:m,labelOrientation:p,name:h,position:g}=i;if("time"===m)o.push(...((e,t)=>[Dt(e,t),...Mt(e,t)])(a,i));else{const e=At(i,a);if(i.labels.length){const t=i.labels,a=`${h}_labels`;e.values=t.map((e=>(e=>"object"==typeof e?e.value:e)(e))),e.encode={labels:Kt(u,d,"label",p,g,a)}}if(Ft(i)){e.titlePadding=24;const t=((e,t)=>{const{labelAlign:a,labelFontWeight:n,labelOrientation:r,name:i,position:o,ticks:s}=e,l=`${i}_subLabels`,c=e.subLabels.map((e=>e.value));let u=At(e,t);return u=Object.assign(Object.assign({},u),{domain:!1,domainWidth:void 0,grid:!1,labelPadding:s?32:24,ticks:!1,title:void 0,values:c.length?c:void 0,encode:{labels:Object.assign({},Kt(a,n,"subLabel",r,o,l))}}),u})(i,a);ha({dualMetricAxis:r,axis:t,usermeta:c,scaleName:a,colorScheme:l,position:g,incrementMetricAxisCount:!1}),o.push(t)}ha({dualMetricAxis:r,axis:e,usermeta:c,scaleName:a,colorScheme:l,position:g,incrementMetricAxisCount:!0}),o.unshift(e)}"linear"!==n&&(o[0]=function(e,t=!1){return Object.assign(Object.assign({},e),{domain:t,domainWidth:2})}(o[0],s)),Qt(i.scaleType)&&qt(i).forEach((e=>{var t,n,r;const{label:i,icon:s,value:l,position:c}=e,u=null===(r=null===(n=null===(t=o[0].encode)||void 0===t?void 0:t.labels)||void 0===n?void 0:n.update)||void 0===r?void 0:r.text;!s&&!i||!u||!Array.isArray(u)||c&&"center"!==c||u.unshift({test:`abs(scale('${a}', ${l}) - scale('${a}', datum.value)) < 30`,value:""})})),$t(i).forEach((e=>{((e,{offset:t},a)=>{e.push({scale:a,orient:"bottom",values:[],offset:t})})(o,e,a)})),e.push(...o)})),ha=({dualMetricAxis:e,axis:t,usermeta:a,scaleName:n,colorScheme:r,position:i,incrementMetricAxisCount:o})=>{var s;const l=null!==(s=null==a?void 0:a.chartOrientation)&&void 0!==s?s:"vertical";e&&function(e,t){return"vertical"===t?kt(e):!kt(e)}(i,l)&&(a.metricAxisCount||(a.metricAxisCount=0),function(e,t,a,n=V.DEFAULT_COLOR_SCHEME){const r=It(a),{primaryScale:i,secondaryScale:o}=r;t?(e.scale=i,function(e,t=V.DEFAULT_COLOR_SCHEME){const a=W.spectrumColors[t][V.DEFAULT_FONT_COLOR],n=[{test:`length(domain('${V.COLOR_SCALE}')) -1 === 1`,signal:`scale('${V.COLOR_SCALE}', ${V.FIRST_RSC_SERIES_ID})`},{value:a}],r=[{test:`${V.MOUSE_OVER_SERIES} === ${V.LAST_RSC_SERIES_ID}`,value:1/V.HIGHLIGHT_CONTRAST_RATIO}],i={labels:{update:{fill:n,fillOpacity:r}},title:{update:{fill:n,fillOpacity:r}}};e.encode?e.encode=Ot()(e.encode,i):e.encode=i}(e,n)):(e.scale=o,function(e){const t=[{signal:`scale('${V.COLOR_SCALE}', ${V.LAST_RSC_SERIES_ID})`}],a=[{test:`isValid(${V.MOUSE_OVER_SERIES}) && ${V.MOUSE_OVER_SERIES} !== ${V.LAST_RSC_SERIES_ID}`,value:1/V.HIGHLIGHT_CONTRAST_RATIO}],n={labels:{enter:{fill:t},update:{fillOpacity:a}},title:{enter:{fill:t},update:{fillOpacity:a}}};e.encode?e.encode=Ot()(e.encode,n):e.encode=n}(e))}(t,0===a.metricAxisCount,n,r),o&&a.metricAxisCount++)},ga=U(((e,t)=>{const{baseline:a,baselineOffset:n,opposingScaleType:r,position:i,scaleName:o,scaleType:s,usermeta:l}=t;if(Qt(s)){const{back:a,front:n}=((e,t)=>{const a={back:[],front:[]},n=qt(e);for(const r of n){const{layer:n}=r,i=ea(e,r,t);a[n].push(ta(e,r,i),...na(e,r,i),...ra(e,r,i))}return a})(t,o);e.unshift(...a),e.push(...n)}const c=e.find((e=>{var t;return null===(t=e.name)||void 0===t?void 0:t.includes("Trellis")})),u=Boolean(c);a&&"linear"===r&&function(e,t,a,n){var r,i;const o=((e,t)=>{const a=kt(t)?"y":"x",n={x:{x:{value:0},x2:{signal:"width"},y:{scale:"yLinear",value:e}},y:{x:{scale:"xLinear",value:e},y:{value:0},y2:{signal:"height"}}};return{name:`${a}Baseline`,description:`${a}Baseline`,type:"rule",interactive:!1,encode:{update:Object.assign({},n[a])}}})(t,a);n&&"marks"in n?0===t?null===(r=n.marks)||void 0===r||r.push(o):null===(i=n.marks)||void 0===i||i.unshift(o):0===t?e.push(o):e.unshift(o)}(e,n,i,c),u&&function(e,t,a,n){var r,i,o,s;const l=(null===(r=t.name)||void 0===r?void 0:r.startsWith("x"))?"horizontal":"vertical",c="bottom"===e.position||"top"===e.position?"horizontal":"vertical",u=e.hideDefaultLabels||l!==c;let d=e.scaleType;if(l===c){const n=Ct(null!==(i=t.scales)&&void 0!==i?i:[],e.position);a=n.name,d=null!==(o=n.type)&&void 0!==o?o:"linear"}else e.title=void 0;let m=pa([],Object.assign(Object.assign({},e),{hideDefaultLabels:u,scaleName:a,scaleType:d,dualMetricAxis:!1,usermeta:n}));m=((e,t)=>{const{facetName:a,facetGroupBy:n,trellisScaleName:r}=(e=>{var t;const a=`${(null!==(t=e.name)&&void 0!==t?t:"x")[0]}TrellisBand`,n=e.from;return{facetGroupBy:n.facet.groupby,facetName:n.facet.name,trellisScaleName:a}})(t);return e.map((e=>e.title?Object.assign(Object.assign({},e),{encode:Object.assign(Object.assign({},e.encode),{title:{update:{opacity:[{test:`info(domain('${r}')[0] === data('${a}')[0].${n})`,value:1},{value:0}]}}})}):e))})(m,t),t.axes=[...null!==(s=t.axes)&&void 0!==s?s:[],...m]}(t,c,o,l),$t(t).forEach((t=>{((e,t,a)=>{const{format:n}=t;"summary"===n?e.push((({chartPopovers:e,name:t,offset:a})=>({name:`${t}_group`,type:"group",from:{data:`${t}_summary`},marks:[{name:`${t}_icon`,type:"path",from:{data:`${t}_summary`},zindex:2,encode:{enter:{stroke:{value:"transparent"},strokeWidth:{value:2},cursor:Ae(e)},update:{path:{signal:`'${V.ANNOTATION_SINGLE_ICON_SVG}'`},fill:{field:"color"},xc:{signal:"width - 12"},yc:{signal:`height + ${a}`}}}}]}))(t)):e.push((({chartPopovers:e,name:t,offset:a},n)=>({name:`${t}_group`,type:"group",marks:[{name:`${t}_range`,type:"group",marks:[{type:"rect",from:{data:`${t}_range`},encode:{update:{x:{scale:n,field:"lower",band:.5},y:{signal:`height + ${a}`},width:{value:2},height:{value:-4},fill:{field:"color"},fillOpacity:{signal:`${t}_selected ? 1.0 : 0.2`}}}},{type:"rect",from:{data:`${t}_range`},encode:{update:{x:{scale:n,field:"lower",band:.5},y:{signal:`height + ${a}`},x2:{scale:n,field:"upper",band:.5},height:{value:2},fill:{field:"color"},fillOpacity:{signal:`${t}_selected ? 1.0 : 0.2`}}}},{type:"rect",from:{data:`${t}_range`},encode:{update:{x:{scale:n,field:"upper",band:.5},y:{signal:`height + ${a} + 2`},width:{value:2},height:{value:-6},fill:{field:"color"},fillOpacity:{signal:`${t}_selected ? 1.0 : 0.2`}}}}]},{name:`${t}_icon`,type:"path",from:{data:`${t}_aggregate`},encode:{enter:{stroke:{value:"transparent"},strokeWidth:{value:2},cursor:Ae(e)},update:{path:{signal:`datum.width > 0 ? '${V.ANNOTATION_RANGED_ICON_SVG}' : '${V.ANNOTATION_SINGLE_ICON_SVG}'`},fill:{field:"color"},xc:{scale:n,field:"center",band:.5},yc:{signal:`height + ${a}`},fillOpacity:{signal:`(${t}_selected && ${t}_selected != datum.center) ? 0.0 : 1.0`}}}}]}))(t,a))})(e,t,o)}))}));const fa=(e,t)=>e.map((e=>ya(e,t))),ya=(e,t)=>{var{UNSAFE_highlightBy:a="item"}=e,n=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]])}return a}(e,["UNSAFE_highlightBy"]);return Object.assign({UNSAFE_highlightBy:a,markName:t},n)},va=(e,t,a=!0)=>{const n=fa(t.chartPopovers,t.name);for(const{UNSAFE_highlightBy:r,markName:i}of n){const n=q(e);n.transform||(n.transform=[]),"dimension"===r&&"donut"!==t.markType?n.transform.push(ba([t.dimension],i)):"series"===r?n.transform.push(ba([V.SERIES_ID],i)):Array.isArray(r)?n.transform.push(ba(r,i)):n.transform.push(ba([t.idKey],i)),a&&e.push(Sa(i))}},ba=(e,t)=>({type:"formula",as:`${t}_selectedGroupId`,expr:e.map((e=>`datum.${e}`)).join(' + " | " + ')}),Sa=e=>({name:`${e}_selectedData`,source:V.FILTERED_TABLE,transform:[{type:"filter",expr:`${V.SELECTED_GROUP} === datum.${e}_selectedGroupId`}]});const Ea=e=>e.trendlines.map(((t,a)=>_a(e,t,a))),_a=(e,t,a)=>{var{chartTooltips:n=[],color:r,dimensionExtent:i,dimensionRange:o=[null,null],displayOnHover:s=!1,highlightRawPoint:l=!1,lineType:c="dashed",lineWidth:u="M",method:d="linear",opacity:m=1,orientation:p="horizontal",trendlineAnnotations:h=[]}=t,g=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]])}return a}(t,["chartTooltips","color","dimensionExtent","dimensionRange","displayOnHover","highlightRawPoint","lineType","lineWidth","method","opacity","orientation","trendlineAnnotations"]);const f=Ca(e,p),y="time"===f&&La(d)&&"horizontal"===p,{trendlineDimension:v,trendlineMetric:b}=$a(e.dimension,e.metric,p,y),S=r?{value:r}:Ta(e.color);return Object.assign({chartTooltips:n,colorScheme:e.colorScheme,displayOnHover:s,dimensionExtent:null!=i?i:o,dimensionRange:o,dimensionScaleType:f,highlightRawPoint:l,isDimensionNormalized:y,lineType:c,lineWidth:u,method:d,metric:V.TRENDLINE_VALUE,name:`${e.name}Trendline${a}`,opacity:m,orientation:p,trendlineAnnotations:h,trendlineColor:S,trendlineDimension:v,trendlineMetric:b},g)},Ta=e=>Array.isArray(e)?e[0]:e,Oa=e=>Array.isArray(e)?e[0]:e,$a=(e,t,a,n)=>"horizontal"===a?{trendlineDimension:xa(e,n),trendlineMetric:t}:{trendlineDimension:t,trendlineMetric:e},xa=(e,t)=>t?`${e}Normalized`:e,Ia=e=>["average","median"].includes(e),La=e=>Da(e)||["exponential","logarithmic","power"].includes(e),Aa=e=>e.startsWith("movingAverage-"),Da=e=>e.startsWith("polynomial-")||["linear","quadratic"].includes(e),Ra=e=>{switch(e){case"linear":return 1;case"quadratic":return 2}const t=parseInt(e.split("-")[1]);if(t<1)throw new Error(`Invalid polynomial order: ${t}, order must be an interger greater than 0`);return t},Ma=(e,t,a)=>{const n=`${t}_extent`;return{signal:`[${e.map(((e,t)=>{switch(e){case null:return`${n}[${t}]`;case"domain":return`${n}[${t}] ${0===t?"-":"+"} (${n}[1] - ${n}[0]) * 0.3`;default:return a?`(${e} - data('${V.FILTERED_TABLE}')[0].datetimeMin + ${V.MS_PER_DAY}) / ${V.MS_PER_DAY}`:e}})).join(", ")}]`}},Ca=(e,t)=>"vertical"===t?"linear":"scaleType"in e?e.scaleType:e.dimensionScaleType,Na=(e,{method:t,trendlineDimension:a,trendlineMetric:n},r)=>{const{color:i,lineType:o}=e,{facets:s}=te({color:i,lineType:o}),l={average:"mean",median:"median"};return r?{type:"aggregate",groupby:s,ops:[l[t],"min","max"],fields:[n,a,a],as:[V.TRENDLINE_VALUE,`${a}Min`,`${a}Max`]}:{type:"joinaggregate",groupby:s,ops:[l[t]],fields:[n],as:[V.TRENDLINE_VALUE]}},ja=(e,t,a)=>{const{color:n,lineType:r}=e,{dimensionExtent:i,isDimensionNormalized:o,method:s,name:l,trendlineDimension:c,trendlineMetric:u}=t,{facets:d}=te({color:n,lineType:r});let m,p;switch(s){case"exponential":m="exp";break;case"logarithmic":m="log";break;case"power":m="pow";break;default:p=Ra(s),m="poly"}return{type:"regression",method:m,order:p,groupby:d,x:c,y:u,as:a?[c,V.TRENDLINE_VALUE]:void 0,params:!a,extent:a?Ma(i,l,o):void 0}},ka=(e,{method:t,trendlineMetric:a})=>{const n=parseInt(t.split("-")[1]),{color:r,lineType:i}=e,{facets:o}=te({color:r,lineType:i});if(isNaN(n)||n<1)throw new Error(`Invalid moving average frame width: ${n}, frame width must be an integer greater than 0`);return{type:"window",ops:["mean"],groupby:o,fields:[a],as:[V.TRENDLINE_VALUE],frame:[n-1,0]}},Pa=e=>[{type:"joinaggregate",fields:[e],as:[`${e}Min`],ops:["min"]},{type:"formula",expr:`(datum.${e} - datum.${e}Min + ${V.MS_PER_DAY}) / ${V.MS_PER_DAY}`,as:`${e}Normalized`}],Ha=(e,t)=>({type:"extent",field:e,signal:`${t}_extent`}),wa=(e,t)=>{const a=[];return null!==t[0]&&a.push(`datum.${e} >= ${t[0]}`),null!==t[1]&&a.push(`datum.${e} <= ${t[1]}`),a.length?[{type:"filter",expr:a.join(" && ")}]:[]},Fa=(e,t)=>{let a="";if(Da(t)){const n=Ra(t);a=["datum.coef[0]",...Array(n).fill(0).map(((t,a)=>`datum.coef[${a+1}] * pow(datum.${e}, ${a+1})`))].join(" + ")}else"exponential"===t?a=`datum.coef[0] + exp(datum.coef[1] * datum.${e})`:"logarithmic"===t?a=`datum.coef[0] + datum.coef[1] * log(datum.${e})`:"power"===t&&(a=`datum.coef[0] * pow(datum.${e}, datum.coef[1])`);return a?[{type:"formula",expr:a,as:V.TRENDLINE_VALUE}]:[]},Ga=({color:e,lineType:t},{name:a})=>{const{facets:n}=te({color:e,lineType:t});return{type:"lookup",from:`${a}_params`,key:"keys",fields:n,values:["coef"]}},za=(e,t)=>{var a;e.push(...Ba(t));const n=X(e);n.transform=Ka(null!==(a=n.transform)&&void 0!==a?a:[],t)},Ba=e=>{const t=[],{color:a,idKey:n,lineType:r,name:i}=e,o=Ea(e),s={name:`${i}_allTrendlineData`,source:[]};for(const n of o){const{displayOnHover:i,method:o,name:l}=n,{facets:c}=te({color:a,lineType:r});La(o)?t.push(...Va(e,n,c)):Ia(o)?t.push(...Ua(e,n,c)):Aa(o)&&t.push(Wa(e,n)),i&&t.push(Xa(l,o)),Me(n)&&s.source.push(`${l}_data`)}return o.some((e=>Me(e)))&&(t.push(s),t.push(Ja(i,n))),t},Ua=(e,t,a)=>{const n=[],{dimensionRange:r,name:i,trendlineDimension:o}=t,s=wa(o,r);return n.push({name:`${i}_highResolutionData`,source:V.FILTERED_TABLE,transform:[...qa(t.excludeDataKeys),...s,...Ya(e,t,!0),...Z(a)]}),Me(t)&&n.push({name:`${i}_data`,source:V.FILTERED_TABLE,transform:[...s,...Ya(e,t,!1)]}),n},Va=(e,t,a)=>{const n=[],{dimension:r,metric:i}=e,{dimensionRange:o,method:s,name:l,orientation:c,trendlineDimension:u}=t,{trendlineDimension:d}=$a(r,i,c,!1),m=wa(d,o);return n.push({name:`${l}_highResolutionData`,source:V.FILTERED_TABLE,transform:[...qa(t.excludeDataKeys),...m,...Ya(e,t,!0),...Z(a)]}),Me(t)&&n.push({name:`${l}_params`,source:V.FILTERED_TABLE,transform:[...m,...Ya(e,t,!1)]},{name:`${l}_data`,source:V.FILTERED_TABLE,transform:[...m,Ga(e,t),...Fa(u,s)]}),n},Wa=(e,t)=>({name:`${t.name}_data`,source:V.FILTERED_TABLE,transform:[...qa(t.excludeDataKeys),...Ya(e,t,!1),...wa(e.dimension,t.dimensionRange)]}),Ja=(e,t)=>({name:`${e}Trendline_highlightedData`,source:`${e}_allTrendlineData`,transform:[{type:"filter",expr:`${V.SELECTED_ITEM} === datum.${t} || !isValid(${V.SELECTED_ITEM}) && (isArray(${V.HIGHLIGHTED_ITEM}) && indexof(${V.HIGHLIGHTED_ITEM}, datum.${t}) || ${V.HIGHLIGHTED_ITEM} === datum.${t})`}]}),Ya=(e,t,a)=>{const{method:n,trendlineDimension:r}=t;return Ia(n)?[Na(e,t,a)]:La(n)?[ja(e,t,a)]:Aa(n)?[(i=r,{type:"collect",sort:{field:i}}),ka(e,t)]:[];var i},Ka=U(((e,t)=>{const{dimension:a,metric:n}=t,r=Ea(t);for(const{isDimensionNormalized:t,method:i,name:o,orientation:s,trendlineDimension:l}of r)if(La(i)){const{trendlineDimension:r}=$a(a,n,s,!1);t&&(e.some((e=>"as"in e&&e.as===`${r}Normalized`))||e.push(...Pa(r))),e.push(Ha(l,o))}})),Xa=(e,t)=>({name:`${e}_highlightedData`,source:Aa(t)?`${e}_data`:`${e}_highResolutionData`,transform:[{type:"filter",expr:`datum.${V.SERIES_ID} === ${V.HIGHLIGHTED_SERIES} || datum.${V.SERIES_ID} === ${V.SELECTED_SERIES}`}]}),qa=e=>{var t;return null!==(t=null==e?void 0:e.map((e=>({type:"filter",expr:`!datum.${e}`}))))&&void 0!==t?t:[]},Za=e=>`datum.${e} && datum.${e} === true`,Qa=(e,t)=>`(${V.SELECTED_ITEM} && ${V.SELECTED_ITEM} === datum.${t}) || (${V.SELECTED_GROUP} && ${V.SELECTED_GROUP} === datum.${e}_selectedGroupId)`,en=e=>{const{dimension:t,metric:a,metricAxis:n,name:r,scaleType:i}=e;return{name:`${r}_pointBackground`,description:`${r}_pointBackground`,type:"symbol",from:{data:`${r}_highlightedData`},interactive:!1,encode:{enter:{y:Ge(n,a),fill:{signal:V.BACKGROUND_COLOR},stroke:{signal:V.BACKGROUND_COLOR}},update:{size:cn(e),strokeWidth:un(e),x:Fe(i,t)}}}},tn=(e,t=!0)=>{const{color:a,colorScheme:n,dimension:r,metric:i,metricAxis:o,name:s,scaleType:l}=e;return{name:`${s}_point_${t?"highlight":"select"}`,type:"symbol",from:{data:`${s}${t?"_highlightedData":"_selectedData"}`},interactive:!1,encode:{enter:{y:Ge(o,i),stroke:je(a,n)},update:{fill:on(e),size:cn(e),stroke:sn(e),strokeOpacity:ln(e),strokeWidth:un(e),x:Fe(l,r)}}}},an=e=>tn(e,!0),nn=e=>tn(e,!1),rn=(e,t)=>{const{color:a,colorScheme:n,dimension:r,metricAxis:i,name:o,scaleType:s}=e;return{name:`${o}_secondaryPoint`,type:"symbol",from:{data:`${o}_highlightedData`},interactive:!1,encode:{enter:{y:Ge(i,t),fill:{signal:V.BACKGROUND_COLOR},stroke:je(a,n)},update:{x:Fe(s,r)}}}},on=e=>{const{color:t,colorScheme:a,idKey:n,name:r,staticPoint:i}=e,o=[],s=Qa(r,n);return i&&o.push(Object.assign({test:Za(i)},je(t,a))),Ce(e)&&o.push(Object.assign({test:s},je(t,a))),[...o,{signal:V.BACKGROUND_COLOR}]},sn=e=>{const{color:t,colorScheme:a,idKey:n,name:r,staticPoint:i}=e,o=[],s=Qa(r,n);return i&&o.push(Object.assign({test:Za(i)},je(t,a))),Ce(e)&&o.push({test:s,signal:V.BACKGROUND_COLOR}),[...o,je(t,a)]},ln=({opacity:e,staticPoint:t})=>{const a=Pe(e),n=[];return t&&n.push(Object.assign({test:Za(t)},((e=V.DEFAULT_OPACITY_RULE)=>"signal"in e?{signal:`${e.signal} / ${V.HIGHLIGHT_CONTRAST_RATIO}`}:{value:e.value/V.HIGHLIGHT_CONTRAST_RATIO})(a))),[...n,a]},cn=({staticPoint:e})=>{const t=[];return e&&t.push({test:Za(e),value:64}),[...t,{value:V.DEFAULT_SYMBOL_SIZE}]},un=({staticPoint:e})=>{const t=[];return e&&t.push({test:Za(e),value:6}),[...t,{value:V.DEFAULT_SYMBOL_STROKE_WIDTH}]},dn=e=>{const{colorScheme:t,dimension:a,idKey:n,metric:r,metricAxis:i,name:o,scaleType:s}=e,l=Qa(o,n);return{name:`${o}_pointSelectRing`,type:"symbol",from:{data:`${o}_selectedData`},interactive:!1,encode:{enter:{y:Ge(i,r),fill:{signal:V.BACKGROUND_COLOR},stroke:{value:(0,W.getColorValue)("static-blue",t)}},update:{size:[{test:l,value:196},{value:0}],strokeWidth:[{test:l,value:V.DEFAULT_SYMBOL_STROKE_WIDTH},{value:0}],x:Fe(s,a)}}}},mn=(e,t)=>{const{chartPopovers:a,color:n,colorScheme:r,dimension:i,lineType:o,lineWidth:s,metric:l,metricAxis:c,name:u,opacity:d,scaleType:m}=e,p=fa(null!=a?a:[],u).some((({UNSAFE_highlightBy:e})=>"dimension"===e));return{name:u,description:u,type:"line",from:{data:t},interactive:!1,encode:{enter:{y:Ge(c,l),stroke:je(n,r),strokeDash:we(o),strokeOpacity:Pe(d),strokeWidth:ke(s)},update:Object.assign({x:Fe(m,i)},p?{}:{opacity:pn(e)})}}},pn=({displayOnHover:e,interactiveMarkName:t,popoverMarkName:a,isHighlightedByGroup:n,highlightedItem:r})=>{if((!t||e)&&void 0===r)return[V.DEFAULT_OPACITY_RULE];const i=[];return n&&i.push({test:`indexof(pluck(data('${t}_highlightedData'), '${V.SERIES_ID}'), datum.${V.SERIES_ID}) !== -1`,value:1}),i.push({test:`isValid(${V.HIGHLIGHTED_SERIES}) && ${V.HIGHLIGHTED_SERIES} !== datum.${V.SERIES_ID}`,value:1/V.HIGHLIGHT_CONTRAST_RATIO},{test:`length(data('${t}_highlightedData')) > 0 && indexof(pluck(data('${t}_highlightedData'), '${V.SERIES_ID}'), datum.${V.SERIES_ID}) === -1`,value:1/V.HIGHLIGHT_CONTRAST_RATIO}),a&&i.push({test:`isValid(${V.SELECTED_SERIES}) && ${V.SELECTED_SERIES} !== datum.${V.SERIES_ID}`,value:1/V.HIGHLIGHT_CONTRAST_RATIO}),i.push(V.DEFAULT_OPACITY_RULE),i},hn=(e,t,a)=>{const{dimension:n,name:r,scaleType:i}=e;return[gn(n,r,i),en(e),...Ce(e)?[dn(e),nn(e)]:[],an(e),...a?[rn(e,a)]:[],...fn(t,e)]},gn=(e,t,a)=>({name:`${t}_hoverRule`,description:`${t}_hoverRule`,type:"rule",from:{data:`${t}_highlightedData`},interactive:!1,encode:{enter:{y:{value:0},y2:{signal:"height"},strokeWidth:{value:1}},update:{x:Fe(a,e),opacity:{signal:`length(data('${t}_selectedData')) > 0 ? 0 : 1`}}}}),fn=(e,t)=>{const{interactionMode:a=V.DEFAULT_INTERACTION_MODE}=t;return{nearest:yn,item:vn}[a](t,e)},yn=(e,t)=>{const{dimension:a,metric:n,metricAxis:r,name:i,scaleType:o}=e;return[ze(t,a,n,i,o,r),Be(e,`${i}_pointsForVoronoi`)]},vn=(e,t)=>{const{chartTooltips:a=[],dimension:n,metric:r,metricAxis:i,name:o,scaleType:s}=e;return[Ue(a,t,n,r,o,s,i)]},bn=(e,t)=>{const a=[];return((e,t)=>e.trendlineAnnotations.map(((a,n)=>(({badge:e=!1,dimensionValue:t="end",numberFormat:a="",prefix:n=""},r,{colorScheme:i,dimensionExtent:o,dimensionScaleType:s,displayOnHover:l,lineWidth:c,orientation:u,trendlineColor:d,trendlineDimension:m,name:p},h)=>({badge:e,colorScheme:i,dimensionValue:t,displayOnHover:l,markName:h,name:`${p}Annotation${r}`,numberFormat:a,prefix:n,trendlineColor:d,trendlineDimension:m,trendlineDimensionExtent:o,trendlineDimensionScaleType:s,trendlineName:p,trendlineOrientation:u,trendlineWidth:re(c)}))(a,n,e,t))))(e,t).forEach((e=>{a.push({name:`${e.name}_group`,type:"group",interactive:!1,marks:[Sn(e),Tn(e),...$n(e)]})})),a},Sn=e=>{const{name:t,trendlineName:a,trendlineWidth:n,displayOnHover:r}=e;return{name:`${t}_points`,type:"symbol",from:{data:r?`${a}_highlightedData`:`${a}_highResolutionData`},interactive:!1,encode:{enter:{opacity:{value:0},size:{value:Math.pow(n,2)},x:En(e),y:_n(e)}}}},En=({dimensionValue:e,trendlineDimension:t,trendlineDimensionExtent:a,trendlineDimensionScaleType:n,trendlineOrientation:r})=>{const i=xe("x",n);if("vertical"===r)return{scale:i,field:V.TRENDLINE_VALUE};switch(e){case"start":return Mn(a[0],t,i,"x");case"end":return Cn(a[1],t,i,"x");default:return{scale:i,value:e}}},_n=({dimensionValue:e,trendlineDimension:t,trendlineDimensionExtent:a,trendlineOrientation:n})=>{const r="yLinear";if("horizontal"===n)return{scale:r,field:V.TRENDLINE_VALUE};switch(e){case"start":return Mn(a[0],t,r,"y");case"end":return Cn(a[1],t,r,"y");default:return{scale:r,value:e}}},Tn=e=>{const{name:t,numberFormat:a,prefix:n,trendlineName:r,markName:i}=e,o=n?`'${n} ' + `:"",s=On(Object.assign({},e));return{name:t,type:"text",from:{data:`${t}_points`},zindex:1,interactive:!1,encode:{enter:{text:{signal:`${o}format(datum.datum.${V.TRENDLINE_VALUE}, '${a}')`},fill:s}},transform:[{type:"label",size:{signal:"[width, height]"},avoidMarks:[r,`${i}_group`],offset:[6,6,6,6,8.49,8.49,8.49,8.49],anchor:["top","bottom","right","left","top-right","top-left","bottom-right","bottom-left"]}]}},On=({badge:e,colorScheme:t,trendlineColor:a})=>{if(!e)return;const n=((e,t,a="ordinal")=>{const n=je(e,t,a);return"signal"in n?n.signal:"scale"in n&&"field"in n?`scale('${n.scale}', datum.${n.field})`:"value"in n&&n.value?`'${n.value}'`:""})(xn(a),t),r=[(0,W.getColorValue)("gray-50",t),(0,W.getColorValue)("gray-900",t)];return[{test:`contrast(${n}, '${r[0]}') >= 4.5`,value:r[0]},{value:r[1]}]},$n=({badge:e,colorScheme:t,name:a,trendlineColor:n})=>{if(!e)return[];const r=xn(n,2);return[{name:`${a}_badge`,description:`${a}_badge`,type:"rect",from:{data:`${a}`},interactive:!1,encode:{enter:{cornerRadius:{value:2},fill:je(r,t),opacity:{field:"opacity"},x:{signal:"datum.bounds.x1 - 3"},x2:{signal:"datum.bounds.x2 + 3"},y:{signal:"datum.bounds.y1 - 3"},y2:{signal:"datum.bounds.y2 + 3"}}}}]},xn=(e,t=1)=>"string"==typeof e?`${new Array(t).fill("datum.").join("")}${e}`:e,In=e=>{const{color:t,lineType:a}=e,{facets:n}=te({color:t,lineType:a}),r=[],i=Ea(e);for(const t of i){const{displayOnHover:a,method:i,name:o}=t;if(Ia(i))r.push(An(e,t));else{const s=Ln(o,i,a);r.push({name:`${o}_group`,type:"group",clip:!0,from:{facet:{name:`${o}_facet`,data:s,groupby:n}},marks:[Nn(e,t)]})}r.push(...bn(t,e.name))}return i.some((e=>Ne(e)))&&r.push(Pn(e,i.some((e=>e.highlightRawPoint)))),r},Ln=(e,t,a)=>a?`${e}_highlightedData`:La(t)?`${e}_highResolutionData`:`${e}_data`,An=(e,t)=>{const{colorScheme:a}=e,{dimensionExtent:n,dimensionScaleType:r,displayOnHover:i,lineType:o,lineWidth:s,name:l,orientation:c,trendlineColor:u,trendlineDimension:d}=t;return{name:l,type:"rule",clip:!0,from:{data:i?`${l}_highlightedData`:`${l}_highResolutionData`},interactive:!1,encode:{enter:Object.assign(Object.assign({},Dn(n,d,c)),{stroke:je(u,a),strokeDash:we({value:o}),strokeOpacity:Pe({value:t.opacity}),strokeWidth:ke({value:s})}),update:Object.assign(Object.assign({},Rn(n,d,r,c)),{opacity:pn(Hn(e,t))})}}},Dn=(e,t,a)=>"horizontal"===a?{y:{scale:"yLinear",field:V.TRENDLINE_VALUE}}:{y:Mn(e[0],t,"yLinear","y"),y2:Cn(e[1],t,"yLinear","y")},Rn=(e,t,a,n)=>{const r=xe("x",a);return"vertical"===n?{x:{scale:r,field:V.TRENDLINE_VALUE}}:{x:Mn(e[0],t,r,"x"),x2:Cn(e[1],t,r,"x")}},Mn=(e,t,a,n)=>{switch(e){case null:return{scale:a,field:`${t}Min`};case"domain":return"x"===n?{value:0}:{signal:"height"};default:return{scale:a,value:e}}},Cn=(e,t,a,n)=>{switch(e){case null:return{scale:a,field:`${t}Max`};case"domain":return"x"===n?{signal:"width"}:{value:0};default:return{scale:a,value:e}}},Nn=(e,t)=>{const{colorScheme:a}=e,{dimensionScaleType:n,isDimensionNormalized:r,lineType:i,lineWidth:o,name:s,orientation:l,trendlineColor:c,trendlineDimension:u}=t;return{name:s,type:"line",from:{data:`${s}_facet`},interactive:!1,encode:{enter:{y:jn(u,l),stroke:je(c,a),strokeDash:we({value:i}),strokeOpacity:Pe({value:t.opacity}),strokeWidth:ke({value:o})},update:{x:kn(u,n,l,r),opacity:pn(Hn(e,t))}}}},jn=(e,t)=>{const a="yLinear";return"horizontal"===t?{scale:a,field:V.TRENDLINE_VALUE}:{scale:a,field:e}},kn=(e,t,a,n)=>{const r=xe("x",t);return"vertical"===a?{scale:r,field:V.TRENDLINE_VALUE}:n?{scale:"xTrendline",field:e}:{scale:r,field:e}},Pn=(e,t)=>{const{metric:a,name:n}=e,r=Ea(e),i=Hn(e,r[0],{name:`${n}Trendline`,chartTooltips:r.map((e=>e.chartTooltips)).flat(),metric:V.TRENDLINE_VALUE});return{name:`${n}Trendline_hoverGroup`,type:"group",clip:!0,marks:hn(i,`${n}_allTrendlineData`,t?a:void 0)}},Hn=(e,{dimensionScaleType:t,displayOnHover:a,lineWidth:n,metric:r,name:i,opacity:o},s)=>{const{color:l,lineType:c}=e,u="popoverMarkName"in e?e.popoverMarkName:void 0,d="staticPoint"in e?e.staticPoint:void 0;return Object.assign(Object.assign(Object.assign({},e),{color:Ta(l),displayOnHover:a,lineType:Oa(c),lineWidth:{value:n},metric:r,name:i,opacity:{value:o},popoverMarkName:u,scaleType:t,staticPoint:d}),s)},wn=e=>{const{dimension:t}=e;return Ea(e).some((({dimensionScaleType:e,method:t})=>La(t)&&"time"===e))?[{name:"xTrendline",type:"linear",range:"width",domain:{data:V.FILTERED_TABLE,fields:[`${t}Normalized`]},padding:V.LINEAR_PADDING,zero:!1,nice:!1}]:[]},Fn=(e,t)=>{const{idKey:a,name:n}=t,r=Ea(t);r.some((e=>Ne(e)))&&(lt(e,`${n}Trendline_voronoi`,a,2),ct(e,`${n}Trendline_voronoi`,2)),r.some((e=>e.displayOnHover))&&ct(e,`${n}_voronoi`,2)},Gn=({trellisOrientation:e,name:t,trellisPadding:a})=>{const n="horizontal"===e?"x":"y";return{facetName:`${t}_trellis`,scaleName:`${n}TrellisBand`,markName:`${n}TrellisGroup`,rangeScale:"x"===n?"width":"height",axis:n,paddingInner:a}},zn=e=>Boolean(e.trellis),Bn=({color:e,lineType:t,opacity:a})=>[e,t,a].some((e=>Array.isArray(e)&&2===e.length)),Un=e=>{const{dualMetricAxis:t,type:a}=e;return Boolean(t&&!zn(e)&&"dodged"===a&&!Bn(e))},Vn=e=>{const{dimension:t,groupedPadding:a,orientation:n,name:r,paddingRatio:i}=e,{dimensionScaleKey:o,dimensionAxis:s,rangeScale:l}=tr(n);return{name:`${r}_group`,type:"group",from:{facet:{data:zn(e)?Gn(e).facetName:V.FILTERED_TABLE,name:`${r}_facet`,groupby:t}},encode:{enter:{[s]:{scale:o,field:t}}},signals:[{name:l,update:`bandwidth("${o}")`}],scales:[{name:`${r}_position`,type:"band",range:l,domain:{data:V.FILTERED_TABLE,field:`${r}_dodgeGroup`},paddingInner:null!=a?a:i}]}},Wn=e=>{const{dimensionAxis:t,rangeScale:a}=tr(e.orientation),n=`${e.name}_position`;return{[t]:{scale:n,field:`${e.name}_dodgeGroup`},[a]:{scale:n,band:1}}},Jn=e=>Object.assign(Object.assign({},(e=>{const{metric:t,type:a}=e,{metricAxis:n,metricScaleKey:r}=tr(e.orientation,e.metricAxis),i=`${n}2`;return"stacked"===a||Bn(e)?(e=>{const{metric:t,orientation:a}=e,{metricAxis:n,metricScaleKey:r}=tr(e.orientation,e.metricAxis),i=`${n}2`,o=`datum.${t}0`,s=`datum.${t}1`;return"vertical"===a?{[n]:[{test:`${o} === 0`,signal:`scale('${r}', ${o})`},{test:`${s} > 0`,signal:`max(scale('${r}', ${o}) - 1.5, scale('${r}', ${s}))`},{signal:`min(scale('${r}', ${o}) + 1.5, scale('${r}', ${s}))`}],[i]:{scale:r,field:`${t}1`}}:{[n]:[{test:`${o} === 0`,signal:`scale('${r}', ${o})`},{test:`${s} > 0`,signal:`min(scale('${r}', ${o}) + 1.5, scale('${r}', ${s}))`},{signal:`max(scale('${r}', ${o}) - 1.5, scale('${r}', ${s}))`}],[i]:{scale:r,field:`${t}1`}}})(e):Un(e)?{[n]:[{test:`datum.${V.SERIES_ID} === ${V.LAST_RSC_SERIES_ID}`,scale:`${r}Secondary`,value:0},{scale:`${r}Primary`,value:0}],[i]:[{test:`datum.${V.SERIES_ID} === ${V.LAST_RSC_SERIES_ID}`,scale:`${r}Secondary`,field:t},{scale:`${r}Primary`,field:t}]}:{[n]:{scale:r,value:0},[i]:{scale:r,field:t}}})(e)),(e=>{const{type:t,lineWidth:a,metric:n,hasSquareCorners:r}=e,i=r?0:Math.max(1,V.CORNER_RADIUS-re(a)/2);let o;return o="dodged"!==t||Bn(e)?(({name:e,metric:t,lineWidth:a,hasSquareCorners:n})=>{const r=`datum.${t}1 > 0 && data('${e}_stacks')[indexof(pluck(data('${e}_stacks'), '${V.STACK_ID}'), datum.${V.STACK_ID})].max_${t}1 === datum.${t}1`,i=`datum.${t}1 < 0 && data('${e}_stacks')[indexof(pluck(data('${e}_stacks'), '${V.STACK_ID}'), datum.${V.STACK_ID})].min_${t}1 === datum.${t}1`,o=n?0:Math.max(1,V.CORNER_RADIUS-re(a)/2);return{cornerRadiusTopLeft:[{test:r,value:o},{value:0}],cornerRadiusTopRight:[{test:r,value:o},{value:0}],cornerRadiusBottomLeft:[{test:i,value:o},{value:0}],cornerRadiusBottomRight:[{test:i,value:o},{value:0}]}})(e):{cornerRadiusTopLeft:[{test:`datum.${n} > 0`,value:i},{value:0}],cornerRadiusTopRight:[{test:`datum.${n} > 0`,value:i},{value:0}],cornerRadiusBottomLeft:[{test:`datum.${n} < 0`,value:i},{value:0}],cornerRadiusBottomRight:[{test:`datum.${n} < 0`,value:i},{value:0}]},((e,{orientation:t})=>"vertical"===t?e:{cornerRadiusTopLeft:e.cornerRadiusBottomLeft,cornerRadiusTopRight:e.cornerRadiusTopLeft,cornerRadiusBottomLeft:e.cornerRadiusBottomRight,cornerRadiusBottomRight:e.cornerRadiusTopRight})(o,e)})(e)),Yn=({chartTooltips:e,color:t,colorScheme:a,name:n,opacity:r})=>({fill:je(t,a),fillOpacity:Pe(r),tooltip:De(e,n)}),Kn=e=>({cursor:Ae(e.chartPopovers,e.hasOnClick),opacity:Ke(e),stroke:Xn(e),strokeDash:qn(e),strokeWidth:Zn(e)}),Xn=({name:e,chartPopovers:t,color:a,colorScheme:n,idKey:r})=>{const i=je(a,n);return Ce({chartPopovers:t})?[{test:`(${V.SELECTED_ITEM} && ${V.SELECTED_ITEM} === datum.${r}) || (${V.SELECTED_GROUP} && ${V.SELECTED_GROUP} === datum.${e}_selectedGroupId)`,value:(0,W.getColorValue)("static-blue",n)},i]:[i]},qn=({chartPopovers:e,idKey:t,lineType:a})=>{const n=we(a);return Ce({chartPopovers:e})?[{test:`isValid(${V.SELECTED_ITEM}) && ${V.SELECTED_ITEM} === datum.${t}`,value:[]},n]:[n]},Zn=({chartPopovers:e,idKey:t,lineWidth:a,name:n})=>{const r=re(a),i={value:r},o=fa(e,n),s=o.some((({UNSAFE_highlightBy:e})=>"dimension"===e));return 0===o.length||s?[i]:[{test:`(isValid(${V.SELECTED_ITEM}) && ${V.SELECTED_ITEM} === datum.${t}) || (isValid(${V.SELECTED_GROUP}) && ${V.SELECTED_GROUP} === datum.${n}_selectedGroupId)`,value:Math.max(r,2)},i]},Qn=(e,t)=>$e(e,t),er=e=>"stacked"===e.type||Bn(e)?[`${e.metric}1`]:[e.metric],tr=(e,t)=>"vertical"===e?{metricAxis:"y",dimensionAxis:"x",metricScaleKey:t||"yLinear",dimensionScaleKey:"xBand",rangeScale:"width"}:{metricAxis:"x",dimensionAxis:"y",metricScaleKey:t||"xLinear",dimensionScaleKey:"yBand",rangeScale:"height"},ar=e=>{const{metricAxis:t,orientation:a}=e,{metricScaleKey:n}=tr(a);return t||n};const nr=(e,t,a,n,r)=>{var{textKey:i}=e,o=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]])}return a}(e,["textKey"]);return Object.assign({barOptions:t,textKey:i||t.metric,dataName:a,dimensionScaleName:n,dimensionField:r},o)},rr=(e,t,a,n)=>{const r=((e,t,a,n)=>{const r=e.barAnnotations[0];if(r)return nr(r,e,t,a,n)})(e,t,a,n);return r?[{type:"group",name:`${e.name}_annotationGroup`,marks:[ir(r),or(r)]}]:[]},ir=({barOptions:e,dataName:t,dimensionField:a,dimensionScaleName:n,textKey:r,style:i})=>{const{metricAxis:o,dimensionAxis:s}=tr(e.orientation),l=cr(r,i),c=ur(e,l);return{name:`${e.name}_annotationText`,type:"text",from:{data:t},interactive:!1,zindex:1,encode:{enter:{[s]:{scale:n,field:a,band:.5},[o]:c,text:[{test:`bandwidth('${n}') > ${sr(e.orientation)}`,field:r}],fontSize:{value:V.ANNOTATION_FONT_SIZE},fontWeight:{value:V.ANNOTATION_FONT_WEIGHT},baseline:{value:"middle"},align:{value:"center"}}}}},or=({barOptions:e,dimensionScaleName:t,textKey:a,style:n})=>({name:`${e.name}_annotationBackground`,description:`${e.name}_annotationBackground`,type:"rect",from:{data:`${e.name}_annotationText`},interactive:!1,encode:{enter:Object.assign(Object.assign({},lr(null==n?void 0:n.width)),{y:{signal:`datum.bounds.y1 - ${V.ANNOTATION_PADDING}`},y2:{signal:`datum.bounds.y2 + ${V.ANNOTATION_PADDING}`},cornerRadius:{value:4},fill:[{test:`datum.datum.${a} && bandwidth('${t}') > ${sr(e.orientation)}`,signal:V.BACKGROUND_COLOR}]})}}),sr=e=>"vertical"===e?48:V.ANNOTATION_FONT_SIZE+2*V.ANNOTATION_PADDING,lr=e=>e?{xc:{signal:"(datum.bounds.x1 + datum.bounds.x2) / 2"},width:{value:e}}:{x:{signal:`datum.bounds.x1 - ${V.ANNOTATION_PADDING}`},x2:{signal:`datum.bounds.x2 + ${V.ANNOTATION_PADDING}`}},cr=(e,t)=>(null==t?void 0:t.width)?{value:t.width}:{signal:`getLabelWidth(datum.${e}, '${V.ANNOTATION_FONT_WEIGHT}', ${V.ANNOTATION_FONT_SIZE}) + ${2*V.ANNOTATION_PADDING}`},ur=(e,t)=>{const{type:a,metric:n,orientation:r}=e,i="stacked"===a||Bn(e)?`${n}1`:n,{metricScaleKey:o}=tr(r),s=(({orientation:e},t)=>"vertical"===e?""+((2*V.ANNOTATION_PADDING+V.ANNOTATION_FONT_SIZE)/2+2.5):"value"in t?""+(t.value/2+2.5):`((${t.signal}) / 2 + 2.5)`)(e,t);return"vertical"===r?[{test:`datum.${i} < 0`,signal:`max(scale('${o}', datum.${i}), scale('${o}', 0) + ${s})`},{signal:`min(scale('${o}', datum.${i}), scale('${o}', 0) - ${s})`}]:[{test:`datum.${i} < 0`,signal:`min(scale('${o}', datum.${i}), scale('${o}', 0) - ${s})`},{signal:`max(scale('${o}', datum.${i}), scale('${o}', 0) + ${s})`}]},dr=e=>{const{name:t}=e;return{name:`${t}_background`,description:`${t}_background`,type:"rect",from:{data:Bn(e)?`${t}_facet`:hr(e)},interactive:!1,encode:{enter:Object.assign(Object.assign({},Jn(e)),{fill:{signal:V.BACKGROUND_COLOR}}),update:Object.assign({},pr(e))}}},mr=e=>{const{name:t}=e;return{name:t,description:t,type:"rect",from:{data:Bn(e)?`${t}_facet`:hr(e)},interactive:Me(e),encode:{enter:Object.assign(Object.assign({},Jn(e)),Yn(e)),update:Object.assign(Object.assign({},pr(e)),Kn(e))}}},pr=e=>{const{dimension:t,orientation:a}=e;if(Bn(e))return Wn(e);const{dimensionAxis:n,rangeScale:r,dimensionScaleKey:i}=tr(a);return{[n]:{scale:i,field:t},[r]:{scale:i,band:1}}},hr=e=>zn(e)?Gn(e).facetName:V.FILTERED_TABLE;const gr=U(((e,t)=>{var a,n,r,i,{barAnnotations:o=[],chartPopovers:s=[],chartTooltips:l=[],color:c={value:"categorical-100"},colorScheme:u=V.DEFAULT_COLOR_SCHEME,dimension:d=V.DEFAULT_CATEGORICAL_DIMENSION,dualMetricAxis:m=!1,hasOnClick:p=!1,hasSquareCorners:h=!1,index:g=0,lineType:f={value:"solid"},lineWidth:y=0,metric:v=V.DEFAULT_METRIC,metricAxis:b,name:S,opacity:E={value:1},orientation:_="vertical",paddingRatio:T=V.PADDING_RATIO,trellisOrientation:O="horizontal",trellisPadding:$=V.TRELLIS_PADDING,type:x="stacked",trendlines:I=[]}=t,L=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]])}return a}(t,["barAnnotations","chartPopovers","chartTooltips","color","colorScheme","dimension","dualMetricAxis","hasOnClick","hasSquareCorners","index","lineType","lineWidth","metric","metricAxis","name","opacity","orientation","paddingRatio","trellisOrientation","trellisPadding","type","trendlines"]);const A=(0,J.toCamelCase)(S||`bar${g}`),D=Object.assign({barAnnotations:o,chartPopovers:s,chartTooltips:l,dimensionScaleType:"band",dualMetricAxis:m,orientation:_,color:c,colorScheme:u,dimension:d,hasOnClick:p,hasSquareCorners:h,index:g,interactiveMarkName:Xe({chartPopovers:s,chartTooltips:l,hasOnClick:p,highlightedItem:L.highlightedItem,trendlines:I},A),lineType:f,lineWidth:y,metric:v,metricAxis:b,name:A,opacity:E,paddingRatio:T,trellisOrientation:O,trellisPadding:$,trendlines:I,type:x},L);e.usermeta={chartOrientation:D.orientation},e.data=yr(null!==(a=e.data)&&void 0!==a?a:[],D),e.signals=fr(null!==(n=e.signals)&&void 0!==n?n:[],D),e.scales=Tr(null!==(r=e.scales)&&void 0!==r?r:[],D),e.marks=xr(null!==(i=e.marks)&&void 0!==i?i:[],D)})),fr=U(((e,t)=>{var a;const{barAnnotations:n,chartTooltips:r,chartPopovers:i,idKey:o,name:s,paddingRatio:l,paddingOuter:c,trendlines:u}=t,{paddingInner:d}=Qn(l,c);var m;e.push(st("paddingInner",d)),Un(t)&&e.push({name:`${V.FIRST_RSC_SERIES_ID}`,value:null,update:`length(domain("${V.COLOR_SCALE}")) > 0 ? domain("${V.COLOR_SCALE}")[0] : null`},{name:`${V.LAST_RSC_SERIES_ID}`,value:null,update:`length(domain("${V.COLOR_SCALE}")) > 0 ? peek(domain("${V.COLOR_SCALE}")) : null`},(m=s,{name:`${V.MOUSE_OVER_SERIES}`,value:null,on:[{events:`@${m}:mouseover`,update:`datum.${V.SERIES_ID}`},{events:`@${m}:mouseout`,update:"null"}]})),(n.length||i.length||r.length||u.length)&&(lt(e,s,o,1,null===(a=r[0])||void 0===a?void 0:a.excludeDataKeys),nt(e,t),Fn(e,t))})),yr=U(((e,t)=>{var a,n,r,i,o;const{dimension:s,dimensionDataType:l,metric:c,order:u,type:d}=t;if(l===V.TIME){const t=X(e);t.transform=Y(null!==(a=t.transform)&&void 0!==a?a:[],s)}const m=e.findIndex((e=>e.name===V.FILTERED_TABLE));e[m].transform=null!==(n=e[m].transform)&&void 0!==n?n:[],("stacked"===d||Bn(t))&&(null===(r=e[m].transform)||void 0===r||r.push({type:"stack",groupby:Sr(t),field:c,sort:K(u),as:[`${c}0`,`${c}1`]}),null===(i=e[m].transform)||void 0===i||i.push(br(t)),e.push(vr(t))),("dodged"===d||Bn(t))&&(null===(o=e[m].transform)||void 0===o||o.push(Er(t))),_r(e,t),za(e,t),Qe(e,t),va(e,t)})),vr=e=>{const{metric:t,name:a}=e;return{name:`${a}_stacks`,source:V.FILTERED_TABLE,transform:[{type:"aggregate",groupby:Sr(e),fields:[`${t}1`,`${t}1`],ops:["min","max"]},br(e)]}},br=e=>({type:"formula",as:V.STACK_ID,expr:Sr(e).map((e=>`datum.${e}`)).join(' + "," + ')}),Sr=({trellis:e,color:t,dimension:a,lineType:n,opacity:r,type:i})=>{const{facets:o,secondaryFacets:s}=te({color:t,lineType:n,opacity:r});return[...e?[e]:[],a,..."dodged"===i?o:[],..."stacked"===i?s:[]]},Er=({color:e,lineType:t,name:a,opacity:n,type:r})=>{const{facets:i,secondaryFacets:o}=te({color:e,lineType:t,opacity:n});return{type:"formula",as:`${a}_dodgeGroup`,expr:("dodged"===r?i:o).map((e=>`datum.${e}`)).join(' + "," + ')}},_r=(e,t)=>{if(Un(t)){const a=It(ar(t));a.primaryDomain&&a.secondaryDomain&&(e.push({name:a.primaryDomain,source:V.FILTERED_TABLE,transform:[{type:"filter",expr:`datum.${V.SERIES_ID} !== ${V.LAST_RSC_SERIES_ID}`}]}),e.push({name:a.secondaryDomain,source:V.FILTERED_TABLE,transform:[{type:"filter",expr:`datum.${V.SERIES_ID} === ${V.LAST_RSC_SERIES_ID}`}]}))}},Tr=U(((e,t)=>{const{color:a,lineType:n,opacity:r,metricAxis:i}=t,{metricAxis:o}=tr(t.orientation);if(Se(e,er(t),o),i&&Se(e,er(t),o,i),Un(t)){const a=It(ar(t));Se(e,er(t),o,a.primaryScale,a.primaryDomain),Se(e,er(t),o,a.secondaryScale,a.secondaryDomain)}Or(e,t),((e,t)=>{if(!t.trellis)return;const{scaleName:a,rangeScale:n,paddingInner:r}=Gn(t),i=fe(e,a,"band");e[i]=ye(e[i],[t.trellis]),e[i]=Object.assign(Object.assign({},e[i]),{range:n,paddingInner:r})})(e,t),Ee(e,V.COLOR_SCALE,a),Ee(e,V.LINE_TYPE_SCALE,n),Ee(e,V.OPACITY_SCALE,r),$r(e,t)})),Or=(e,{dimension:t,paddingRatio:a,paddingOuter:n,orientation:r})=>{const{dimensionAxis:i}=tr(r),o=ge(e,"band",i);e[o]=ye(e[o],[t]);const{paddingInner:s,paddingOuter:l}=Qn(a,n);e[o]=Object.assign(Object.assign({},e[o]),{paddingInner:s,paddingOuter:l})},$r=(e,t)=>{const{color:a,lineType:n,opacity:r}=t;Bn(t)&&[{value:a,scaleName:"colors",secondaryScaleName:"secondaryColor"},{value:n,scaleName:"lineTypes",secondaryScaleName:"secondaryLineType"},{value:r,scaleName:"opacities",secondaryScaleName:"secondaryOpacity"}].forEach((({value:t,scaleName:a,secondaryScaleName:n})=>{if(Array.isArray(t)&&2===t.length){const r=fe(e,n,"ordinal");e[r]=ye(e[r],[t[1]]);const i=fe(e,a,"ordinal"),o=e[i];o.range={signal:a},e[i]=ye(o,[t[0]])}}))},xr=U(((e,t)=>{const{chartPopovers:a,name:n,type:r}=t,i=[];if(Bn(t)?i.push((e=>{const t=[];return t.push(dr(e)),t.push(mr(e)),t.push(...rr(e,`${e.name}_facet`,`${e.name}_position`,`${e.name}_dodgeGroup`)),Object.assign(Object.assign({},Vn(e)),{marks:t})})(t)):"stacked"===r?i.push(...(e=>{const t=[];return t.push(dr(e)),t.push(mr(e)),t.push(...rr(e,hr(e),tr(e.orientation).dimensionScaleKey,e.dimension)),t})(t)):i.push((e=>{const{name:t}=e;return Object.assign(Object.assign({},Vn(e)),{marks:[{name:`${t}_background`,from:{data:`${t}_facet`},type:"rect",interactive:!1,encode:{enter:Object.assign(Object.assign({},Jn(e)),{fill:{signal:V.BACKGROUND_COLOR}}),update:Object.assign({},Wn(e))}},{name:t,from:{data:`${t}_facet`},type:"rect",interactive:Me(e),encode:{enter:Object.assign(Object.assign({},Jn(e)),Yn(e)),update:Object.assign(Object.assign({},Wn(e)),Kn(e))}},...rr(e,`${t}_facet`,`${t}_position`,`${t}_dodgeGroup`)]})})(t)),fa(a,n).some((e=>"dimension"===e.UNSAFE_highlightBy))&&i.push((e=>{const{name:t,colorScheme:a,paddingRatio:n,orientation:r}=e,i="vertical"===r?{y:{value:0},y2:{signal:"height"},xc:{signal:`scale('xBand', datum.${t}_selectedGroupId) + bandwidth('xBand')/2`},width:{signal:`bandwidth('xBand')/(1 - ${n} / 2)`}}:{x:{value:0},x2:{signal:"width"},yc:{signal:`scale('yBand', datum.${t}_selectedGroupId) + bandwidth('yBand')/2`},height:{signal:`bandwidth('yBand')/(1 - ${n} / 2)`}};return{name:`${t}_selectionRing`,type:"rect",from:{data:`${t}_selectedData`},interactive:!1,encode:{enter:{fill:{value:"transparent"},strokeWidth:{value:2},stroke:{value:(0,W.getColorValue)("static-blue",a)},cornerRadius:{value:6}},update:i}}})(t)),zn(t)){const a=Ir(t);e.push(((e,t,a)=>{const{trellisOrientation:n}=e,r=e.trellis,{markName:i,facetName:o,scaleName:s,axis:l,rangeScale:c}=Gn(e);return{name:i,type:"group",from:{facet:{data:V.FILTERED_TABLE,name:o,groupby:r}},signals:[{name:c,update:`bandwidth('${s}')`}],encode:{enter:{[l]:{scale:s,field:r},height:{signal:"vertical"===n?`bandwidth('${s}')`:"height"},width:{signal:"horizontal"===n?`bandwidth('${s}')`:"width"}}},scales:[a],marks:t}})(t,i,a))}else e.push(...i);e.push(...In(t))})),Ir=e=>{const{orientation:t,trellisOrientation:a}=e;if(t===a){const{metricAxis:a}=tr(t);return((e,t,a)=>{let n=Te("linear",t,a);return n=ye(n,e),n})(er(e),a,t)}return Lr(e)},Lr=({dimension:e,orientation:t,paddingRatio:a,paddingOuter:n})=>{const{dimensionAxis:r}=tr(t);let i=Te("band",r,t);i=ye(i,[e]);const{paddingInner:o,paddingOuter:s}=Qn(a,n);return Object.assign(Object.assign({},i),{paddingInner:o,paddingOuter:s})};function Ar(e,t,a){if(!e||0===e.length)return`'${a}'`;const n=e.slice().sort(((e,t)=>(void 0!==e.thresholdMin?e.thresholdMin:-1e12)-(void 0!==t.thresholdMin?t.thresholdMin:-1e12))),r=[];r.push(`(datum.${t} < ${void 0!==n[0].thresholdMin?n[0].thresholdMin:-1e12}) ? '${a}' : `);for(let e=0;e<n.length-1;e++){const a=void 0!==n[e+1].thresholdMin?n[e+1].thresholdMin:-1e12;r.push(`(datum.${t} < ${a}) ? '${n[e].fill}' : `)}return r.push(`'${n[n.length-1].fill}'`),r.join("")}const Dr=U(((e,t)=>{var a,n,r,i,o,s,l;const c="column"===t.direction?"y":"x",u="column"===t.direction?"width":"bulletGroupWidth",d={name:"bulletGroup",type:"group",from:{facet:{data:"table",name:"bulletGroups",groupby:`${t.dimension}`}},encode:{update:{[c]:{scale:"groupScale",field:`${t.dimension}`},height:{signal:"bulletGroupHeight"},width:{signal:u}}},marks:[]},m=t.thresholds;Array.isArray(m)&&m.length>0?(d.data=[{name:"thresholds",values:m,transform:[{type:"identifier",as:"id"}]}],null===(a=d.marks)||void 0===a||a.push(function(e){const t="bulletGroupHeight - 3 - bulletThresholdHeight",a=e.showTarget&&e.showTargetValue?`${t} - targetValueLabelHeight`:t;return{name:`${e.name}Threshold`,description:`${e.name}Threshold`,type:"rect",from:{data:"thresholds"},clip:!0,encode:{enter:{cornerRadiusTopLeft:[{test:"!isDefined(datum.thresholdMin) && domain('xscale')[0] !== 0",value:3}],cornerRadiusBottomLeft:[{test:"!isDefined(datum.thresholdMin) && domain('xscale')[0] !== 0",value:3}],cornerRadiusTopRight:[{test:"!isDefined(datum.thresholdMax) && domain('xscale')[1] !== 0",value:3}],cornerRadiusBottomRight:[{test:"!isDefined(datum.thresholdMax) && domain('xscale')[1] !== 0",value:3}],fill:{field:"fill"},fillOpacity:{value:.2}},update:{x:{signal:"isDefined(datum.thresholdMin) ? scale('xscale', datum.thresholdMin) : 0"},x2:{signal:"isDefined(datum.thresholdMax) ? scale('xscale', datum.thresholdMax) : width"},height:{signal:"bulletThresholdHeight"},y:{signal:a}}}}}(t))):t.track&&(null===(n=d.marks)||void 0===n||n.push(function(e){const t=(0,W.getColorValue)("gray-200",e.colorScheme),a="column"===e.direction?"width":"bulletGroupWidth",n=e.showTarget&&e.showTargetValue?"bulletGroupHeight - 3 - 2 * bulletHeight - 20":"bulletGroupHeight - 3 - 2 * bulletHeight";return{name:`${e.name}Track`,description:`${e.name}Track`,type:"rect",from:{data:"bulletGroups"},encode:{enter:{fill:{value:t},cornerRadiusTopRight:[{test:"domain('xscale')[1] !== 0",value:3}],cornerRadiusBottomRight:[{test:"domain('xscale')[1] !== 0",value:3}],cornerRadiusTopLeft:[{test:"domain('xscale')[0] !== 0",value:3}],cornerRadiusBottomLeft:[{test:"domain('xscale')[0] !== 0",value:3}]},update:{x:{value:0},width:{signal:a},height:{signal:"bulletHeight"},y:{signal:n}}}}}(t))),null===(r=d.marks)||void 0===r||r.push(function(e){var t,a;const n=e.showTarget&&e.showTargetValue?"bulletGroupHeight - targetValueLabelHeight - 3 - 2 * bulletHeight":"bulletGroupHeight - 3 - 2 * bulletHeight",r=e.thresholdBarColor&&(null!==(a=null===(t=e.thresholds)||void 0===t?void 0:t.length)&&void 0!==a?a:0)>0?[{field:"barColor"}]:[{value:e.color}];return{name:`${e.name}Rect`,description:`${e.name}Rect`,type:"rect",from:{data:"bulletGroups"},encode:{enter:{cornerRadiusTopLeft:[{test:`datum.${e.metric} < 0`,value:3}],cornerRadiusBottomLeft:[{test:`datum.${e.metric} < 0`,value:3}],cornerRadiusTopRight:[{test:`datum.${e.metric} > 0`,value:3}],cornerRadiusBottomRight:[{test:`datum.${e.metric} > 0`,value:3}],fill:r},update:{x:{scale:"xscale",value:0},x2:{scale:"xscale",field:`${e.metric}`},height:{signal:"bulletHeight"},y:{signal:n}}}}}(t)),t.target&&!1!==t.showTarget&&(null===(i=d.marks)||void 0===i||i.push(function(e){const t=(0,W.getColorValue)("gray-900",e.colorScheme),a=e.showTarget&&e.showTargetValue?"bulletGroupHeight - targetValueLabelHeight - targetHeight":"bulletGroupHeight - targetHeight",n=e.showTarget&&e.showTargetValue?"bulletGroupHeight - targetValueLabelHeight":"bulletGroupHeight";return{name:`${e.name}Target`,description:`${e.name}Target`,type:"rule",from:{data:"bulletGroups"},encode:{enter:{stroke:{value:`${t}`},strokeWidth:{value:2}},update:{x:{scale:"xscale",field:`${e.target}`},y:{signal:a},y2:{signal:n}}}}}(t)),t.showTargetValue&&(null===(o=d.marks)||void 0===o||o.push(function(e){const t=(0,W.getColorValue)("gray-900",e.colorScheme);return{name:`${e.name}TargetValueLabel`,description:`${e.name}TargetValueLabel`,type:"text",from:{data:"bulletGroups"},encode:{enter:{text:{signal:`datum.${e.target} != null ? 'Target: ' + format(datum.${e.target}, '$,.2f') : 'No Target'`},align:{value:"center"},baseline:{value:"top"},fill:{value:`${t}`}},update:{x:{scale:"xscale",field:`${e.target}`},y:{signal:"bulletGroupHeight - targetValueLabelHeight + 6"}}}}}(t)))),"top"!==t.labelPosition&&"row"!==t.direction||(null===(s=d.marks)||void 0===s||s.push(function(e){const t=(0,W.getColorValue)("gray-600",e.colorScheme);return{name:`${e.name}Label`,description:`${e.name}Label`,type:"text",from:{data:"bulletGroups"},encode:{enter:{text:{signal:`datum.${e.dimension}`},align:{value:"left"},baseline:{value:"top"},fill:{value:`${t}`}},update:{x:{value:0},y:{value:0}}}}}(t)),null===(l=d.marks)||void 0===l||l.push(function(e){var t,a;const n=(0,W.getColorValue)(e.color,e.colorScheme),r=(0,W.getColorValue)("gray-900",e.colorScheme),i="column"===e.direction?"width":"bulletGroupWidth",o=e.thresholdBarColor&&(null!==(a=null===(t=e.thresholds)||void 0===t?void 0:t.length)&&void 0!==a?a:0)>0?`datum.barColor === '${n}' ? '${r}' : datum.barColor`:`'${r}'`;return{name:`${e.name}ValueLabel`,description:`${e.name}ValueLabel`,type:"text",from:{data:"bulletGroups"},encode:{enter:{text:{signal:`datum.${e.metric} != null ? format(datum.${e.metric}, '${e.numberFormat||""}') : ''`},align:{value:"right"},baseline:{value:"top"},fill:{signal:o}},update:{x:{signal:i},y:{value:0}}}}}(t))),e.push(d)})),Rr=U(((e,t)=>{if(t.metricAxis&&"column"===t.direction&&!t.showTargetValue&&e.push({labelOffset:2,scale:"xscale",orient:"bottom",ticks:!1,labelColor:"gray",domain:!1,tickCount:5,offset:{signal:"axisOffset"}}),"side"===t.labelPosition&&"column"===t.direction){const a=t.showTargetValue&&t.showTarget?-8:2;e.push(function(e){return{scale:"groupScale",orient:"left",tickSize:0,labelOffset:e,labelPadding:10,labelColor:"#797979",domain:!1}}(a)),e.push(function(e,t){return{scale:"groupScale",orient:"right",tickSize:0,labelOffset:t,labelPadding:10,domain:!1,encode:{labels:{update:{text:{signal:`info(data('table')[datum.index * (length(data('table')) - 1)].${e.metric}) != null ? format(info(data('table')[datum.index * (length(data('table')) - 1)].${e.metric}), '${e.numberFormat||""}') : ''`}}}}}}(t,a))}}));const Mr=W.spectrumColors.light["static-blue"],Cr=U(((e,t)=>{var a,n,r,i,o,{colorScheme:s=V.DEFAULT_COLOR_SCHEME,index:l=0,name:c,metric:u,dimension:d,target:m,color:p=Mr,direction:h=V.DEFAULT_BULLET_DIRECTION,numberFormat:g,showTarget:f=!0,showTargetValue:y=!1,labelPosition:v=V.DEFAULT_LABEL_POSITION,scaleType:b=V.DEFAULT_SCALE_TYPE,maxScaleValue:S=V.DEFAULT_SCALE_VALUE,thresholds:E=[],track:_=!1,thresholdBarColor:T=!1,metricAxis:O=!1}=t,$=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]])}return a}(t,["colorScheme","index","name","metric","dimension","target","color","direction","numberFormat","showTarget","showTargetValue","labelPosition","scaleType","maxScaleValue","thresholds","track","thresholdBarColor","metricAxis"]);const x=Object.assign({colorScheme:s,index:l,color:(0,W.getColorValue)(p,s),metric:null!=u?u:"currentAmount",dimension:null!=d?d:"graphLabel",target:null!=m?m:"target",name:(0,J.toCamelCase)(null!=c?c:`bullet${l}`),direction:h,numberFormat:null!=g?g:"",showTarget:f,showTargetValue:y,labelPosition:v,scaleType:b,maxScaleValue:S,track:_,thresholds:E,thresholdBarColor:T,metricAxis:O},$);e.data=Pr(null!==(a=e.data)&&void 0!==a?a:[],x),e.marks=Dr(null!==(n=e.marks)&&void 0!==n?n:[],x),e.scales=Nr(null!==(r=e.scales)&&void 0!==r?r:[],x),e.signals=jr(null!==(i=e.signals)&&void 0!==i?i:[],x),e.axes=Rr(null!==(o=e.axes)&&void 0!==o?o:[],x)})),Nr=U(((e,t)=>{const a="column"===t.direction?"bulletChartHeight":"width",n="column"===t.direction?"width":[0,{signal:"bulletGroupWidth"}];let r;r="flexible"===t.scaleType&&t.maxScaleValue>0?{data:"table",fields:["xPaddingForTarget",t.metric,"flexibleScaleValue"]}:"fixed"===t.scaleType&&t.maxScaleValue>0?[0,`${t.maxScaleValue}`]:{data:"table",fields:["xPaddingForTarget",t.metric]},e.push({name:"groupScale",type:"band",domain:{data:"table",field:t.dimension},range:[0,{signal:a}],paddingInner:{signal:"paddingRatio"}},{name:"xscale",type:"linear",domain:r,range:n,round:!0,clamp:!0,zero:!0})})),jr=U(((e,t)=>{e.push({name:"gap",value:12}),e.push({name:"bulletHeight",value:8}),e.push({name:"bulletThresholdHeight",update:"bulletHeight * 3"}),e.push({name:"targetHeight",update:"bulletThresholdHeight + 6"}),t.showTargetValue&&t.showTarget&&e.push({name:"targetValueLabelHeight",update:"20"}),e.push({name:"bulletGroupHeight",update:kr(t)}),"column"===t.direction?(e.push({name:"paddingRatio",update:"gap / (gap + bulletGroupHeight)"}),t.metricAxis&&!t.showTargetValue?(e.push({name:"bulletChartHeight",update:"length(data('table')) * bulletGroupHeight + (length(data('table')) - 1) * gap + 10"}),e.push({name:"axisOffset",update:"bulletChartHeight - height - 10"})):e.push({name:"bulletChartHeight",update:"length(data('table')) * bulletGroupHeight + (length(data('table')) - 1) * gap"})):(e.push({name:"bulletGroupWidth",update:"(width / length(data('table'))) - gap"}),e.push({name:"paddingRatio",update:"gap / (gap + bulletGroupWidth)"}),e.push({name:"bulletChartHeight",update:"bulletGroupHeight"}))}));function kr(e){return e.showTargetValue&&e.showTarget?"side"===e.labelPosition&&"column"===e.direction?"bulletThresholdHeight + targetValueLabelHeight + 10":"bulletThresholdHeight + targetValueLabelHeight + 24":"side"===e.labelPosition&&"column"===e.direction?"bulletThresholdHeight + 10":"bulletThresholdHeight + 24"}const Pr=U(((e,t)=>{const a=(e=>{let t=X(e);return t||(t={name:V.TABLE,values:[],transform:[]},e.push(t)),t})(e);a.transform=(e=>{var t,a,n;const r=[{type:"formula",expr:`isValid(datum.${e.target}) ? round(datum.${e.target} * 1.05) : 0`,as:"xPaddingForTarget"}];return"flexible"===e.scaleType&&r.push({type:"formula",expr:`${e.maxScaleValue}`,as:"flexibleScaleValue"}),e.thresholdBarColor&&(null!==(a=null===(t=e.thresholds)||void 0===t?void 0:t.length)&&void 0!==a?a:0)>0&&r.push({type:"formula",expr:Ar(null!==(n=e.thresholds)&&void 0!==n?n:[],e.metric,e.color),as:"barColor"}),r})(t)}));const Hr=e=>e.metricRanges.map(((t,a)=>wr(t,e.name,a))),wr=(e,t,a)=>{var{chartTooltips:n=[],lineType:r="dashed",lineWidth:i="S",rangeOpacity:o=.2,metric:s=V.DEFAULT_METRIC,displayOnHover:l=!1}=e,c=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]])}return a}(e,["chartTooltips","lineType","lineWidth","rangeOpacity","metric","displayOnHover"]);return Object.assign({chartTooltips:n,lineType:r,lineWidth:i,name:`${t}MetricRange${a}`,rangeOpacity:o,metric:s,displayOnHover:l},c)},Fr=(e,t)=>{const a={name:`${t.name}_area`,color:e.color,colorScheme:e.colorScheme,opacity:t.rangeOpacity,metricStart:t.metricStart,metricEnd:t.metricEnd,isStacked:!1,scaleType:"time",dimension:e.dimension,isMetricRange:!0,parentName:e.name,displayOnHover:t.displayOnHover},n=Object.assign(Object.assign({},e),{name:`${t.name}_line`,color:t.color?{value:t.color}:e.color,metric:t.metric,lineType:{value:t.lineType},lineWidth:{value:t.lineWidth},displayOnHover:t.displayOnHover}),r=`${t.name}_facet`;return[mn(n,r),ut(a,r)]},Gr=(e,t)=>{if(e.length)return t};const zr=U(((e,t)=>{var a,n,r,i,{chartPopovers:o=[],chartTooltips:s=[],color:l={value:"categorical-100"},colorScheme:c=V.DEFAULT_COLOR_SCHEME,dimension:u=V.DEFAULT_TIME_DIMENSION,hasOnClick:d=!1,index:m=0,lineType:p={value:"solid"},metric:h=V.DEFAULT_METRIC,metricAxis:g,metricRanges:f=[],name:y,opacity:v={value:1},scaleType:b="time",trendlines:S=[]}=t,E=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]])}return a}(t,["chartPopovers","chartTooltips","color","colorScheme","dimension","hasOnClick","index","lineType","metric","metricAxis","metricRanges","name","opacity","scaleType","trendlines"]);const _=(0,J.toCamelCase)(y||`line${m}`),T=Object.assign({chartPopovers:o,chartTooltips:s,color:l,colorScheme:c,dimension:u,hasOnClick:d,index:m,interactiveMarkName:Xe({chartPopovers:o,chartTooltips:s,hasOnClick:d,highlightedItem:E.highlightedItem,metricRanges:f,trendlines:S},_),lineType:p,metric:h,metricAxis:g,metricRanges:f,name:_,opacity:v,popoverMarkName:Gr(o,_),scaleType:b,trendlines:S},E);return T.isHighlightedByGroup=at(T),e.data=Br(null!==(a=e.data)&&void 0!==a?a:[],T),e.signals=Ur(null!==(n=e.signals)&&void 0!==n?n:[],T),e.scales=Vr(null!==(r=e.scales)&&void 0!==r?r:[],T),e.marks=Wr(null!==(i=e.marks)&&void 0!==i?i:[],T),e})),Br=U(((e,t)=>{var a;const{chartTooltips:n,dimension:r,highlightedItem:i,isSparkline:o,isMethodLast:s,name:l,scaleType:c,staticPoint:u}=t;if("time"===c){const t=X(e);t.transform=Y(null!==(a=t.transform)&&void 0!==a?a:[],r)}(Me(t)||void 0!==i)&&(e.push(((e,t,a,n,r)=>{const i=r?`${V.HIGHLIGHTED_GROUP} === datum.${e}_highlightGroupId`:`isArray(${V.HIGHLIGHTED_ITEM}) && indexof(${V.HIGHLIGHTED_ITEM}, datum.${t}) > -1 || ${V.HIGHLIGHTED_ITEM} === datum.${t}`;return{name:`${e}_highlightedData`,source:a,transform:[{type:"filter",expr:n?`${V.SELECTED_ITEM} && ${V.SELECTED_ITEM} === datum.${t} || !${V.SELECTED_ITEM} && ${i}`:i}]}})(l,t.idKey,V.FILTERED_TABLE,Ce(t),at(t))),e.push(Q(n))),(u||o)&&e.push(((e,t,a,n,r)=>({name:`${e}_staticPointData`,source:a,transform:[{type:"filter",expr:n&&r?"datum === data('table')[data('table').length - 1]":`datum.${t} === true`}]}))(l,u,V.FILTERED_TABLE,o,s)),za(e,t),Qe(e,t,!1),va(e,t),e.push(...(e=>{const t=[],a=Hr(e);for(const e of a){const{displayOnHover:a,name:n}=e;a&&t.push({name:`${n}_highlightedData`,source:V.FILTERED_TABLE,transform:[{type:"filter",expr:`isValid(${V.HIGHLIGHTED_SERIES}) && ${V.HIGHLIGHTED_SERIES} === datum.${V.SERIES_ID} || isValid(${V.SELECTED_SERIES}) && ${V.SELECTED_SERIES} === datum.${V.SERIES_ID}`}]})}return t})(t))})),Ur=U(((e,t)=>{const{idKey:a,name:n}=t;Fn(e,t),e.push(...(e=>{const t=[],{name:a}=e;return Hr(e).length&&ct(t,`${a}_voronoi`,2),t})(t)),Me(t)&&(lt(e,`${n}_voronoi`,a,2),ct(e,`${n}_voronoi`,2),Yr(e,t),nt(e,t))})),Vr=U(((e,t)=>{const{metricAxis:a,dimension:n,color:r,lineType:i,opacity:o,padding:s,scaleType:l}=t;return ve(e,{scaleType:l,dimension:n,padding:s}),Ee(e,V.COLOR_SCALE,r),Ee(e,V.LINE_TYPE_SCALE,i),Ee(e,V.OPACITY_SCALE,o),Se(e,Jr(t)),a&&Se(e,Jr(t),"y",a),e.push(...wn(t)),e})),Wr=U(((e,t)=>{const{color:a,highlightedItem:n,isSparkline:r,lineType:i,name:o,opacity:s,staticPoint:l}=t,{facets:c}=te({color:a,lineType:i,opacity:s});e.push({name:`${o}_group`,type:"group",from:{facet:{name:`${o}_facet`,data:V.FILTERED_TABLE,groupby:c}},marks:[mn(t,`${o}_facet`)]}),(l||r)&&e.push((({name:e,metric:t,metricAxis:a,color:n,colorScheme:r,scaleType:i,dimension:o,isSparkline:s,pointSize:l=125})=>({name:`${e}_staticPoints`,description:`${e}_staticPoints`,type:"symbol",from:{data:`${e}_staticPointData`},interactive:!1,encode:{enter:{size:{value:l},fill:s?{signal:V.BACKGROUND_COLOR}:je(n,r),stroke:s?je(n,r):{signal:V.BACKGROUND_COLOR},y:Ge(a,t)},update:{x:Fe(i,o)}}}))(t)),e.push(...(e=>{const{color:t,lineType:a}=e,{facets:n}=te({color:t,lineType:a}),r=[],i=Hr(e);for(const t of i){const{displayOnHover:a,name:i}=t,o=a?`${i}_highlightedData`:V.FILTERED_TABLE;r.push({name:`${i}_group`,type:"group",clip:!0,from:{facet:{name:`${i}_facet`,data:o,groupby:n}},marks:Fr(e,t)})}return r})(t)),(Me(t)||void 0!==n)&&e.push(...hn(t,`${V.FILTERED_TABLE}ForTooltip`)),e.push(...In(t))})),Jr=e=>{const t=[e.metric];return Hr(e).forEach((e=>{e.scaleAxisToFit&&t.push(e.metricStart,e.metricEnd)})),t},Yr=(e,t)=>{const{idKey:a,interactionMode:n,name:r}=t;n===V.INTERACTION_MODE.ITEM&&Je(r).forEach((t=>{lt(e,t,a,1),ct(e,t,1)}))},Kr=U(((e,{colorScheme:t=V.DEFAULT_COLOR_SCHEME,highlightedItem:a,idKey:n,index:r=0,name:i,marks:o=[],dimension:s=V.DEFAULT_TIME_DIMENSION})=>{let{barCount:l,lineCount:c}=Xr();const u=(0,J.toCamelCase)(i||`combo${r}`);return[...o].reduce(((e,r)=>"bar"===r.markType?(l++,gr(e,Object.assign(Object.assign({},r),{colorScheme:t,highlightedItem:a,idKey:n,index:l,name:qr(r,u,l),dimension:Qr(r,s)}))):(c++,zr(e,Object.assign(Object.assign({},r),{colorScheme:t,highlightedItem:a,idKey:n,index:c,name:qr(r,u,c),dimension:Qr(r,s)})))),e)})),Xr=()=>({barCount:-1,lineCount:-1}),qr=(e,t,a)=>{if(e.name)return e.name;const n=Zr(e.markType);return(0,J.combineNames)(t,`${n}${a}`)},Zr=e=>e?e.charAt(0).toUpperCase()+e.slice(1):"",Qr=(e,t)=>{var a;return null!==(a=e.dimension)&&void 0!==a?a:t};const ei=e=>{if(e.donutSummaries.length)return ti(e.donutSummaries[0],e)},ti=(e,t)=>{var{numberFormat:a="shortNumber"}=e,n=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]])}return a}(e,["numberFormat"]);return Object.assign({donutOptions:t,numberFormat:a},n)},ai=e=>{const{donutOptions:t,label:a}=e;return{update:{x:{signal:"width / 2"},y:{signal:"height / 2"},text:ni(e),fontSize:[{test:`${V.DONUT_RADIUS} * ${t.holeRatio} < ${V.DONUT_SUMMARY_MIN_RADIUS}`,value:0},{signal:`${t.name}_summaryFontSize`}],align:{value:"center"},baseline:ri(a),limit:ii(e)}}},ni=({donutOptions:e,numberFormat:t})=>e.isBoolean?{signal:`format(datum['${e.metric}'], '.0%')`}:[...Lt(t,"sum"),{field:"sum"}],ri=e=>e?{value:"alphabetic"}:{value:"middle"},ii=({donutOptions:e,label:t})=>{const{holeRatio:a,name:n}=e,r=t?`${n}_summaryFontSize`:`${n}_summaryFontSize * 0.5`;return{signal:`2 * sqrt(pow(${V.DONUT_RADIUS} * ${a}, 2) - pow(${r}, 2))`}},oi=({donutOptions:e,label:t})=>({update:{x:{signal:"width / 2"},y:{signal:"height / 2"},dy:{signal:`ceil(${e.name}_summaryFontSize * 0.25)`},text:{value:t},fontSize:[{test:`${V.DONUT_RADIUS} * ${e.holeRatio} < ${V.DONUT_SUMMARY_MIN_RADIUS}`,value:0},{signal:`ceil(${e.name}_summaryFontSize * 0.5)`}],align:{value:"center"},baseline:{value:"top"},limit:{signal:`2 * sqrt(pow(${V.DONUT_RADIUS} * ${e.holeRatio}, 2) - pow(${e.name}_summaryFontSize * 0.75, 2))`}}});const si=(e,t)=>{var{percent:a=!1,value:n=!1,valueFormat:r="standardNumber"}=e,i=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]])}return a}(e,["percent","value","valueFormat"]);return Object.assign({donutOptions:t,percent:a,value:n,valueFormat:r},i)},li=({labelKey:e,value:t,percent:a,donutOptions:n})=>{const{name:r,color:i}=n;return{type:"text",name:`${r}_segmentLabel`,from:{data:V.FILTERED_TABLE},encode:{enter:Object.assign(Object.assign({},ui(r)),{text:{field:null!=e?e:i},fontWeight:{value:"bold"},dy:t||a?{signal:`datum['${r}_arcTheta'] <= 0.5 * PI || datum['${r}_arcTheta'] >= 1.5 * PI ? -16 : 0`}:void 0}),update:di}}},ci=e=>{if(!e.value&&!e.percent)return[];const{donutOptions:t}=e;return[{type:"text",name:`${t.name}_segmentLabelValue`,from:{data:V.FILTERED_TABLE},encode:{enter:Object.assign(Object.assign({},ui(t.name)),{text:mi(e),dy:{signal:`datum['${t.name}_arcTheta'] <= 0.5 * PI || datum['${t.name}_arcTheta'] >= 1.5 * PI ? 0 : 16`}}),update:di}}]},ui=e=>({radius:{signal:`${V.DONUT_RADIUS} + 6`},theta:{field:`${e}_arcTheta`},fontSize:pi(e),align:{signal:`datum['${e}_arcTheta'] <= PI ? 'left' : 'right'`},baseline:{signal:`datum['${e}_arcTheta'] <= 0.5 * PI || datum['${e}_arcTheta'] >= 1.5 * PI ? 'bottom' : 'top'`}}),di={x:{signal:"width / 2"},y:{signal:"height / 2"}},mi=({donutOptions:e,percent:t,value:a,valueFormat:n})=>{const r=`format(datum['${e.name}_arcPercent'], '.0%')`;if(a){const a=Lt(n,e.metric);return t?a.map((e=>Object.assign(Object.assign({},e),{signal:`${r} + "\\u00a0\\u00a0" + ${e.signal}`}))):a}if(t)return{signal:r}},pi=e=>[{test:`datum['${e}_arcLength'] < ${V.DONUT_SEGMENT_LABEL_MIN_ANGLE}`,value:0},{value:14}];const hi=U(((e,t)=>{var a,n,r,i,{chartPopovers:o=[],chartTooltips:s=[],color:l=V.DEFAULT_COLOR,colorScheme:c=V.DEFAULT_COLOR_SCHEME,donutSummaries:u=[],index:d=0,metric:m=V.DEFAULT_METRIC,name:p,startAngle:h=0,holeRatio:g=.85,isBoolean:f=!1,segmentLabels:y=[]}=t,v=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]])}return a}(t,["chartPopovers","chartTooltips","color","colorScheme","donutSummaries","index","metric","name","startAngle","holeRatio","isBoolean","segmentLabels"]);const b=Object.assign({chartPopovers:o,chartTooltips:s,color:l,colorScheme:c,donutSummaries:u,holeRatio:g,index:d,isBoolean:f,metric:m,name:(0,J.toCamelCase)(null!=p?p:`donut${d}`),segmentLabels:y,startAngle:h},v);e.data=gi(null!==(a=e.data)&&void 0!==a?a:[],b),e.scales=yi(null!==(n=e.scales)&&void 0!==n?n:[],b),e.marks=vi(null!==(r=e.marks)&&void 0!==r?r:[],b),e.signals=bi(null!==(i=e.signals)&&void 0!==i?i:[],b)})),gi=U(((e,t)=>{var a,n;const{name:r,isBoolean:i}=t,o=e.findIndex((e=>e.name===V.FILTERED_TABLE));var s;e[o].transform=null!==(a=e[o].transform)&&void 0!==a?a:[],null===(n=e[o].transform)||void 0===n||n.push(...fi(t)),i&&e.push({name:`${r}_booleanData`,source:V.FILTERED_TABLE,transform:[{type:"window",ops:["row_number"],as:[`${r}_rscRowIndex`]},{type:"filter",expr:`datum.${r}_rscRowIndex === 1`}]}),e.push(...(s=t,!ei(s)||s.isBoolean?[]:[{name:`${s.name}_summaryData`,source:V.FILTERED_TABLE,transform:[{type:"aggregate",fields:[s.metric],ops:["sum"],as:["sum"]}]}]))})),fi=({startAngle:e,metric:t,name:a})=>[{type:"pie",field:t,startAngle:e,endAngle:{signal:`${e} + 2 * PI`},as:[`${a}_startAngle`,`${a}_endAngle`]},{type:"formula",as:`${a}_arcTheta`,expr:`(datum['${a}_startAngle'] + datum['${a}_endAngle']) / 2`},{type:"formula",as:`${a}_arcLength`,expr:`datum['${a}_endAngle'] - datum['${a}_startAngle']`},{type:"formula",as:`${a}_arcPercent`,expr:`datum['${a}_arcLength'] / (2 * PI)`}],yi=U(((e,t)=>{const{color:a}=t;var n;Ee(e,V.COLOR_SCALE,a),e.push(...(n=t,ei(n)?[{name:`${n.name}_summaryFontSizeScale`,type:"threshold",domain:[32,36,40,45,50,60],range:[28,32,36,40,45,50,60]}]:[]))})),vi=U(((e,t)=>{e.push((e=>{const{chartPopovers:t,chartTooltips:a,color:n,colorScheme:r,holeRatio:i,idKey:o,name:s}=e;return{type:"arc",name:s,description:s,from:{data:V.FILTERED_TABLE},encode:{enter:{fill:je(n,r),x:{signal:"width / 2"},y:{signal:"height / 2"},tooltip:De(a,s),stroke:{value:(0,W.getColorValue)("static-blue",r)}},update:{startAngle:{field:`${s}_startAngle`},endAngle:{field:`${s}_endAngle`},padAngle:{value:.01},innerRadius:{signal:`${i} * ${V.DONUT_RADIUS}`},outerRadius:{signal:V.DONUT_RADIUS},opacity:Ke(e),cursor:Ae(t),strokeWidth:[{test:`${V.SELECTED_ITEM} === datum.${o}`,value:2},{value:0}]}}}})(t)),e.push(...(e=>{const t=ei(e);if(!t)return[];const a=[];return e.isBoolean?a.push((e=>{var t;const{donutOptions:a,label:n}=e,r={type:"group",name:`${a.name}_percentText`,marks:[{type:"text",name:`${a.name}_booleanSummaryValue`,from:{data:`${a.name}_booleanData`},encode:ai(e)}]};return n&&(null===(t=r.marks)||void 0===t||t.push({type:"text",name:`${a.name}_booleanSummaryLabel`,from:{data:`${a.name}_booleanData`},encode:oi(Object.assign(Object.assign({},e),{label:n}))})),r})(t)):a.push((e=>{var t;const{donutOptions:a,label:n}=e,r={type:"group",name:`${a.name}_summaryGroup`,marks:[{type:"text",name:`${a.name}_summaryValue`,from:{data:`${a.name}_summaryData`},encode:ai(e)}]};return n&&(null===(t=r.marks)||void 0===t||t.push({type:"text",name:`${a.name}_summaryLabel`,from:{data:`${a.name}_summaryData`},encode:oi(Object.assign(Object.assign({},e),{label:n}))})),r})(t)),a})(t)),e.push(...(e=>{const{isBoolean:t,name:a}=e;if(t)return[];const n=(e=>{if(e.segmentLabels.length)return si(e.segmentLabels[0],e)})(e);return n?[{name:`${a}_segmentLabelGroup`,type:"group",marks:[li(n),...ci(n)]}]:[]})(t))})),bi=U(((e,t)=>{var a;const{chartTooltips:n,idKey:r,name:i}=t;e.push(...(e=>{if(!ei(e))return[];const{name:t,holeRatio:a}=e;return[{name:`${t}_summaryFontSize`,update:`scale('${t}_summaryFontSizeScale', ${V.DONUT_RADIUS} * ${a} * ${V.DONUT_SUMMARY_FONT_SIZE_RATIO})`}]})(t)),Me(t)&&lt(e,i,r,1,null===(a=n[0])||void 0===a?void 0:a.excludeDataKeys)})),Si=(e,t,a)=>{e.length&&Ti(e).filter(_i).forEach((e=>{e.encode||(e.encode={update:{}}),e.encode.update||(e.encode.update={});const{update:n}=e.encode,{opacity:r}=n;if(void 0!==r){const e=Ei(t,a);Array.isArray(n.opacity)||(n.opacity=[]);const r=Math.max(n.opacity.length-1,0);n.opacity.splice(r,0,e)}}))},Ei=(e,t)=>{let a=`isValid(${V.HIGHLIGHTED_SERIES}) && ${V.HIGHLIGHTED_SERIES} !== datum.${V.SERIES_ID}`;return(null==e?void 0:e.length)&&(a=`isValid(${V.HIGHLIGHTED_GROUP}) && ${V.HIGHLIGHTED_GROUP} !== datum.${t}_highlightGroupId`),{test:a,value:1/V.HIGHLIGHT_CONTRAST_RATIO}},_i=e=>{var t;const a=null===(t=e.encode)||void 0===t?void 0:t.enter;if(!a)return!1;const{fill:n,stroke:r}=a;return!(!n||!("scale"in n)||n.scale!==V.COLOR_SCALE)||!!(n&&"signal"in n&&n.signal.includes("scale('colors',"))||!(!r||!("scale"in r)||r.scale!==V.COLOR_SCALE)},Ti=e=>{let t=e;for(const a of e)Oi(a)&&a.marks&&(t=[...t,...Ti(a.marks)]);return t},Oi=e=>"group"===e.type,$i=[V.COLOR_SCALE,V.LINE_TYPE_SCALE,V.LINEAR_COLOR_SCALE,V.OPACITY_SCALE,"secondaryColor","secondaryLineType","secondaryOpacity","secondarySymbolShape",V.SYMBOL_SHAPE_SCALE,V.SYMBOL_SIZE_SCALE],xi=e=>Boolean("domain"in e&&e.domain&&"fields"in e.domain),Ii=e=>{if(!["left","right"].includes(e))return{signal:"floor(width / 220)"}},Li=(e,t)=>e.length?[{type:"filter",expr:`indexof(${JSON.stringify(e)}, datum.${t}Entries) === -1`}]:[],Ai=(e,t)=>{const a=Ni(e,t),n=Ri(t),r=Di(t.name,t.legendLabels),i=Pi(t),o=Hi(t);return wi([a,r,n,i,o])},Di=(e,t)=>t?{labels:{update:{text:[{test:`indexof(pluck(${e}_labels, 'seriesName'), datum.value) > -1`,signal:`${e}_labels[indexof(pluck(${e}_labels, 'seriesName'), datum.value)].label`},{signal:"datum.value"}]}}}:{},Ri=e=>{const{highlight:t,highlightedSeries:a,name:n,hasMouseInteraction:r,descriptions:i,chartPopovers:o}=e;return t||a||i||(null==o?void 0:o.length)?{entries:{name:`${n}_legendEntry`,interactive:!0,enter:{tooltip:Mi(i,n)},update:{fill:{value:"transparent"}}},labels:{update:{opacity:Ci(e)}},symbols:{update:{opacity:Ci(e)}}}:r?{entries:{name:`${n}_legendEntry`,interactive:!0,enter:{fill:{value:"transparent"}}}}:{}},Mi=(e,t)=>{if(null==e?void 0:e.length)return{signal:`merge(datum, {'${V.COMPONENT_NAME}': '${t}'})`}},Ci=({highlight:e,highlightedSeries:t,keys:a,chartPopovers:n})=>{const r=(null==a?void 0:a.length)?V.HIGHLIGHTED_GROUP:V.HIGHLIGHTED_SERIES,i=(null==a?void 0:a.length)?V.SELECTED_GROUP:V.SELECTED_SERIES;if(e||t||(null==n?void 0:n.length))return[{test:`isValid(${r}) && datum.value !== ${r}`,value:1/V.HIGHLIGHT_CONTRAST_RATIO},{test:`isValid(${i}) && datum.value !== ${i}`,value:1/V.HIGHLIGHT_CONTRAST_RATIO},V.DEFAULT_OPACITY_RULE]},Ni=(e,t)=>{var a,n;const{color:r,lineType:i,lineWidth:o,name:s,opacity:l,symbolShape:c,colorScheme:u}=t,d={fillOpacity:ji({facets:e,facetType:V.OPACITY_SCALE,customValue:l,name:s}),shape:ji({facets:e,facetType:V.SYMBOL_SHAPE_SCALE,customValue:c,name:s}),size:ji({facets:e,facetType:V.SYMBOL_SIZE_SCALE,name:s}),strokeDash:ji({facets:e,facetType:V.LINE_TYPE_SCALE,customValue:i,name:s}),strokeWidth:ji({facets:e,facetType:V.LINE_WIDTH_SCALE,customValue:o,name:s})},m={fill:[...ki(t,"gray-300"),null!==(a=ji({facets:e,facetType:V.COLOR_SCALE,customValue:r,name:s}))&&void 0!==a?a:{value:W.spectrumColors[u]["categorical-100"]}],stroke:[...ki(t,"gray-300"),null!==(n=ji({facets:e,facetType:V.COLOR_SCALE,customValue:r,name:s}))&&void 0!==n?n:{value:W.spectrumColors[u]["categorical-100"]}]};return{entries:{name:`${s}_legendEntry`},symbols:JSON.parse(JSON.stringify({enter:d,update:m}))}},ji=({customValue:e,facets:t,facetType:a,name:n})=>{if(e)return"string"==typeof e?{signal:`scale('${a}', data('${n}Aggregate')[datum.index].${e})`}:{value:e.value};if(!t)return;const r={color:{scale:"secondaryColor",signal:"colors"},linearColor:{scale:"secondaryColor",signal:"colors"},lineType:{scale:"secondaryLineType",signal:"lineTypes"},lineWidth:{scale:"secondaryLineWidth",signal:"lineWidths"},opacity:{scale:"secondaryOpacity",signal:"opacities"},symbolShape:{scale:"secondarySymbolShape",signal:"symbolShapes"},symbolSize:{scale:"secondarySymbolSize",signal:"symbolSizes"},symbolPathWidth:{scale:"secondarySymbolPathWidth",signal:"symbolPathWidths"}},i=t.find((e=>e.facetType===a));if(!i)return;const o=t.find((e=>e.facetType===r[a].scale));if(o){const{scale:e,signal:t}=r[a];return{signal:`scale('${t}', data('${n}Aggregate')[datum.index].${i.field})[indexof(domain('${e}'), data('${n}Aggregate')[datum.index].${o.field})% length(scale('${t}', data('${n}Aggregate')[datum.index].${i.field}))]`}}return{signal:`scale('${a}', data('${n}Aggregate')[datum.index].${i.field})`}},ki=({colorScheme:e,hiddenSeries:t,isToggleable:a,keys:n,name:r},i)=>a||t.length?(null==n?void 0:n.length)?[{test:`indexof(pluck(data('${V.FILTERED_TABLE}'), '${r}_highlightGroupId'), datum.value) === -1`,value:(0,W.getColorValue)(i,e)}]:[{test:"indexof(hiddenSeries, datum.value) !== -1",value:(0,W.getColorValue)(i,e)}]:[],Pi=e=>{const{colorScheme:t}=e;return{labels:{update:{fill:[...ki(e,"gray-500"),{value:(0,W.getColorValue)("gray-700",t)}]}}}},Hi=e=>{const{isToggleable:t,keys:a,name:n,hasOnClick:r,chartPopovers:i}=e;let o={};return(t&&!a||r||(null==i?void 0:i.length))&&(o={entries:{name:`${n}_legendEntry`,interactive:!0,enter:{fill:{value:"transparent"},cursor:{value:"pointer"}}}}),o},wi=e=>{let t={};for(const a of e)t=Ot()(t,a);return t},Fi=e=>e&&"object"==typeof e&&"value"in e?ie(e.value):"circle";const Gi=U(((e,t)=>{var a,n,r,i,o,s,{color:l,hasMouseInteraction:c=!1,hasOnClick:u=!1,hiddenEntries:d=[],hiddenSeries:m=[],highlight:p=!1,highlightedSeries:h,index:g=0,isToggleable:f=!1,lineType:y,lineWidth:v,position:b="bottom",symbolShape:S,title:E,colorScheme:_=V.DEFAULT_COLOR_SCHEME}=t,T=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]])}return a}(t,["color","hasMouseInteraction","hasOnClick","hiddenEntries","hiddenSeries","highlight","highlightedSeries","index","isToggleable","lineType","lineWidth","position","symbolShape","title","colorScheme"]);const{formattedColor:O,formattedLineType:$,formattedLineWidth:x,formattedSymbolShape:I}=zi(l,y,v,S,_),L=`legend${g}`,A=Object.assign({color:O,hasMouseInteraction:c,hasOnClick:u,hiddenEntries:d,hiddenSeries:m,highlight:p,highlightedSeries:h,index:g,isToggleable:f,lineType:$,lineWidth:x,name:L,position:b,symbolShape:I,title:E,colorScheme:_},T);e.scales=Wi(null!==(a=e.scales)&&void 0!==a?a:[],A);const{ordinalFacets:D,continuousFacets:R}=T.keys?((e,t)=>{const a=[],n=[];return t.forEach((t=>{var r,i;xi(t)&&((e,t)=>e.domain.fields.some((e=>t.includes(e.toString()))))(t,e)&&("ordinal"===t.type||"point"===t.type?a.push({facetType:t.name,field:null===(r=t.domain.fields.find((t=>e.includes(t.toString()))))||void 0===r?void 0:r.toString()}):n.push({facetType:t.name,field:null===(i=t.domain.fields.find((t=>e.includes(t.toString()))))||void 0===i?void 0:i.toString()}))})),{ordinalFacets:a,continuousFacets:n}})(T.keys,null!==(n=e.scales)&&void 0!==n?n:[]):(e=>{const t=[],a=[];return e.forEach((e=>{$i.includes(e.name)&&xi(e)&&e.domain.fields.length&&("ordinal"===e.type||"point"===e.type?t.push({facetType:e.name,field:e.domain.fields[0].toString()}):a.push({facetType:e.name,field:e.domain.fields[0].toString()}))})),{ordinalFacets:t,continuousFacets:a}})(null!==(r=e.scales)&&void 0!==r?r:[]),M=[];if(D.length){e.scales.push({name:`${L}Entries`,type:"ordinal",domain:{data:`${L}Aggregate`,field:`${L}Entries`}});const t=[...new Set(D.map((e=>e.field)))];e.data=Yi(null!==(i=e.data)&&void 0!==i?i:[],Object.assign(Object.assign({},A),{facets:t})),e.signals=Ki(null!==(o=e.signals)&&void 0!==o?o:[],A),e.marks=Ji(null!==(s=e.marks)&&void 0!==s?s:[],A),M.push(Bi(D,A))}R.forEach((e=>{M.push(Ui(e,A))})),void 0===e.legends&&(e.legends=[]),e.legends.push(...M)})),zi=(e,t,a,n,r)=>{let i,o,s,l;return i=e&&"object"==typeof e?{value:(0,W.getColorValue)(e.value,r)}:e,o=t&&"object"==typeof t?{value:ne(t.value)}:t,s=a&&"object"==typeof a?{value:re(a.value)}:a,l=n&&"object"==typeof n?{value:ie(n.value)}:n,{formattedColor:i,formattedLineType:o,formattedLineWidth:s,formattedSymbolShape:l}},Bi=(e,t)=>{const{name:a,position:n,title:r,labelLimit:i,titleLimit:o}=t,s={fill:`${a}Entries`,direction:["top","bottom"].includes(n)?"horizontal":"vertical",orient:n,title:r,encode:Ai(e,t),columns:Ii(n),labelLimit:i};return void 0!==o&&(s.titleLimit=o),s},Ui=(e,t)=>{const{symbolShape:a}=t;return e.facetType===V.SYMBOL_SIZE_SCALE?Object.assign(Object.assign({size:V.SYMBOL_SIZE_SCALE},Vi(t)),{symbolType:Fi(a)}):Object.assign({fill:V.LINEAR_COLOR_SCALE,gradientThickness:10},Vi(t))},Vi=({position:e,title:t,titleLimit:a})=>{const n={direction:["top","bottom"].includes(e)?"horizontal":"vertical",orient:e,title:t};return void 0!==a&&(n.titleLimit=a),n},Wi=U(((e,{color:t,lineType:a,opacity:n,symbolShape:r})=>{Ee(e,V.COLOR_SCALE,t),Ee(e,V.LINE_TYPE_SCALE,a),Ee(e,V.OPACITY_SCALE,n),Ee(e,V.SYMBOL_SHAPE_SCALE,r)})),Ji=U(((e,{highlight:t,keys:a,name:n})=>{t&&Si(e,a,n)})),Yi=U(((e,{facets:t,hiddenEntries:a,keys:n,name:r})=>{const i=t.map((e=>`datum.${e}`)).join(' + " | " + ');if(e.push({name:`${r}Aggregate`,source:"table",transform:[{type:"aggregate",groupby:t},{type:"formula",as:`${r}Entries`,expr:i},...Li(a,r)]}),null==n?void 0:n.length){const t=X(e);t.transform||(t.transform=[]),t.transform.push({type:"formula",as:`${r}_highlightGroupId`,expr:n.map((e=>`datum.${e}`)).join(' + " | " + ')})}})),Ki=U(((e,{hiddenSeries:t,highlight:a,isToggleable:n,keys:r,legendLabels:i,name:o})=>{a&&((e,t,a,n)=>{const r=(null==n?void 0:n.length)?V.HIGHLIGHTED_GROUP:V.HIGHLIGHTED_SERIES,i=e.find((e=>e.name===r));i&&(void 0===i.on&&(i.on=[]),i.on.push({events:`@${t}_legendEntry:mouseover`,update:ot(t,a,n)},{events:`@${t}_legendEntry:mouseout`,update:"null"}))})(e,o,Boolean(n||t),r),i&&e.push(st(`${o}_labels`,i))}));const Xi=e=>e.scatterPaths.map(((t,a)=>((e,t,a)=>{var{color:n="gray-500",groupBy:r,pathWidth:i={value:"M"},opacity:o=.5}=e,s=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]])}return a}(e,["color","groupBy","pathWidth","opacity"]),l=a.color,c=a.colorScheme,u=a.dimension,d=a.dimensionScaleType,m=a.lineType,p=a.metric,h=a.name,g=a.opacity,f=a.size;const{facets:y}=te({color:l,lineType:m,size:f,opacity:g});return Object.assign({color:n,colorScheme:c,dimension:u,dimensionScaleType:d,groupBy:null!=r?r:y,metric:p,index:t,pathWidth:i,name:`${h}Path${t}`,opacity:o},s)})(t,a,e))),qi=({color:e,colorScheme:t,dimension:a,dimensionScaleType:n,pathWidth:r,metric:i,name:o,opacity:s})=>({name:o,type:"trail",from:{data:`${o}_facet`},encode:{enter:{fill:{value:(0,W.getColorValue)(e,t)},fillOpacity:{value:s},size:Qi(r)},update:{opacity:Zi(),x:Fe(n,a),y:{scale:"yLinear",field:i}}}}),Zi=()=>{const e=1/V.HIGHLIGHT_CONTRAST_RATIO;return[{test:`isValid(${V.HIGHLIGHTED_SERIES}) || isValid(${V.HIGHLIGHTED_ITEM}) || isValid(${V.SELECTED_SERIES}) || isValid(${V.SELECTED_ITEM})`,value:e},V.DEFAULT_OPACITY_RULE]},Qi=e=>"string"==typeof e?{scale:V.SYMBOL_PATH_WIDTH_SCALE,field:e}:{value:re(e.value)},eo=U(((e,t)=>{const{name:a}=t,n={name:`${a}_group`,type:"group",marks:[to(t),...no(t),...ro(t)]};e.push(...(e=>{const t=[];return Xi(e).forEach((e=>{const{groupBy:a,name:n}=e;t.push({name:`${n}_group`,type:"group",from:{facet:{name:`${n}_facet`,data:V.FILTERED_TABLE,groupby:a}},marks:[qi(e)]})})),t})(t)),e.push(n),e.push(...In(t))})),to=e=>{const{color:t,colorScaleType:a,colorScheme:n,dimension:r,dimensionScaleType:i,lineType:o,lineWidth:s,metric:l,name:c,opacity:u,size:d}=e;return{name:c,description:c,type:"symbol",from:{data:V.FILTERED_TABLE},encode:{enter:{blend:{value:"light"===n?"multiply":"screen"},fill:je(t,n,a),fillOpacity:Pe(u),shape:{value:"circle"},size:He(d),strokeDash:we(o),strokeWidth:ke(s),stroke:je(t,n,a)},update:{opacity:ao(e),x:Fe(i,r),y:{scale:"yLinear",field:l}}}}},ao=e=>{const{highlightedItem:t,idKey:a}=e;if(!Me(e)&&void 0===t)return[V.DEFAULT_OPACITY_RULE];const n=1/V.HIGHLIGHT_CONTRAST_RATIO,r=[];return it(r,e),Ce(e)&&r.push({test:`isValid(${V.SELECTED_ITEM}) && ${V.SELECTED_ITEM} !== datum.${a}`,value:n}),[...r,V.DEFAULT_OPACITY_RULE]},no=e=>{const{dimension:t,dimensionScaleType:a,highlightedItem:n,metric:r,name:i}=e;return Me(e)||void 0!==n?[ze(`${V.FILTERED_TABLE}ForTooltip`,t,r,i,a),Be(e,`${i}_pointsForVoronoi`)]:[]},ro=e=>{const{dimension:t,dimensionScaleType:a,metric:n,name:r,size:i}=e;return Ce(e)?[{name:`${r}_selectRing`,type:"symbol",from:{data:`${r}_selectedData`},encode:{enter:{fill:{value:"transparent"},shape:{value:"circle"},size:io(i),strokeWidth:{value:2},stroke:{value:W.spectrumColors.light["static-blue"]}},update:{x:Fe(a,t),y:{scale:"yLinear",field:n}}}}]:[]},io=e=>{const t=He(e);return"value"in t&&"number"==typeof t.value?{value:Math.pow(Math.sqrt(t.value)+4,2)}:"scale"in t&&"field"in t?{signal:`pow(sqrt(scale('${t.scale}', datum.${t.field})) + 4, 2)`}:t};const oo=U(((e,t)=>{var a,n,r,i,{chartPopovers:o=[],chartTooltips:s=[],color:l={value:"categorical-100"},colorScaleType:c="ordinal",colorScheme:u=V.DEFAULT_COLOR_SCHEME,dimension:d=V.DEFAULT_LINEAR_DIMENSION,dimensionScaleType:m=V.DEFAULT_DIMENSION_SCALE_TYPE,index:p=0,lineType:h={value:"solid"},lineWidth:g={value:0},metric:f=V.DEFAULT_METRIC,name:y,opacity:v={value:1},scatterPaths:b=[],size:S={value:"M"},trendlines:E=[]}=t,_=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]])}return a}(t,["chartPopovers","chartTooltips","color","colorScaleType","colorScheme","dimension","dimensionScaleType","index","lineType","lineWidth","metric","name","opacity","scatterPaths","size","trendlines"]);const T=(0,J.toCamelCase)(y||`scatter${p}`),O=Object.assign({chartPopovers:o,chartTooltips:s,color:l,colorScaleType:c,colorScheme:u,dimension:d,dimensionScaleType:m,index:p,interactiveMarkName:Xe({chartPopovers:o,chartTooltips:s,highlightedItem:_.highlightedItem,trendlines:E},T),lineType:h,lineWidth:g,metric:f,name:T,opacity:v,scatterPaths:b,size:S,trendlines:E},_);e.data=so(null!==(a=e.data)&&void 0!==a?a:[],O),e.signals=lo(null!==(n=e.signals)&&void 0!==n?n:[],O),e.scales=co(null!==(r=e.scales)&&void 0!==r?r:[],O),e.marks=eo(null!==(i=e.marks)&&void 0!==i?i:[],O)})),so=U(((e,t)=>{var a;const{chartTooltips:n,dimension:r,dimensionScaleType:i,highlightedItem:o,idKey:s,name:l}=t;if("time"===i){const t=X(e);t.transform=Y(null!==(a=t.transform)&&void 0!==a?a:[],r)}(Me(t)||void 0!==o)&&e.push(Q(n)),Ce(t)&&e.push({name:`${l}_selectedData`,source:V.FILTERED_TABLE,transform:[{type:"filter",expr:`${V.SELECTED_ITEM} === datum.${s}`}]}),Qe(e,t),za(e,t)})),lo=U(((e,t)=>{const{idKey:a,name:n}=t;Fn(e,t),Me(t)&&(lt(e,`${n}_voronoi`,a,2),nt(e,t))})),co=U(((e,t)=>{const{color:a,colorScaleType:n,dimension:r,dimensionScaleType:i,lineType:o,lineWidth:s,metric:l,opacity:c,size:u}=t;ve(e,{scaleType:i,dimension:r}),Se(e,[l]),Ee(e,"linear"===n?V.LINEAR_COLOR_SCALE:V.COLOR_SCALE,a),Ee(e,V.LINE_TYPE_SCALE,o),Ee(e,V.LINE_WIDTH_SCALE,s),Ee(e,V.OPACITY_SCALE,c),Ee(e,V.SYMBOL_SIZE_SCALE,u),((e,t)=>{Xi(t).forEach((t=>{Ee(e,V.SYMBOL_PATH_WIDTH_SCALE,t.pathWidth)}))})(e,t),e.push(...wn(t))})),uo=U(((e,{text:t,fontWeight:a=V.DEFAULT_TITLE_FONT_WEIGHT,position:n="middle",orient:r="top"})=>(e.title={text:t,fontWeight:a,anchor:n,frame:"group",orient:r},e)));var mo=i(561);function po(e){var t,a=function(e){for(var t=[],a=0;a<e.length;++a)for(var n=a+1;n<e.length;++n){let o=e[a],s=e[n];if(o&&s)for(var r=yo(o,s),i=0;i<r.length;++i){let e=r[i];e&&t.push({...e,parentIndex:[a,n]})}}return t}(e),n=a.filter((function(t){return function(e,t){for(var a=0;a<t.length;++a){let n=t[a];if(void 0!==n&&go(e,n)>n.radius+1e-10)return!1}return!0}(t,e)})),r=0,i=0,o=[];if(n.length>1){var s=vo(n),l=(n=n.map((e=>({...e,angle:Math.atan2(e.x-s.x,e.y-s.y)}))).sort(((e,t)=>t.angle-e.angle)))[n.length-1];for(t=0;t<n.length;++t){var c=n[t];i+=(l.x+c.x)*(c.y-l.y);for(var u={x:(c.x+l.x)/2,y:(c.y+l.y)/2},d=null,m=0;m<c.parentIndex.length;++m)if(l.parentIndex.indexOf(c.parentIndex[m])>-1){var p=e[c.parentIndex[m]],h=Math.atan2(c.x-p.x,c.y-p.y),g=Math.atan2(l.x-p.x,l.y-p.y),f=g-h;f<0&&(f+=2*Math.PI);var y=g-f/2,v=go(u,{x:p.x+p.radius*Math.sin(y),y:p.y+p.radius*Math.cos(y)});v>2*p.radius&&(v=2*p.radius),(null===d||d.width>v)&&(d={circle:p,width:v,p1:c,p2:l})}null!==d&&(o.push(d),r+=ho(d.circle.radius,d.width),l=c)}}else{var b=e[0];for(t=1;t<e.length;++t){let a=e[t];(null==b||a.radius<b.radius)&&(b=a)}var S=!1;for(t=0;t<e.length;++t){let a=e[t];if(void 0!==a&&go(a,b)>Math.abs(b.radius-a.radius)){S=!0;break}}S?r=i=0:(r=b.radius*b.radius*Math.PI,o.push({circle:b,p1:{x:b.x,y:b.y+b.radius},p2:{x:b.x-1e-10,y:b.y+b.radius},width:2*b.radius}))}return{overlap:r+(i/=2),stats:{area:r+i,arcArea:r,polygonArea:i,arcs:o,innerPoints:n,intersectionPoints:a}}}function ho(e,t){return e*e*Math.acos(1-t/e)-(e-t)*Math.sqrt(t*(2*e-t))}function go(e,t){return Math.sqrt((e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y))}function fo(e,t,a){if(a>=e+t)return 0;if(a<=Math.abs(e-t))return Math.PI*Math.min(e,t)*Math.min(e,t);var n=t-(a*a-e*e+t*t)/(2*a);return ho(e,e-(a*a-t*t+e*e)/(2*a))+ho(t,n)}function yo(e,t){var a=go(e,t),n=e.radius,r=t.radius;if(a>=n+r||a<=Math.abs(n-r))return[];var i=(n*n-r*r+a*a)/(2*a),o=Math.sqrt(n*n-i*i),s=e.x+i*(t.x-e.x)/a,l=e.y+i*(t.y-e.y)/a,c=-(t.y-e.y)*(o/a),u=-(t.x-e.x)*(o/a);return[{x:s+c,y:l-u},{x:s-c,y:l+u}]}function vo(e){let t=e.reduce(((e,t)=>({x:e.x+t.x,y:e.y+t.y})),{x:0,y:0});return t.x/=e.length,t.y/=e.length,t}var bo=new Map([["greedy",Oo],["MDS",To],["best",function(e,t){var a=Oo(e),n=$o;if(e.length>=8){var r=To(e,t);n(r,e)+1e-8<n(a,e)&&(a=r)}return a}]]),So=1e-10;function Eo(e,t,a){return Math.min(e,t)*Math.min(e,t)*Math.PI<=a+So?Math.abs(e-t):(0,mo.bisect)((function(n){return fo(e,t,n)-a}),0,e+t)}function _o(e,t,a,n){var r,i=0;for(r=0;r<t.length;++r)t[r]=0;for(r=0;r<a.length;++r)for(var o=e[2*r],s=e[2*r+1],l=r+1;l<a.length;++l){var c=e[2*l],u=e[2*l+1],d=a[r][l],m=n[r][l],p=(c-o)*(c-o)+(u-s)*(u-s),h=Math.sqrt(p),g=p-d*d;m>0&&h<=d||m<0&&h>=d||(i+=2*g*g,t[2*r]+=4*g*(o-c),t[2*r+1]+=4*g*(s-u),t[2*l]+=4*g*(c-o),t[2*l+1]+=4*g*(u-s))}return i}function To(e,t){var a,n=t.restarts||10,r=[],i={};for(a=0;a<e.length;++a){var o=e[a];1===o?.sets.length&&(o.sets[0]&&(i[o.sets[0]]=r.length),r.push(o))}var s=function(e,t,a){var n=(0,mo.zerosM)(t.length,t.length),r=(0,mo.zerosM)(t.length,t.length);return e.filter((function(e){return 2===e.sets.length})).map((function(e){var i=a[e.sets[0]],o=a[e.sets[1]];if(void 0===i||void 0===o)return e;var s=Eo(Math.sqrt(t[i].size/Math.PI),Math.sqrt(t[o].size/Math.PI),e.size);n[i][o]=n[o][i]=s;var l=0;e.size+1e-10>=Math.min(t[i].size,t[o].size)?l=1:e.size<=1e-10&&(l=-1),r[i][o]=r[o][i]=l})),{distances:n,constraints:r}}(e,r,i),l=s.distances,c=s.constraints,u=(0,mo.norm2)(l.map(mo.norm2))/l.length;l=l.map((function(e){return e.map((function(e){return e/u}))}));let d=function(e=1){return()=>{e=e+1831565813|0;let t=Math.imul(e^e>>>15,1|e);return t=Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}((t.seed??Math.random())*2**32>>>0);var m,p;for(a=0;a<n;++a){var h=(0,mo.zeros)(2*l.length).map((()=>d()));p=(0,mo.conjugateGradient)(((e,t)=>_o(e,t,l,c)),h,t),(!m||p.fx<m.fx)&&(m=p)}var g=m?.x,f={};for(a=0;a<r.length;++a){var y=r[a];let e=y?.sets[0];void 0===y||void 0===e||(f[e]={x:g[2*a]*u,y:g[2*a+1]*u,radius:Math.sqrt(y.size/Math.PI),setid:e,size:y.size,rowid:Object.keys(f).length})}if(t.history)for(let e of t.history)(0,mo.scale)(e.x,u);return f}function Oo(e,t){for(var a,n=$o,r={},i={},o=0;o<e.length;++o){var s=e[o];1==s.sets.length&&(a=s.sets[0],r[a]={x:1e10,y:1e10,rowid:Object.keys(r).length,size:s.size,setid:a,radius:Math.sqrt(s.size/Math.PI)},i[a]=[])}for(e=e.filter((function(e){return 2==e.sets.length})),o=0;o<e.length;++o){var l=e[o],c=l.weight?l.weight:1,u=l.sets[0],d=l.sets[1];if(void 0===u||void 0===d)continue;let t=r[u],a=r[d];!t.size||!a.size||(l.size+So>=Math.min(t.size,a.size)&&(c=0),i[u]?.push({set:d,size:l.size,weight:c}),i[d]?.push({set:u,size:l.size,weight:c}))}var m=[];for(a in i){let e=i[a];if(e){var p=0;for(o=0;o<e.length;++o){let t=e[o];t&&(p+=t.size*t.weight)}m.push({set:a,size:p})}}m.sort(((e,t)=>t.size-e.size));var h={};function g(e){return e.set in h}function f(e,t){let a=r[t];a&&(a.x=e.x,a.y=e.y),h[t]=!0}for(f({x:0,y:0},m[0]?.set??""),o=1;o<m.length;++o){var y=m[o]?.set,v=y?i[y]?.filter(g):null;let t=y?r[y]:null;if(v?.sort(((e,t)=>t.size-e.size)),0===v?.length||!v)throw"ERROR: missing pairwise overlap information";for(var b=[],S=0;S<v.length;++S){let e=v[S];if(!e)continue;var E=r[v[S].set];if(!E)continue;let a=Eo(t.radius,E.radius,e.size);b.push({x:E.x+a,y:E.y}),b.push({x:E.x-a,y:E.y}),b.push({y:E.y+a,x:E.x}),b.push({y:E.y-a,x:E.x});for(var _=S+1;_<v.length;++_)for(var T=r[v[_].set],O=Eo(t.radius,T.radius,v[_].size),$=yo({x:E.x,y:E.y,radius:a},{x:T.x,y:T.y,radius:O}),x=0;x<$.length;++x)b.push($[x])}var I=1e50,L=b[0];for(S=0;S<b.length;++S){r[y].x=b[S].x,r[y].y=b[S].y;var A=n(r,e);A<I&&(I=A,L=b[S])}f(L,y)}return r}function $o(e,t){for(var a,n=0,r=0;r<t.length;++r){var i,o=t[r];if(o&&1!==o.sets.length){if(2===o.sets.length){var s=e[o.sets[0]],l=e[o.sets[1]];if(void 0===s||void 0===l)continue;i=fo(s.radius,l.radius,go(s,l))}else i=po((a=o.sets,a.map((function(t){return e[t]})))).overlap;n+=(o.weight?o.weight:1)*(i-o.size)*(i-o.size)}}return n}function xo(e,t,a){var n;if(null===a?e.sort((function(e,t){return t.radius-e.radius})):e.sort(a),e.length>0){var r=e[0].x,i=e[0].y;for(n=0;n<e.length;++n)e[n].x-=r,e[n].y-=i}if(2==e.length){let t=e[0],a=e[1];t&&a&&go(t,a)<Math.abs(a.radius-t.radius)&&(a.x=t.x+t.radius-a.radius-1e-10,a.y=a.y)}if(e.length>1){var o,s,l=Math.atan2(e[1].x,e[1].y)-(t??0),c=Math.cos(l),u=Math.sin(l);for(n=0;n<e.length;++n){let t=e[n];t&&(o=t.x,s=t.y,t.x=c*o-u*s,t.y=u*o+c*s)}}if(e.length>2){for(var d=Math.atan2(e[2].x,e[2].y)-(t??0);d<0;)d+=2*Math.PI;for(;d>2*Math.PI;)d-=2*Math.PI;if(d>Math.PI){var m=e[1].y/(1e-10+e[1].x);for(n=0;n<e.length;++n){let t=e[n];if(t){var p=(t.x+m*t.y)/(1+m*m);t.x=2*p-t.x,t.y=2*p*m-t.y}}}}}function Io(e){var t=function(t){return{max:Math.max.apply(null,e.map((function(e){return e[t]+e.radius}))),min:Math.min.apply(null,e.map((function(e){return e[t]-e.radius})))}};return{xRange:t("x"),yRange:t("y")}}function Lo(e,{layout:t,height:a,width:n,padding:r,seed:i,orientation:o,set_id_delimiter:s,orientationOrder:l}){let c=e.filter((e=>0!==e.size&&e.sets.length>0));if(0===c.length)return{circles:[],intersections:[]};let u=function(e,t){(t=t??{}).maxIterations=t.maxIterations||500,t.seed=t.seed??Math.random();let a=bo.get(t.layout??"best");var n=$o;e=function(e){e=e.slice();var t,a,n,r,i=[],o={};for(let t of e)1==t.sets.length?i.push(t.sets[0]):2==t.sets.length&&(o[`${n=t.sets[0]},${r=t.sets[1]}`]=!0,o[`${r},${n}`]=!0);for(i.sort(((e,t)=>e.toString().localeCompare(t.toString()))),t=0;t<i.length;++t)for(n=i[t],a=t+1;a<i.length;++a)`${n},${r=i[a]}`in o||e.push({sets:[n,r],size:0});return e}(e);var r=a(e,t),i=[],o=[];for(let e of Object.keys(r)){let t=r[e];t&&(i.push(t.x),i.push(t.y),o.push(e))}for(var s=(0,mo.nelderMead)((function(t){for(var a={},i=0;i<o.length;++i){var s=o[i];let e=r[s];a[s]={x:t[2*i],y:t[2*i+1],radius:e.radius,setid:s,size:e.size,rowid:e.rowid}}return n(a,e)}),i,t).x,l=0;l<o.length;++l){let e=o[l],t=r[e];t.x=s[2*l],t.y=s[2*l+1]}return r}(c,{layout:t,seed:i});o!==Math.PI/2&&(u=function(e,t,a){null===t&&(t=Math.PI/2);var n,r,i=[];for(r in e){var o=e[r];o&&i.push({...o,setid:r})}var s=function(e){function t(e){if(e)return e.parent!==e&&(e.parent=t(e.parent)),e.parent}function a(e,a){var n=t(e),r=t(a);n&&(n.parent=r)}e.map((function(e){e.parent=e}));for(var n=0;n<e.length;++n)for(var r=n+1;r<e.length;++r){let t=e[n],o=e[r];if(t&&o){var i=t.radius+o.radius;go(t,o)+1e-10<i&&a(o,t)}}var o,s={};for(n=0;n<e.length;++n){let a=e[n];if(!a)continue;let r=t(e[n])?.parent?.setid;r&&(r in s||(s[r]=[]),s[r]&&s[r].push(a))}e.map((function(e){delete e.parent}));var l=[];for(o in s){let e=s[o];e&&l.push(e)}return l}(i);for(n=0;n<s.length;++n){let e=s[n];if(e){xo(e,t,a);var l=Io(e);e.size=(l.xRange.max-l.xRange.min)*(l.yRange.max-l.yRange.min),e.bounds=l}}s.sort((function(e,t){return e.size&&t.size?t.size-e.size:0}));var c=s[0].bounds,u=(c.xRange.max-c.xRange.min)/50;function d(e,t,a){if(e&&e.size&&e.bounds){var n,r,o,s=e.bounds;t?n=c.xRange.max-s.xRange.min+u:(n=c.xRange.max-s.xRange.max,(o=(s.xRange.max-s.xRange.min)/2-(c.xRange.max-c.xRange.min)/2)<0&&(n+=o)),a?r=c.yRange.max-s.yRange.min+u:(r=c.yRange.max-s.yRange.max,(o=(s.yRange.max-s.yRange.min)/2-(c.yRange.max-c.yRange.min)/2)<0&&(r+=o));for(var l=0;l<e.length;++l){let t=e[l];t&&(t.x+=n,t.y+=r,i.push(t))}}}for(var m=1;m<s.length;)d(s[m],!0,!1),d(s[m+1],!1,!0),d(s[m+2],!0,!0),m+=3,c=Io(i);var p={};for(let e of i)p[e.setid]=e;return p}(u,o,l)),u=function(e,t,a,n){var r=[],i=[];for(var o in e){let t=e[o];t&&(i.push(o),r.push(t))}t-=2*n,a-=2*n;var s=Io(r),l=s.xRange,c=s.yRange;if(l.max==l.min||c.max==c.min)return e;for(var u=t/(l.max-l.min),d=a/(c.max-c.min),m=Math.min(d,u),p=(t-(l.max-l.min)*m)/2,h=(a-(c.max-c.min)*m)/2,g={},f=0;f<r.length;++f){var y=r[f];let e=i[f];!y||!e||(g[e]={...y,radius:m*y.radius,x:n+p+(y.x-l.min)*m,y:n+h+(y.y-c.min)*m})}return g}(u,n,a,r);let d=function(e,t,a=","){for(var n={},r=function(e){var t={},a=Object.keys(e);a.forEach((e=>t[e]=[]));for(var n=0;n<a.length;n++)for(var r=e[a[n]],i=n+1;i<a.length;++i){var o=e[a[i]],s=go(r,o);s+o.radius<=r.radius+1e-10?t[a[i]].push(a[n]):s+r.radius<=o.radius+1e-10&&t[a[n]].push(a[i])}return t}(e),i=0;i<t.length;++i){for(var o=t[i].sets,s={},l={},c=0;c<o.length;++c){s[o[c]]=!0;var u=r[o[c]];if(u)for(var d=0;d<u.length;++d)l[u[d]]=!0}var m=[],p=[];for(var h in e)h in s?m.push(e[h]):h in l||p.push(e[h]);var g=Do(m,p);n[o.join(a)]=g,g.disjoint&&t[i].size>0&&console.log("WARNING: area "+o+" not represented on screen")}return n}(u,c),m=c.map((e=>{let t=e.sets.join(","),{x:a,y:n,disjoint:r}=d[t];return{set_id:e.sets.join(s),sets:e.sets,path:Ao(e.sets.map((e=>u[e]))),textX:r?void 0:a,textY:r?void 0:n,size:e.size}})).filter((e=>e.sets.length>1));return{circles:Object.entries(u).map((([e,t])=>({set_id:e,x:t.x,y:t.y,size:Math.pow(2*t.radius,2),textX:d[e].x,textY:d[e].y}))),intersections:m}}function Ao(e){let{stats:t}=po(e);var a=t.arcs;if(0===a.length)return"M 0 0";if(1===a.length){var n=a[0].circle;return function(e,t,a){var n=[];return n.push("\nM",e.toString(),t.toString()),n.push("\nm",-a,0),n.push("\na",a,a,0,1,0,2*a,0),n.push("\na",a,a,0,1,0,2*-a,0),n.join(" ")}(n.x,n.y,n.radius)}var r=["\nM",a[0].p2.x,a[0].p2.y];for(let e of a){let t=e.circle.radius,a=e.width>t;r.push("\nA",t,t,0,a?1:0,1,e.p1.x,e.p1.y)}return r.join(" ")}function Do(e,t){var a,n=[];for(a=0;a<e.length;++a){var r=e[a];r&&(n.push({x:r.x,y:r.y}),n.push({x:r.x+r.radius/2,y:r.y}),n.push({x:r.x-r.radius/2,y:r.y}),n.push({x:r.x,y:r.y+r.radius/2}),n.push({x:r.x,y:r.y-r.radius/2}))}var i=n[0],o=Ro(n[0],e,t);for(a=1;a<n.length;++a){var s=Ro(n[a],e,t);s>=o&&(i=n[a],o=s)}var l=(0,mo.nelderMead)((function(a){return-1*Ro({x:a[0],y:a[1]},e,t)}),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,c={x:l[0],y:l[1]},u=!0;for(a=0;a<e.length;++a)if(go(c,e[a])>e[a].radius){u=!1;break}for(a=0;a<t.length;++a)if(go(c,t[a])<t[a].radius){u=!1;break}if(!u)if(1==e.length)c={x:e[0].x,y:e[0].y};else{let{stats:a}=po(e);c=0===a.arcs.length?{x:0,y:-1e3,disjoint:!0}:1===a.arcs.length?{x:a.arcs[0].circle.x,y:a.arcs[0].circle.y}:t.length?Do(e,[]):vo(a.arcs.map((function(e){return e.p1})))}return c}function Ro(e,t,a){var n,r,i=t[0].radius-go(t[0],e);for(n=1;n<t.length;++n)(r=t[n].radius-go(t[n],e))<=i&&(i=r);for(n=0;n<a.length;++n)(r=go(a[n],e)-a[n].radius)<=i&&(i=r);return i}const Mo=(e,t)=>{const{label:a}=e;return{type:"text",from:{data:t},interactive:!1,encode:{enter:{x:{field:"textX"},y:{field:"textY"},text:{field:`table_data.${a}`},align:{value:"center"},baseline:{value:"middle"}},update:{opacity:Ke(e)}}}},Co=new Map([["0deg",Math.PI/2],["90deg",0],["180deg",-3*Math.PI/2],["270deg",-Math.PI]]);const No=U(((e,t)=>{var a,n,r,i,{chartPopovers:o=[],chartTooltips:s=[],color:l=V.DEFAULT_VENN_COLOR,colorScheme:c=V.DEFAULT_COLOR_SCHEME,index:u=0,label:d=V.DEFAULT_VENN_LABEL,metric:m=V.DEFAULT_VENN_METRIC,name:p,orientation:h="0deg",chartHeight:g=100,chartWidth:f=100,data:y=[]}=t,v=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]])}return a}(t,["chartPopovers","chartTooltips","color","colorScheme","index","label","metric","name","orientation","chartHeight","chartWidth","data"]);const b=Object.assign({chartPopovers:o,chartTooltips:s,chartWidth:f,chartHeight:g,data:y,index:u,colorScheme:c,color:l,label:d,orientation:h,metric:m,name:(0,J.toCamelCase)(null!=p?p:`venn${u}`)},v);e.data=jo(null!==(a=e.data)&&void 0!==a?a:[],b),e.signals=Go(null!==(n=e.signals)&&void 0!==n?n:[],b),e.scales=Po(null!==(r=e.scales)&&void 0!==r?r:[]),e.marks=ko(null!==(i=e.marks)&&void 0!==i?i:[],b)})),jo=U(((e,t)=>{var a,n;const{circles:r,intersections:i}=(e=>{const{orientation:t,chartWidth:a,chartHeight:n}=e;return Lo((e=>{const{data:t,metric:a,color:n}=e;return t.map((e=>{const t=Object.assign({},e);if(void 0===t[a])throw new Error("set the metric prop to the default 'size' or set your own");if(a!==V.DEFAULT_VENN_METRIC&&"number"==typeof t[a]&&(t.size=e[a]),void 0===t[n])throw new Error("set the color prop to the default 'sets' or set your own");return n!==V.DEFAULT_VENN_COLOR&&Array.isArray(t[n])&&(t.sets=structuredClone(e[n])),{size:t.size,sets:t.sets}})).filter((e=>e.sets.length>0))})(e),{orientation:Co.get(t),layout:"greedy",width:a,height:n,set_id_delimiter:"∩",padding:0})})(t);e.push({name:"circles",values:r,transform:[...wo(),{type:"formula",as:"strokeSize",expr:"datum.size * 1"},{type:"filter",expr:"indexof(hiddenSeries, datum.table_data.rscSeriesId) === -1"}]}),e.push({name:"intersections",values:i,transform:[...wo(),...Fo()]});const o=e.findIndex((e=>e.name===V.TABLE));e[o].transform=null!==(a=e[o].transform)&&void 0!==a?a:[],null===(n=e[o].transform)||void 0===n||n.push(...Ho(t))})),ko=U(((e,t)=>{e.push((e=>{const{colorScheme:t,idKey:a}=e;return{type:"symbol",name:`${e.name}_circle_strokes`,from:{data:"circles"},interactive:!1,encode:{enter:{x:{field:"x"},y:{field:"y"},size:{field:"size"},shape:{value:"circle"},stroke:{value:(0,W.getColorValue)("static-blue",t)},strokeWidth:{value:6}},update:{strokeOpacity:[{test:`${V.SELECTED_ITEM} === datum.${a}`,value:1},{value:0}]}}}})(t)),e.push((e=>{const{name:t,colorScheme:a,chartTooltips:n,chartPopovers:r}=e;return{type:"symbol",name:t,from:{data:"circles"},encode:{enter:{x:{field:"x"},y:{field:"y"},tooltip:De(n,t),size:{field:"size"},shape:{value:"circle"},fill:je("set_id",a),stroke:{signal:"chartBackgroundColor"},strokeWidth:{value:2}},update:{opacity:Ke(e),cursor:Ae(r)}}}})(t)),e.push((e=>{const{name:t,idKey:a,colorScheme:n}=e;return{type:"path",from:{data:"intersections"},name:`${t}_intersections_strokes`,interactive:!1,encode:{enter:{path:{field:"path"},strokeWidth:{value:6},strokeCap:{value:"round"},stroke:{value:(0,W.getColorValue)("static-blue",n)}},update:{strokeOpacity:[{test:`${V.SELECTED_ITEM} === datum.${a}`,value:1},{value:0}]}}}})(t)),e.push((e=>{const{name:t,chartTooltips:a,colorScheme:n,chartPopovers:r}=e;return{type:"path",from:{data:"intersections"},name:`${t}_intersections`,encode:{enter:{path:{field:"path"},fill:je("set_id",n),strokeWidth:{value:2},stroke:{signal:"chartBackgroundColor"},strokeCap:{value:"square"},tooltip:De(a,`${t}`)},update:{opacity:Ke(e),cursor:Ae(r)}}}})(t)),e.push(Mo(t,"circles"),Mo(t,"intersections"))})),Po=U((e=>{Ee(e,V.COLOR_SCALE,"set_legend"),Ee(e,V.COLOR_SCALE,"set_id")})),Ho=e=>[{type:"formula",as:"set_id",expr:`join(datum.${e.color}, '∩')`},{type:"formula",as:"set_legend",expr:`length(datum.${e.color}) > 1 ? datum.${e.color}[0]: join(datum.${e.color}, '∩')`}],wo=()=>[{type:"lookup",key:"set_id",fields:["set_id"],from:V.TABLE,as:["table_data"]},{type:"formula",as:"rscSeriesId",expr:"datum.table_data.set_id"},{type:"formula",expr:"datum.table_data.rscMarkId",as:"rscMarkId"}],Fo=()=>[{type:"formula",as:"hidden",expr:"hiddenSeries"},{type:"flatten",fields:["sets"],as:["intersect_set"]},{type:"formula",as:"hide_intersection",expr:"indexof(datum.hidden, datum.intersect_set) === -1 ? 0 : 1"},{type:"joinaggregate",groupby:["set_id"],fields:["hide_intersection"],ops:["sum"]},{type:"filter",expr:"datum.sum_hide_intersection === 0"},{type:"window",groupby:["set_id"],ops:["row_number"],as:["row_num"]},{type:"filter",expr:"datum.row_num === 1"}],Go=U(((e,t)=>{var a,n;const{chartTooltips:r,name:i,idKey:o}=t;Me(t)&&(lt(e,i,o,1,null===(a=r[0])||void 0===a?void 0:a.excludeDataKeys),lt(e,`${i}_intersections`,o,1,null===(n=r[0])||void 0===n?void 0:n.excludeDataKeys))}));function zo({axes:e=[],backgroundColor:t=V.DEFAULT_BACKGROUND_COLOR,chartHeight:a,chartWidth:n,colors:r="categorical12",colorScheme:i=V.DEFAULT_COLOR_SCHEME,data:o,description:s,hiddenSeries:l=[],highlightedItem:c,highlightedSeries:u,idKey:d=V.MARK_ID,legends:m=[],lineTypes:p=V.DEFAULT_LINE_TYPES,lineWidths:h=["M"],marks:g=[],opacities:f,symbolShapes:y=["rounded-square"],symbolSizes:v=["XS","XL"],title:b,titles:S=[]}){var E,_;const T={axes:e,backgroundColor:t,chartHeight:a,chartWidth:n,colors:r,colorScheme:i,data:o,description:s,hiddenSeries:l,highlightedItem:c,highlightedSeries:u,idKey:d,legends:m,lineTypes:p,lineWidths:h,marks:g,opacities:f,symbolShapes:y,symbolSizes:v,title:b,titles:S};let O=ue(null,{backgroundColor:t,colorScheme:i,description:s,title:b});O.signals=Vo(T),O.scales=Ko(r,i,p,h,f,y,v);let{areaCount:$,barCount:x,bulletCount:I,comboCount:L,donutCount:A,lineCount:D,scatterCount:R,vennCount:M}=Uo();const C={colorScheme:i,idKey:d,highlightedItem:c};return O=[...g].reduce(((e,t)=>{switch(t.markType){case"area":return $++,pt(e,Object.assign(Object.assign(Object.assign({},t),C),{index:$}));case"bar":return x++,gr(e,Object.assign(Object.assign(Object.assign({},t),C),{index:x}));case"bullet":return I++,Cr(e,Object.assign(Object.assign(Object.assign({},t),C),{index:I}));case"combo":return L++,Kr(e,Object.assign(Object.assign(Object.assign({},t),C),{index:L}));case"donut":return A++,hi(e,Object.assign(Object.assign(Object.assign({},t),C),{index:A}));case"line":return D++,zr(e,Object.assign(Object.assign(Object.assign({},t),C),{index:D}));case"scatter":return R++,oo(e,Object.assign(Object.assign(Object.assign({},t),C),{index:R}));case"venn":return M++,No(e,Object.assign(Object.assign(Object.assign({},t),C),{index:M,data:o,chartWidth:n,chartHeight:a}));case"bigNumber":return e;default:return console.error(`Invalid component type: ${t} is not a supported chart mark option child`),e}}),O),O=[...m].reduce(((e,t,a)=>Gi(e,Object.assign(Object.assign(Object.assign({},t),C),{index:a,hiddenSeries:l,highlightedSeries:u}))),O),O=[...e].reduce(((e,t,a)=>ca(e,Object.assign(Object.assign(Object.assign({},t),C),{index:a}))),O),S.length&&(O=uo(O,S[0])),O=JSON.parse(JSON.stringify(O)),O.data=os(null!==(E=O.data)&&void 0!==E?E:[],{facets:ae(O.scales)}),u&&Si(null!==(_=O.marks)&&void 0!==_?_:[]),O=Bo(O),ps(O)}const Bo=U((e=>{var t;e.scales=null===(t=e.scales)||void 0===t?void 0:t.filter((e=>!("domain"in e&&e.domain&&"fields"in e.domain&&0===e.domain.fields.length)))})),Uo=()=>({areaCount:-1,barCount:-1,comboCount:-1,donutCount:-1,bulletCount:-1,lineCount:-1,scatterCount:-1,vennCount:-1}),Vo=({backgroundColor:e,colors:t,colorScheme:a,lineTypes:n,opacities:r,hiddenSeries:i,highlightedItem:o,highlightedSeries:s})=>{const l="transparent"===e?"gray-50":e;return[st(V.BACKGROUND_COLOR,(0,W.getColorValue)(l,a)),st("colors",Wo(t,a)),st("lineTypes",Jo(n)),st("opacities",Yo(r)),st("hiddenSeries",null!=i?i:[]),st(V.HIGHLIGHTED_ITEM,o),st(V.HIGHLIGHTED_GROUP),st(V.HIGHLIGHTED_SERIES,s),st(V.SELECTED_ITEM),st(V.SELECTED_SERIES),st(V.SELECTED_GROUP)]},Wo=(e,t)=>ls(e)?rs(e,t).map((e=>[e])):e.map((e=>rs(e,t))),Jo=e=>cs(e)?is(e).map((e=>[e])):e.map((e=>is(e))),Yo=e=>e?ds(e)?e.map((e=>[e])):e:[[1]],Ko=(e,t,a,n,r,i,o)=>[Xo(e,t),qo(e,t),Zo(a),as(n),ns(r),Qo(i),es(o),ts(o)],Xo=(e,t)=>{const a=ls(e)?rs(e,t):e.map((e=>rs(e,t)[0]));return Ie("color",a)},qo=(e,t)=>{const a=ls(e)?rs(e,t):e.map((e=>rs(e,t)[0]));return{name:V.LINEAR_COLOR_SCALE,type:"linear",range:a,domain:{data:V.TABLE,fields:[]}}},Zo=e=>{const t=cs(e)?is(e):e.map((e=>ne(e[0])));return Ie(V.LINE_TYPE_SCALE,t)},Qo=e=>{const t=ms(e)?function(e){return e.map((e=>ie(e)))}(e):e.map((e=>ie(e[0])));return Ie(V.SYMBOL_SHAPE_SCALE,t)},es=e=>({name:V.SYMBOL_SIZE_SCALE,type:"linear",zero:!1,range:e.map((e=>se(e))),domain:{data:V.TABLE,fields:[]}}),ts=e=>({name:V.SYMBOL_PATH_WIDTH_SCALE,type:"linear",zero:!1,range:e.map((e=>le(e))),domain:{data:V.TABLE,fields:[]}}),as=e=>{const t=e.map((e=>re(e)));return Ie(V.LINE_WIDTH_SCALE,t)},ns=e=>{if(null==e?void 0:e.length){const t=ds(e)?e:e.map((e=>e[0]));return Ie(V.OPACITY_SCALE,t)}return{name:V.OPACITY_SCALE,type:"point",range:[1,0],padding:1,align:1,domain:{data:V.TABLE,fields:[]}}};function rs(e,t){return Array.isArray(e)?e.map((e=>(0,W.getColorValue)(e,t))):W.colorSchemes[e]}function is(e){return e.map((e=>ne(e)))}const os=U(((e,{facets:t})=>{var a,n,r;if(0===t.length)return;null===(n=null===(a=e[0])||void 0===a?void 0:a.transform)||void 0===n||n.push(...Z(t));const i=e.findIndex((e=>e.name===V.FILTERED_TABLE));-1!==i&&(e[i].transform=[{type:"filter",expr:`indexof(hiddenSeries, datum.${V.SERIES_ID}) === -1`},...null!==(r=e[i].transform)&&void 0!==r?r:[]])})),ss=e=>Boolean(!Array.isArray(e)&&e in W.colorSchemes),ls=e=>ss(e)||e.some((e=>!ss(e)&&"string"==typeof e)),cs=e=>e.some((e=>"string"==typeof e||us(e))),us=e=>Array.isArray(e)&&!e.some((e=>"number"!=typeof e)),ds=e=>!e.some((e=>Array.isArray(e))),ms=e=>!e.some((e=>Array.isArray(e))),ps=e=>"function"==typeof structuredClone?structuredClone(e):JSON.parse(JSON.stringify(e));function hs(e,t){if((a=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var a,n=e.slice(0,a);return[n.length>1?n[0]+n.slice(2):n,+e.slice(a+1)]}V.MARK_ID,V.SERIES_ID,V.TRENDLINE_VALUE,V.GROUP_DATA;var gs,fs=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ys(e){if(!(t=fs.exec(e)))throw new Error("invalid format: "+e);var t;return new vs({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function vs(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function bs(e,t){var a=hs(e,t);if(!a)return e+"";var n=a[0],r=a[1];return r<0?"0."+new Array(-r).join("0")+n:n.length>r+1?n.slice(0,r+1)+"."+n.slice(r+1):n+new Array(r-n.length+2).join("0")}ys.prototype=vs.prototype,vs.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const Ss={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>bs(100*e,t),r:bs,s:function(e,t){var a=hs(e,t);if(!a)return e+"";var n=a[0],r=a[1],i=r-(gs=3*Math.max(-8,Math.min(8,Math.floor(r/3))))+1,o=n.length;return i===o?n:i>o?n+new Array(i-o+1).join("0"):i>0?n.slice(0,i)+"."+n.slice(i):"0."+new Array(1-i).join("0")+hs(e,Math.max(0,t+i-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Es(e){return e}var _s=Array.prototype.map,Ts=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Os(e){var t,a,n=void 0===e.grouping||void 0===e.thousands?Es:(t=_s.call(e.grouping,Number),a=e.thousands+"",function(e,n){for(var r=e.length,i=[],o=0,s=t[0],l=0;r>0&&s>0&&(l+s+1>n&&(s=Math.max(1,n-l)),i.push(e.substring(r-=s,r+s)),!((l+=s+1)>n));)s=t[o=(o+1)%t.length];return i.reverse().join(a)}),r=void 0===e.currency?"":e.currency[0]+"",i=void 0===e.currency?"":e.currency[1]+"",o=void 0===e.decimal?".":e.decimal+"",s=void 0===e.numerals?Es:function(e){return function(t){return t.replace(/[0-9]/g,(function(t){return e[+t]}))}}(_s.call(e.numerals,String)),l=void 0===e.percent?"%":e.percent+"",c=void 0===e.minus?"−":e.minus+"",u=void 0===e.nan?"NaN":e.nan+"";function d(e){var t=(e=ys(e)).fill,a=e.align,d=e.sign,m=e.symbol,p=e.zero,h=e.width,g=e.comma,f=e.precision,y=e.trim,v=e.type;"n"===v?(g=!0,v="g"):Ss[v]||(void 0===f&&(f=12),y=!0,v="g"),(p||"0"===t&&"="===a)&&(p=!0,t="0",a="=");var b="$"===m?r:"#"===m&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",S="$"===m?i:/[%p]/.test(v)?l:"",E=Ss[v],_=/[defgprs%]/.test(v);function T(e){var r,i,l,m=b,T=S;if("c"===v)T=E(e)+T,e="";else{var O=(e=+e)<0||1/e<0;if(e=isNaN(e)?u:E(Math.abs(e),f),y&&(e=function(e){e:for(var t,a=e.length,n=1,r=-1;n<a;++n)switch(e[n]){case".":r=t=n;break;case"0":0===r&&(r=n),t=n;break;default:if(!+e[n])break e;r>0&&(r=0)}return r>0?e.slice(0,r)+e.slice(t+1):e}(e)),O&&0==+e&&"+"!==d&&(O=!1),m=(O?"("===d?d:c:"-"===d||"("===d?"":d)+m,T=("s"===v?Ts[8+gs/3]:"")+T+(O&&"("===d?")":""),_)for(r=-1,i=e.length;++r<i;)if(48>(l=e.charCodeAt(r))||l>57){T=(46===l?o+e.slice(r+1):e.slice(r))+T,e=e.slice(0,r);break}}g&&!p&&(e=n(e,1/0));var $=m.length+e.length+T.length,x=$<h?new Array(h-$+1).join(t):"";switch(g&&p&&(e=n(x+e,x.length?h-T.length:1/0),x=""),a){case"<":e=m+e+T+x;break;case"=":e=m+x+e+T;break;case"^":e=x.slice(0,$=x.length>>1)+m+e+T+x.slice($);break;default:e=x+m+e+T}return s(e)}return f=void 0===f?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,f)):Math.max(0,Math.min(20,f)),T.toString=function(){return e+""},T}return{format:d,formatPrefix:function(e,t){var a,n=d(((e=ys(e)).type="f",e)),r=3*Math.max(-8,Math.min(8,Math.floor((a=t,((a=hs(Math.abs(a)))?a[1]:NaN)/3)))),i=Math.pow(10,-r),o=Ts[8+r/3];return function(e){return n(i*e)+o}}}}var $s=i(542);const xs=(e="en-US")=>{const{number:t}=(0,$s.getLocale)(e),a="string"==typeof e?e:null==e?void 0:e.number;return{formatTimeDurationLabels:Rs(t),formatLocaleCurrency:Ls(t),formatShortNumber:Is(a),consoleLog:Ms,formatHorizontalTimeAxisLabels:As(),formatVerticalAxisTimeLabels:Ds(),getLabelWidth:Cs,truncateText:Ns}},Is=e=>{const t="string"==typeof e?e:navigator.language,a="object"==typeof e?e.decimal:void 0;return e=>{const n=new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(1.1).replace(/\d/g,""),r=Intl.NumberFormat(t,{notation:"compact"}).format(e);return a?r.replace(n,a):r}},Ls=(e=$s.numberLocales["en-US"])=>({value:t},a,n,r)=>{if("string"==typeof t)return t;try{const i={style:"currency",currency:n,maximumFractionDigits:0},o=new Intl.NumberFormat(a,i).format(0);let s=2;"currency"!==r&&(s=parseInt(r.split(".")[1].replace("f","")));const l=Os(e);return o.replace("0",l.format(`,.${s}f`)(t))}catch(a){return console.error("Error formatting currency: ",a),Os(e).format("$,.2f")(t)}},As=()=>{let e;return t=>{const a=0===t.index||e!==t.label;return e=t.label,a?t.label:""}},Ds=()=>{let e;return t=>{const a=t.label.split(" "),n=a[0],r=0===t.index||e!==n;return e=n,r?t.label:a[1]}},Rs=(e=$s.numberLocales["en-US"])=>{const t=Os(e),a=t.format("02,d"),n=t.format(",d");return({value:e})=>{if("string"==typeof e)return e;const t=e<0?"-":"",r=Math.abs(e),i=a(Math.floor(r%60));return r<3600?`${t}${n(Math.floor(r/60))}:${i}`:`${t}${n(Math.floor(r/60/60))}:${a(Math.floor(r/60%60))}:${i}`}},Ms=e=>(console.log(e),e),Cs=(e,t="bold",a=12)=>{const n=document.createElement("canvas").getContext("2d");return null===n?0:(n.font=`${t} ${a}px ${W.ADOBE_CLEAN_FONT}`,n.measureText(e).width)},Ns=(e,t,a="normal",n=12)=>{t-=4;const r=Cs(e,a,n),i=Cs("…",a,n);if(r<=t)return e;let o=e.slice(0,e.length-1).trim();for(let e=o.length;e>0&&(o=o.slice(0,o.length-1).trim(),!(Cs(o,a,n)+i<=t));e--);return 0===o.length?e:o+"…"},js={consoleLog:Ms,formatHorizontalTimeAxisLabels:As(),formatVerticalAxisTimeLabels:Ds(),getLabelWidth:Cs,truncateText:Ns},ks=({locale:e="en-US",height:t=400,width:a=600,padding:n=0,renderer:r="svg",config:i,colorScheme:o=V.DEFAULT_COLOR_SCHEME})=>{const s=xs(e),{number:l,time:c}=(0,$s.getLocale)(e);return{actions:!1,ast:!0,expressionFunctions:s,formatLocale:l,height:t,width:a,padding:n,renderer:r,timeFormatLocale:c,config:null!=i?i:he(void 0,o)}}})(),o})()));
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@spectrum-charts/constants"),require("@spectrum-charts/themes"),require("@spectrum-charts/utils")):"function"==typeof define&&define.amd?define(["@spectrum-charts/constants","@spectrum-charts/themes","@spectrum-charts/utils"],t):"object"==typeof exports?exports.spectrumChartsVegaSpecBuilder=t(require("@spectrum-charts/constants"),require("@spectrum-charts/themes"),require("@spectrum-charts/utils")):e.spectrumChartsVegaSpecBuilder=t(e["@spectrum-charts/constants"],e["@spectrum-charts/themes"],e["@spectrum-charts/utils"])}(this,((e,t,a)=>(()=>{var n={743:e=>{"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===a}(e)}(e)},a="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function n(e,t){return!1!==t.clone&&t.isMergeableObject(e)?s((a=e,Array.isArray(a)?[]:{}),e,t):e;var a}function r(e,t,a){return e.concat(t).map((function(e){return n(e,a)}))}function i(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return Object.propertyIsEnumerable.call(e,t)})):[]}(e))}function o(e,t){try{return t in e}catch(e){return!1}}function s(e,a,l){(l=l||{}).arrayMerge=l.arrayMerge||r,l.isMergeableObject=l.isMergeableObject||t,l.cloneUnlessOtherwiseSpecified=n;var c=Array.isArray(a);return c===Array.isArray(e)?c?l.arrayMerge(e,a,l):function(e,t,a){var r={};return a.isMergeableObject(e)&&i(e).forEach((function(t){r[t]=n(e[t],a)})),i(t).forEach((function(i){(function(e,t){return o(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,i)||(o(e,i)&&a.isMergeableObject(t[i])?r[i]=function(e,t){if(!t.customMerge)return s;var a=t.customMerge(e);return"function"==typeof a?a:s}(i,a)(e[i],t[i],a):r[i]=n(t[i],a))})),r}(e,a,l):n(a,l)}s.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,a){return s(e,a,t)}),{})};var l=s;e.exports=l},561:function(e,t){!function(e){"use strict";function t(e){for(var t=new Array(e),a=0;a<e;++a)t[a]=0;return t}function a(e,t){for(var a=0,n=0;n<e.length;++n)a+=e[n]*t[n];return a}function n(e){return Math.sqrt(a(e,e))}function r(e,t,a){for(var n=0;n<t.length;++n)e[n]=t[n]*a}function i(e,t,a,n,r){for(var i=0;i<e.length;++i)e[i]=t*a[i]+n*r[i]}function o(e,t,n,r,o,s,l){var c=n.fx,u=a(n.fxprime,t),d=c,m=c,p=u,h=0;function g(m,h,g){for(var f=0;f<16;++f)if(o=(m+h)/2,i(r.x,1,n.x,o,t),d=r.fx=e(r.x,r.fxprime),p=a(r.fxprime,t),d>c+s*o*u||d>=g)h=o;else{if(Math.abs(p)<=-l*u)return o;p*(h-m)>=0&&(h=m),m=o,g=d}return 0}o=o||1,s=s||1e-6,l=l||.1;for(var f=0;f<10;++f){if(i(r.x,1,n.x,o,t),d=r.fx=e(r.x,r.fxprime),p=a(r.fxprime,t),d>c+s*o*u||f&&d>=m)return g(h,o,m);if(Math.abs(p)<=-l*u)return o;if(p>=0)return g(o,h,d);m=d,h=o,o*=2}return o}e.bisect=function(e,t,a,n){var r=(n=n||{}).maxIterations||100,i=n.tolerance||1e-10,o=e(t),s=e(a),l=a-t;if(o*s>0)throw"Initial bisect points must have opposite signs";if(0===o)return t;if(0===s)return a;for(var c=0;c<r;++c){var u=t+(l/=2),d=e(u);if(d*o>=0&&(t=u),Math.abs(l)<i||0===d)return u}return t+l},e.nelderMead=function(e,t,a){var n,r=(a=a||{}).maxIterations||200*t.length,o=a.nonZeroDelta||1.05,s=a.zeroDelta||.001,l=a.minErrorDelta||1e-6,c=a.minErrorDelta||1e-5,u=void 0!==a.rho?a.rho:1,d=void 0!==a.chi?a.chi:2,m=void 0!==a.psi?a.psi:-.5,p=void 0!==a.sigma?a.sigma:.5,h=t.length,g=new Array(h+1);g[0]=t,g[0].fx=e(t),g[0].id=0;for(var f=0;f<h;++f){var y=t.slice();y[f]=y[f]?y[f]*o:s,g[f+1]=y,g[f+1].fx=e(y),g[f+1].id=f+1}function v(e){for(var t=0;t<e.length;t++)g[h][t]=e[t];g[h].fx=e.fx}for(var b=function(e,t){return e.fx-t.fx},E=t.slice(),S=t.slice(),_=t.slice(),T=t.slice(),O=0;O<r;++O){if(g.sort(b),a.history){var $=g.map((function(e){var t=e.slice();return t.fx=e.fx,t.id=e.id,t}));$.sort((function(e,t){return e.id-t.id})),a.history.push({x:g[0].slice(),fx:g[0].fx,simplex:$})}for(n=0,f=0;f<h;++f)n=Math.max(n,Math.abs(g[0][f]-g[1][f]));if(Math.abs(g[0].fx-g[h].fx)<l&&n<c)break;for(f=0;f<h;++f){E[f]=0;for(var x=0;x<h;++x)E[f]+=g[x][f];E[f]/=h}var L=g[h];if(i(S,1+u,E,-u,L),S.fx=e(S),S.fx<g[0].fx)i(T,1+d,E,-d,L),T.fx=e(T),T.fx<S.fx?v(T):v(S);else if(S.fx>=g[h-1].fx){var I=!1;if(S.fx>L.fx?(i(_,1+m,E,-m,L),_.fx=e(_),_.fx<L.fx?v(_):I=!0):(i(_,1-m*u,E,m*u,L),_.fx=e(_),_.fx<S.fx?v(_):I=!0),I){if(p>=1)break;for(f=1;f<g.length;++f)i(g[f],1-p,g[0],p,g[f]),g[f].fx=e(g[f])}}else v(S)}return g.sort(b),{fx:g[0].fx,x:g[0]}},e.conjugateGradient=function(e,t,s){var l,c,u,d={x:t.slice(),fx:0,fxprime:t.slice()},m={x:t.slice(),fx:0,fxprime:t.slice()},p=t.slice(),h=1;u=(s=s||{}).maxIterations||20*t.length,d.fx=e(d.x,d.fxprime),r(l=d.fxprime.slice(),d.fxprime,-1);for(var g=0;g<u;++g){if(h=o(e,l,d,m,h),s.history&&s.history.push({x:d.x.slice(),fx:d.fx,fxprime:d.fxprime.slice(),alpha:h}),h){i(p,1,m.fxprime,-1,d.fxprime);var f=a(d.fxprime,d.fxprime);i(l,Math.max(0,a(p,m.fxprime)/f),l,-1,m.fxprime),c=d,d=m,m=c}else r(l,d.fxprime,-1);if(n(d.fxprime)<=1e-5)break}return s.history&&s.history.push({x:d.x.slice(),fx:d.fx,fxprime:d.fxprime.slice(),alpha:h}),d},e.gradientDescent=function(e,t,a){for(var r=(a=a||{}).maxIterations||100*t.length,o=a.learnRate||.001,s={x:t.slice(),fx:0,fxprime:t.slice()},l=0;l<r&&(s.fx=e(s.x,s.fxprime),a.history&&a.history.push({x:s.x.slice(),fx:s.fx,fxprime:s.fxprime.slice()}),i(s.x,1,s.x,-o,s.fxprime),!(n(s.fxprime)<=1e-5));++l);return s},e.gradientDescentLineSearch=function(e,t,a){a=a||{};var i,s={x:t.slice(),fx:0,fxprime:t.slice()},l={x:t.slice(),fx:0,fxprime:t.slice()},c=a.maxIterations||100*t.length,u=a.learnRate||1,d=t.slice(),m=a.c1||.001,p=a.c2||.1,h=[];if(a.history){var g=e;e=function(e,t){return h.push(e.slice()),g(e,t)}}s.fx=e(s.x,s.fxprime);for(var f=0;f<c&&(r(d,s.fxprime,-1),u=o(e,d,s,l,u,m,p),a.history&&(a.history.push({x:s.x.slice(),fx:s.fx,fxprime:s.fxprime.slice(),functionCalls:h,learnRate:u,alpha:u}),h=[]),i=s,s=l,l=i,!(0===u||n(s.fxprime)<1e-5));++f);return s},e.zeros=t,e.zerosM=function(e,a){return t(e).map((function(){return t(a)}))},e.norm2=n,e.weightedSum=i,e.scale=r}(t)},542:function(e){e.exports=(()=>{"use strict";var e={d:(t,a)=>{for(var n in a)e.o(a,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:a[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{getLocale:()=>r,numberLocales:()=>a,timeLocales:()=>n});const a={"ar-AE":JSON.parse('{"decimal":"٫","thousands":"٬","grouping":[3],"currency":[""," د.إ."],"numerals":["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"]}'),"ar-BH":JSON.parse('{"decimal":"٫","thousands":"٬","grouping":[3],"currency":[""," د.ب."],"numerals":["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"]}'),"ar-DJ":JSON.parse('{"decimal":"٫","thousands":"٬","grouping":[3],"currency":["‏Fdj ",""],"numerals":["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"]}'),"ar-DZ":JSON.parse('{"decimal":",","thousands":".","grouping":[3],"currency":["د.ج. ",""]}'),"ar-EG":JSON.parse('{"decimal":"٫","thousands":"٬","grouping":[3],"currency":[""," ج.م."],"numerals":["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"]}'),"ar-IL":JSON.parse('{"decimal":"٫","thousands":"٬","grouping":[3],"currency":["₪ ",""],"numerals":["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"]}'),"ar-IQ":JSON.parse('{"decimal":"٫","thousands":"٬","grouping":[3],"currency":[""," د.ع."],"numerals":["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"]}'),"ar-JO":JSON.parse('{"decimal":"٫","thousands":"٬","grouping":[3],"currency":[""," د.أ."],"numerals":["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"]}'),"ar-KM":JSON.parse('{"decimal":"٫","thousands":"٬","grouping":[3],"currency":[""," ف.ج.ق."],"numerals":["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"]}'),"ar-KW":JSON.parse('{"decimal":"٫","thousands":"٬","grouping":[3],"currency":[""," د.ك."],"numerals":["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"]}'),"ar-LB":JSON.parse('{"decimal":"٫","thousands":"٬","grouping":[3],"currency":[""," ل.ل."],"numerals":["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"]}'),"ar-LY":JSON.parse('{"decimal":",","thousands":".","grouping":[3],"currency":["د.ل. ",""]}'),"ar-MA":JSON.parse('{"decimal":",","thousands":".","grouping":[3],"currency":["د.م. ",""]}'),"ar-OM":JSON.parse('{"decimal":"٫","thousands":"٬","grouping":[3],"currency":[""," ر.ع."],"numerals":["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"]}'),"ar-PS":JSON.parse('{"decimal":"٫","thousands":"٬","grouping":[3],"currency":["₪ ",""],"numerals":["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"]}'),"ar-QA":JSON.parse('{"decimal":"٫","thousands":"٬","grouping":[3],"currency":[""," ر.ق."],"numerals":["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"]}'),"ar-SA":JSON.parse('{"decimal":"٫","thousands":"٬","grouping":[3],"currency":[""," ر.س."],"numerals":["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"]}'),"ar-SD":JSON.parse('{"decimal":"٫","thousands":"٬","grouping":[3],"currency":[""," ج.س."],"numerals":["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"]}'),"ar-SO":JSON.parse('{"decimal":"٫","thousands":"٬","grouping":[3],"currency":["‏S ",""],"numerals":["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"]}'),"ar-SS":JSON.parse('{"decimal":"٫","thousands":"٬","grouping":[3],"currency":["£ ",""],"numerals":["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"]}'),"ar-SY":JSON.parse('{"decimal":"٫","thousands":"٬","grouping":[3],"currency":[""," ل.س."],"numerals":["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"]}'),"ar-TD":JSON.parse('{"decimal":"٫","thousands":"٬","grouping":[3],"currency":["‏FCFA ",""],"numerals":["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"]}'),"ar-TN":JSON.parse('{"decimal":",","thousands":".","grouping":[3],"currency":["د.ت. ",""]}'),"ar-YE":JSON.parse('{"decimal":"٫","thousands":"٬","grouping":[3],"currency":[""," ر.ى."],"numerals":["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"]}'),"ca-ES":JSON.parse('{"decimal":",","thousands":".","grouping":[3],"currency":[""," €"]}'),"cs-CZ":JSON.parse('{"decimal":",","thousands":" ","grouping":[3],"currency":[""," Kč"]}'),"da-DK":JSON.parse('{"decimal":",","thousands":".","grouping":[3],"currency":[""," kr"]}'),"de-CH":JSON.parse('{"decimal":",","thousands":"\'","grouping":[3],"currency":[""," CHF"]}'),"de-DE":JSON.parse('{"decimal":",","thousands":".","grouping":[3],"currency":[""," €"]}'),"en-CA":JSON.parse('{"decimal":".","thousands":",","grouping":[3],"currency":["$",""]}'),"en-GB":JSON.parse('{"decimal":".","thousands":",","grouping":[3],"currency":["£",""]}'),"en-IE":JSON.parse('{"decimal":".","thousands":",","grouping":[3],"currency":["€",""]}'),"en-IN":JSON.parse('{"decimal":".","thousands":",","grouping":[3,2,2,2,2,2,2,2,2,2],"currency":["₹",""]}'),"en-US":JSON.parse('{"decimal":".","thousands":",","grouping":[3],"currency":["$",""]}'),"es-BO":JSON.parse('{"decimal":",","thousands":".","grouping":[3],"currency":["Bs ",""],"percent":" %"}'),"es-ES":JSON.parse('{"decimal":",","thousands":".","grouping":[3],"currency":[""," €"]}'),"es-MX":JSON.parse('{"decimal":".","thousands":",","grouping":[3],"currency":["$",""]}'),"fi-FI":JSON.parse('{"decimal":",","thousands":" ","grouping":[3],"currency":[""," €"]}'),"fr-CA":JSON.parse('{"decimal":",","thousands":" ","grouping":[3],"currency":["","$"]}'),"fr-FR":JSON.parse('{"decimal":",","thousands":" ","grouping":[3],"currency":[""," €"],"percent":" %"}'),"he-IL":JSON.parse('{"decimal":".","thousands":",","grouping":[3],"currency":["₪",""]}'),"hu-HU":JSON.parse('{"decimal":",","thousands":" ","grouping":[3],"currency":[""," Ft"]}'),"it-IT":JSON.parse('{"decimal":",","thousands":".","grouping":[3],"currency":["€",""]}'),"ja-JP":JSON.parse('{"decimal":".","thousands":",","grouping":[3],"currency":["","円"]}'),"ko-KR":JSON.parse('{"decimal":".","thousands":",","grouping":[3],"currency":["₩",""]}'),"mk-MK":JSON.parse('{"decimal":",","thousands":".","grouping":[3],"currency":[""," ден."]}'),"nl-NL":JSON.parse('{"decimal":",","thousands":".","grouping":[3],"currency":["€ ",""]}'),"pl-PL":JSON.parse('{"decimal":",","thousands":".","grouping":[3],"currency":["","zł"]}'),"pt-BR":JSON.parse('{"decimal":",","thousands":".","grouping":[3],"currency":["R$",""]}'),"pt-PT":JSON.parse('{"decimal":",","thousands":" ","grouping":[3],"currency":[""," €"]}'),"ru-RU":JSON.parse('{"decimal":",","thousands":" ","grouping":[3],"currency":[""," ₽"]}'),"sl-SI":JSON.parse('{"decimal":",","thousands":".","grouping":[3],"currency":[""," €"]}'),"sv-SE":JSON.parse('{"decimal":",","thousands":" ","grouping":[3],"currency":[""," kr"]}'),"uk-UA":JSON.parse('{"decimal":",","thousands":" ","grouping":[3],"currency":[""," ₴."]}'),"zh-CN":JSON.parse('{"decimal":".","thousands":",","grouping":[3],"currency":["¥",""]}')},n={"ar-EG":JSON.parse('{"dateTime":"%x, %X","date":"%-d/%-m/%Y","time":"%-I:%M:%S %p","periods":["ص","م"],"days":["الأحد","الإثنين","الثلاثاء","الأربعاء","الخميس","الجمعة","السبت"],"shortDays":["أحد","إثنين","ثلاثاء","أربعاء","خميس","جمعة","سبت"],"months":["يناير","فبراير","مارس","أبريل","مايو","يونيو","يوليو","أغسطس","سبتمبر","أكتوبر","نوفمبر","ديسمبر"],"shortMonths":["يناير","فبراير","مارس","أبريل","مايو","يونيو","يوليو","أغسطس","سبتمبر","أكتوبر","نوفمبر","ديسمبر"]}'),"ar-SY":JSON.parse('{"dateTime":"%x, %X","date":"%-d/%-m/%Y","time":"%-I:%M:%S %p","periods":["ص","م"],"days":["الأحد","الإثنين","الثلاثاء","الأربعاء","الخميس","الجمعة","السبت"],"shortDays":["أحد","إثنين","ثلاثاء","أربعاء","خميس","جمعة","سبت"],"months":["كانون الثاني","شباط","آذار","نيسان","أيار","حزيران","تموز","آب","أيلول","تشرين الأول","تشرين الثاني","كانون الأول"],"shortMonths":["ك٢","شباط","آذار","نيسان","أيار","حزيران","تموز","آب","أيلول","ت١","ت٢","ك١"]}'),"ca-ES":JSON.parse('{"dateTime":"%A, %e de %B de %Y, %X","date":"%d/%m/%Y","time":"%H:%M:%S","periods":["AM","PM"],"days":["diumenge","dilluns","dimarts","dimecres","dijous","divendres","dissabte"],"shortDays":["dg.","dl.","dt.","dc.","dj.","dv.","ds."],"months":["gener","febrer","març","abril","maig","juny","juliol","agost","setembre","octubre","novembre","desembre"],"shortMonths":["gen.","febr.","març","abr.","maig","juny","jul.","ag.","set.","oct.","nov.","des."]}'),"cs-CZ":JSON.parse('{"dateTime":"%A,%e.%B %Y, %X","date":"%-d.%-m.%Y","time":"%H:%M:%S","periods":["AM","PM"],"days":["neděle","pondělí","úterý","středa","čvrtek","pátek","sobota"],"shortDays":["ne.","po.","út.","st.","čt.","pá.","so."],"months":["leden","únor","březen","duben","květen","červen","červenec","srpen","září","říjen","listopad","prosinec"],"shortMonths":["led","úno","břez","dub","kvě","čer","červ","srp","zář","říj","list","pros"]}'),"da-DK":JSON.parse('{"dateTime":"%A den %d %B %Y %X","date":"%d-%m-%Y","time":"%H:%M:%S","periods":["AM","PM"],"days":["søndag","mandag","tirsdag","onsdag","torsdag","fredag","lørdag"],"shortDays":["søn","man","tir","ons","tor","fre","lør"],"months":["januar","februar","marts","april","maj","juni","juli","august","september","oktober","november","december"],"shortMonths":["jan","feb","mar","apr","maj","jun","jul","aug","sep","okt","nov","dec"]}'),"de-CH":JSON.parse('{"dateTime":"%A, der %e. %B %Y, %X","date":"%d.%m.%Y","time":"%H:%M:%S","periods":["AM","PM"],"days":["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],"shortDays":["So","Mo","Di","Mi","Do","Fr","Sa"],"months":["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],"shortMonths":["Jan","Feb","Mrz","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"]}'),"de-DE":JSON.parse('{"dateTime":"%A, der %e. %B %Y, %X","date":"%d.%m.%Y","time":"%H:%M:%S","periods":["AM","PM"],"days":["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],"shortDays":["So","Mo","Di","Mi","Do","Fr","Sa"],"months":["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],"shortMonths":["Jan","Feb","Mrz","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"]}'),"en-CA":JSON.parse('{"dateTime":"%a %b %e %X %Y","date":"%Y-%m-%d","time":"%H:%M:%S","periods":["AM","PM"],"days":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"shortDays":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"months":["January","February","March","April","May","June","July","August","September","October","November","December"],"shortMonths":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}'),"en-GB":JSON.parse('{"dateTime":"%a %e %b %X %Y","date":"%d/%m/%Y","time":"%H:%M:%S","periods":["AM","PM"],"days":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"shortDays":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"months":["January","February","March","April","May","June","July","August","September","October","November","December"],"shortMonths":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}'),"en-US":JSON.parse('{"dateTime":"%x, %X","date":"%-m/%-d/%Y","time":"%-I:%M:%S %p","periods":["AM","PM"],"days":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"shortDays":["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],"months":["January","February","March","April","May","June","July","August","September","October","November","December"],"shortMonths":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}'),"es-ES":JSON.parse('{"dateTime":"%A, %e de %B de %Y, %X","date":"%d/%m/%Y","time":"%H:%M:%S","periods":["AM","PM"],"days":["domingo","lunes","martes","miércoles","jueves","viernes","sábado"],"shortDays":["dom","lun","mar","mié","jue","vie","sáb"],"months":["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"],"shortMonths":["ene","feb","mar","abr","may","jun","jul","ago","sep","oct","nov","dic"]}'),"es-MX":JSON.parse('{"dateTime":"%x, %X","date":"%d/%m/%Y","time":"%-I:%M:%S %p","periods":["AM","PM"],"days":["domingo","lunes","martes","miércoles","jueves","viernes","sábado"],"shortDays":["dom","lun","mar","mié","jue","vie","sáb"],"months":["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"],"shortMonths":["ene","feb","mar","abr","may","jun","jul","ago","sep","oct","nov","dic"]}'),"fa-IR":JSON.parse('{"dateTime":"%x, %X","date":"%-d/%-m/%Y","time":"%-I:%M:%S %p","periods":["صبح","عصر"],"days":["یکشنبه","دوشنبه","سه شنبه","چهارشنبه","پنجشنبه","جمعه","شنبه"],"shortDays":["یکشنبه","دوشنبه","سه شنبه","چهارشنبه","پنجشنبه","جمعه","شنبه"],"months":["ژانویه","فوریه","مارس","آوریل","مه","ژوئن","ژوئیه","اوت","سپتامبر","اکتبر","نوامبر","دسامبر"],"shortMonths":["ژانویه","فوریه","مارس","آوریل","مه","ژوئن","ژوئیه","اوت","سپتامبر","اکتبر","نوامبر","دسامبر"]}'),"fi-FI":JSON.parse('{"dateTime":"%A, %-d. %Bta %Y klo %X","date":"%-d.%-m.%Y","time":"%H:%M:%S","periods":["a.m.","p.m."],"days":["sunnuntai","maanantai","tiistai","keskiviikko","torstai","perjantai","lauantai"],"shortDays":["Su","Ma","Ti","Ke","To","Pe","La"],"months":["tammikuu","helmikuu","maaliskuu","huhtikuu","toukokuu","kesäkuu","heinäkuu","elokuu","syyskuu","lokakuu","marraskuu","joulukuu"],"shortMonths":["Tammi","Helmi","Maalis","Huhti","Touko","Kesä","Heinä","Elo","Syys","Loka","Marras","Joulu"]}'),"fr-CA":JSON.parse('{"dateTime":"%a %e %b %Y %X","date":"%Y-%m-%d","time":"%H:%M:%S","periods":["",""],"days":["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],"shortDays":["dim","lun","mar","mer","jeu","ven","sam"],"months":["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"],"shortMonths":["jan","fév","mar","avr","mai","jui","jul","aoû","sep","oct","nov","déc"]}'),"fr-FR":JSON.parse('{"dateTime":"%A %e %B %Y à %X","date":"%d/%m/%Y","time":"%H:%M:%S","periods":["AM","PM"],"days":["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],"shortDays":["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],"months":["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"],"shortMonths":["janv.","févr.","mars","avr.","mai","juin","juil.","août","sept.","oct.","nov.","déc."]}'),"he-IL":JSON.parse('{"dateTime":"%A, %e ב%B %Y %X","date":"%d.%m.%Y","time":"%H:%M:%S","periods":["AM","PM"],"days":["ראשון","שני","שלישי","רביעי","חמישי","שישי","שבת"],"shortDays":["א׳","ב׳","ג׳","ד׳","ה׳","ו׳","ש׳"],"months":["ינואר","פברואר","מרץ","אפריל","מאי","יוני","יולי","אוגוסט","ספטמבר","אוקטובר","נובמבר","דצמבר"],"shortMonths":["ינו׳","פבר׳","מרץ","אפר׳","מאי","יוני","יולי","אוג׳","ספט׳","אוק׳","נוב׳","דצמ׳"]}'),"hr-HR":JSON.parse('{"dateTime":"%A, %e. %B %Y., %X","date":"%d. %m. %Y.","time":"%H:%M:%S","periods":["AM","PM"],"days":["Nedjelja","Ponedjeljak","Utorak","Srijeda","Četvtrak","Petak","Subota"],"shortDays":["Ne","Po","Ut","Sr","Če","Pe","Su"],"months":["Siječanj","Veljača","Ožujak","Travanj","Svibanj","Lipanj","Srpanj","Kolovoz","Rujan","Listopad","Studeni","Prosinac"],"shortMonths":["Sij","Velj","Ožu","Tra","Svi","Lip","Srp","Kol","Ruj","Lis","Stu","Pro"]}'),"hu-HU":JSON.parse('{"dateTime":"%Y. %B %-e., %A %X","date":"%Y. %m. %d.","time":"%H:%M:%S","periods":["de.","du."],"days":["vasárnap","hétfő","kedd","szerda","csütörtök","péntek","szombat"],"shortDays":["V","H","K","Sze","Cs","P","Szo"],"months":["január","február","március","április","május","június","július","augusztus","szeptember","október","november","december"],"shortMonths":["jan.","feb.","már.","ápr.","máj.","jún.","júl.","aug.","szept.","okt.","nov.","dec."]}'),"it-IT":JSON.parse('{"dateTime":"%A %e %B %Y, %X","date":"%d/%m/%Y","time":"%H:%M:%S","periods":["AM","PM"],"days":["Domenica","Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato"],"shortDays":["Dom","Lun","Mar","Mer","Gio","Ven","Sab"],"months":["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"],"shortMonths":["Gen","Feb","Mar","Apr","Mag","Giu","Lug","Ago","Set","Ott","Nov","Dic"]}'),"ja-JP":JSON.parse('{"dateTime":"%x %a %X","date":"%Y/%m/%d","time":"%H:%M:%S","periods":["AM","PM"],"days":["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"],"shortDays":["日","月","火","水","木","金","土"],"months":["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],"shortMonths":["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"]}'),"ko-KR":JSON.parse('{"dateTime":"%Y/%m/%d %a %X","date":"%Y/%m/%d","time":"%H:%M:%S","periods":["오전","오후"],"days":["일요일","월요일","화요일","수요일","목요일","금요일","토요일"],"shortDays":["일","월","화","수","목","금","토"],"months":["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],"shortMonths":["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"]}'),"mk-MK":JSON.parse('{"dateTime":"%A, %e %B %Y г. %X","date":"%d.%m.%Y","time":"%H:%M:%S","periods":["AM","PM"],"days":["недела","понеделник","вторник","среда","четврток","петок","сабота"],"shortDays":["нед","пон","вто","сре","чет","пет","саб"],"months":["јануари","февруари","март","април","мај","јуни","јули","август","септември","октомври","ноември","декември"],"shortMonths":["јан","фев","мар","апр","мај","јун","јул","авг","сеп","окт","ное","дек"]}'),"nb-NO":JSON.parse('{"dateTime":"%A den %d. %B %Y %X","date":"%d.%m.%Y","time":"%H:%M:%S","periods":["AM","PM"],"days":["søndag","mandag","tirsdag","onsdag","torsdag","fredag","lørdag"],"shortDays":["søn","man","tir","ons","tor","fre","lør"],"months":["januar","februar","mars","april","mai","juni","juli","august","september","oktober","november","desember"],"shortMonths":["jan","feb","mars","apr","mai","juni","juli","aug","sep","okt","nov","des"]}'),"nl-BE":JSON.parse('{"dateTime":"%a %e %B %Y %X","date":"%d/%m/%Y","time":"%H:%M:%S","periods":["AM","PM"],"days":["zondag","maandag","dinsdag","woensdag","donderdag","vrijdag","zaterdag"],"shortDays":["zo","ma","di","wo","do","vr","za"],"months":["januari","februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december"],"shortMonths":["jan","feb","mrt","apr","mei","jun","jul","aug","sep","okt","nov","dec"]}'),"nl-NL":JSON.parse('{"dateTime":"%a %e %B %Y %X","date":"%d-%m-%Y","time":"%H:%M:%S","periods":["AM","PM"],"days":["zondag","maandag","dinsdag","woensdag","donderdag","vrijdag","zaterdag"],"shortDays":["zo","ma","di","wo","do","vr","za"],"months":["januari","februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december"],"shortMonths":["jan","feb","mrt","apr","mei","jun","jul","aug","sep","okt","nov","dec"]}'),"pl-PL":JSON.parse('{"dateTime":"%A, %e %B %Y, %X","date":"%d/%m/%Y","time":"%H:%M:%S","periods":["AM","PM"],"days":["Niedziela","Poniedziałek","Wtorek","Środa","Czwartek","Piątek","Sobota"],"shortDays":["Niedz.","Pon.","Wt.","Śr.","Czw.","Pt.","Sob."],"months":["Styczeń","Luty","Marzec","Kwiecień","Maj","Czerwiec","Lipiec","Sierpień","Wrzesień","Październik","Listopad","Grudzień"],"shortMonths":["Stycz.","Luty","Marz.","Kwie.","Maj","Czerw.","Lipc.","Sierp.","Wrz.","Paźdz.","Listop.","Grudz."]}'),"pt-BR":JSON.parse('{"dateTime":"%A, %e de %B de %Y. %X","date":"%d/%m/%Y","time":"%H:%M:%S","periods":["AM","PM"],"days":["Domingo","Segunda","Terça","Quarta","Quinta","Sexta","Sábado"],"shortDays":["Dom","Seg","Ter","Qua","Qui","Sex","Sáb"],"months":["Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"],"shortMonths":["Jan","Fev","Mar","Abr","Mai","Jun","Jul","Ago","Set","Out","Nov","Dez"]}'),"ru-RU":JSON.parse('{"dateTime":"%A, %e %B %Y г. %X","date":"%d.%m.%Y","time":"%H:%M:%S","periods":["AM","PM"],"days":["воскресенье","понедельник","вторник","среда","четверг","пятница","суббота"],"shortDays":["вс","пн","вт","ср","чт","пт","сб"],"months":["января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"],"shortMonths":["янв","фев","мар","апр","май","июн","июл","авг","сен","окт","ноя","дек"]}'),"sv-SE":JSON.parse('{"dateTime":"%A den %d %B %Y %X","date":"%Y-%m-%d","time":"%H:%M:%S","periods":["fm","em"],"days":["Söndag","Måndag","Tisdag","Onsdag","Torsdag","Fredag","Lördag"],"shortDays":["Sön","Mån","Tis","Ons","Tor","Fre","Lör"],"months":["Januari","Februari","Mars","April","Maj","Juni","Juli","Augusti","September","Oktober","November","December"],"shortMonths":["Jan","Feb","Mar","Apr","Maj","Jun","Jul","Aug","Sep","Okt","Nov","Dec"]}'),"tr-TR":JSON.parse('{"dateTime":"%a %e %b %X %Y","date":"%d/%m/%Y","time":"%H:%M:%S","periods":["AM","PM"],"days":["Pazar","Pazartesi","Salı","Çarşamba","Perşembe","Cuma","Cumartesi"],"shortDays":["Paz","Pzt","Sal","Çar","Per","Cum","Cmt"],"months":["Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eylül","Ekim","Kasım","Aralık"],"shortMonths":["Oca","Şub","Mar","Nis","May","Haz","Tem","Ağu","Eyl","Eki","Kas","Ara"]}'),"uk-UA":JSON.parse('{"dateTime":"%A, %e %B %Y р. %X","date":"%d.%m.%Y","time":"%H:%M:%S","periods":["дп","пп"],"days":["неділя","понеділок","вівторок","середа","четвер","п\'ятниця","субота"],"shortDays":["нд","пн","вт","ср","чт","пт","сб"],"months":["січня","лютого","березня","квітня","травня","червня","липня","серпня","вересня","жовтня","листопада","грудня"],"shortMonths":["січ.","лют.","бер.","квіт.","трав.","черв.","лип.","серп.","вер.","жовт.","лист.","груд."]}'),"zh-CN":JSON.parse('{"dateTime":"%x %A %X","date":"%Y年%-m月%-d日","time":"%H:%M:%S","periods":["上午","下午"],"days":["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],"shortDays":["周日","周一","周二","周三","周四","周五","周六"],"months":["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],"shortMonths":["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]}'),"zh-TW":JSON.parse('{"dateTime":"%x %A %X","date":"%Y年%-m月%-d日","time":"%H:%M:%S","periods":["上午","下午"],"days":["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],"shortDays":["日","一","二","三","四","五","六"],"months":["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],"shortMonths":["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"]}')},r=(e="en-US")=>{var t,r;return"string"==typeof e?{number:null!==(t=a[e])&&void 0!==t?t:a["en-US"],time:null!==(r=n[e])&&void 0!==r?r:n["en-US"]}:{number:i(e.number),time:o(e.time)}},i=e=>{var t;return"string"==typeof e?null!==(t=a[e])&&void 0!==t?t:a["en-US"]:e},o=e=>{var t;return"string"==typeof e?null!==(t=n[e])&&void 0!==t?t:n["en-US"]:e};return t})()},633:t=>{"use strict";t.exports=e},274:e=>{"use strict";e.exports=t},365:e=>{"use strict";e.exports=a}},r={};function i(e){var t=r[e];if(void 0!==t)return t.exports;var a=r[e]={exports:{}};return n[e].call(a.exports,a,a.exports,i),a.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var a in t)i.o(t,a)&&!i.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{"use strict";i.r(o),i.d(o,{addData:()=>os,baseData:()=>ce,buildSpec:()=>zo,expressionFunctions:()=>js,formatHorizontalTimeAxisLabels:()=>As,formatLocaleCurrency:()=>Is,formatShortNumber:()=>Ls,formatTimeDurationLabels:()=>Rs,formatVerticalAxisTimeLabels:()=>Ds,getChartConfig:()=>he,getColorScale:()=>Xo,getD3FormatSpecifierFromNumberFormat:()=>pe,getDefaultSignals:()=>Vo,getDimensionField:()=>me,getExpressionFunctions:()=>xs,getFacetsFromOptions:()=>te,getFacetsFromScales:()=>ae,getLineTypeScale:()=>Zo,getLineWidthPixelsFromLineWidth:()=>re,getLineWidthScale:()=>as,getLinearColorScale:()=>qo,getOpacityScale:()=>ns,getPathFromIcon:()=>oe,getPathFromSymbolShape:()=>ie,getStrokeDashFromLineType:()=>ne,getSymbolPathWidthScale:()=>ts,getSymbolShapeScale:()=>Qo,getSymbolSizeScale:()=>es,getSymbolWidthFromRscSymbolSize:()=>le,getTwoDimensionalColorScheme:()=>Wo,getTwoDimensionalLineTypes:()=>Jo,getTwoDimensionalOpacities:()=>Yo,getVegaEmbedOptions:()=>ks,getVegaSymbolSizeFromRscSymbolSize:()=>se,initializeSpec:()=>ue,isColorScale:()=>ss,isColors:()=>ls,isLineTypeArray:()=>cs,isNumberArray:()=>ds,isStrokeDashArray:()=>us,isSymbolShapeArray:()=>ms,mergeValuesIntoData:()=>de,removeUnusedScales:()=>Bo});var e=Symbol.for("immer-nothing"),t=Symbol.for("immer-draftable"),a=Symbol.for("immer-state");function n(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var r=Object.getPrototypeOf;function s(e){return!!e&&!!e[a]}function l(e){return!!e&&(u(e)||Array.isArray(e)||!!e[t]||!!e.constructor?.[t]||g(e)||f(e))}var c=Object.prototype.constructor.toString();function u(e){if(!e||"object"!=typeof e)return!1;const t=r(e);if(null===t)return!0;const a=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return a===Object||"function"==typeof a&&Function.toString.call(a)===c}function d(e,t){0===m(e)?Reflect.ownKeys(e).forEach((a=>{t(a,e[a],e)})):e.forEach(((a,n)=>t(n,a,e)))}function m(e){const t=e[a];return t?t.type_:Array.isArray(e)?1:g(e)?2:f(e)?3:0}function p(e,t){return 2===m(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function h(e,t,a){const n=m(e);2===n?e.set(t,a):3===n?e.add(a):e[t]=a}function g(e){return e instanceof Map}function f(e){return e instanceof Set}function y(e){return e.copy_||e.base_}function v(e,t){if(g(e))return new Map(e);if(f(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=u(e);if(!0===t||"class_only"===t&&!n){const t=Object.getOwnPropertyDescriptors(e);delete t[a];let n=Reflect.ownKeys(t);for(let a=0;a<n.length;a++){const r=n[a],i=t[r];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(t[r]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[r]})}return Object.create(r(e),t)}{const t=r(e);if(null!==t&&n)return{...e};const a=Object.create(t);return Object.assign(a,e)}}function b(e,t=!1){return S(e)||s(e)||!l(e)||(m(e)>1&&(e.set=e.add=e.clear=e.delete=E),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>b(t,!0)))),e}function E(){n(2)}function S(e){return Object.isFrozen(e)}var _,T={};function O(e){const t=T[e];return t||n(0),t}function $(){return _}function x(e,t){t&&(O("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function L(e){I(e),e.drafts_.forEach(D),e.drafts_=null}function I(e){e===_&&(_=e.parent_)}function A(e){return _={drafts_:[],parent_:_,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function D(e){const t=e[a];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function R(t,r){r.unfinalizedDrafts_=r.drafts_.length;const i=r.drafts_[0];return void 0!==t&&t!==i?(i[a].modified_&&(L(r),n(4)),l(t)&&(t=M(r,t),r.parent_||N(r,t)),r.patches_&&O("Patches").generateReplacementPatches_(i[a].base_,t,r.patches_,r.inversePatches_)):t=M(r,i,[]),L(r),r.patches_&&r.patchListener_(r.patches_,r.inversePatches_),t!==e?t:void 0}function M(e,t,n){if(S(t))return t;const r=t[a];if(!r)return d(t,((a,i)=>C(e,r,t,a,i,n))),t;if(r.scope_!==e)return t;if(!r.modified_)return N(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const t=r.copy_;let a=t,i=!1;3===r.type_&&(a=new Set(t),t.clear(),i=!0),d(a,((a,o)=>C(e,r,t,a,o,n,i))),N(e,t,!1),n&&e.patches_&&O("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function C(e,t,a,n,r,i,o){if(s(r)){const o=M(e,r,i&&t&&3!==t.type_&&!p(t.assigned_,n)?i.concat(n):void 0);if(h(a,n,o),!s(o))return;e.canAutoFreeze_=!1}else o&&a.add(r);if(l(r)&&!S(r)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;M(e,r),t&&t.scope_.parent_||"symbol"==typeof n||!Object.prototype.propertyIsEnumerable.call(a,n)||N(e,r)}}function N(e,t,a=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&b(t,a)}var j={get(e,t){if(t===a)return e;const n=y(e);if(!p(n,t))return function(e,t,a){const n=H(t,a);return n?"value"in n?n.value:n.get?.call(e.draft_):void 0}(e,n,t);const r=n[t];return e.finalized_||!l(r)?r:r===P(e.base_,t)?(F(e),e.copy_[t]=G(r,e)):r},has:(e,t)=>t in y(e),ownKeys:e=>Reflect.ownKeys(y(e)),set(e,t,n){const r=H(y(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=P(y(e),t),s=r?.[a];if(s&&s.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(((i=n)===(o=r)?0!==i||1/i==1/o:i!=i&&o!=o)&&(void 0!==n||p(e.base_,t)))return!0;F(e),w(e)}var i,o;return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==P(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,F(e),w(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const a=y(e),n=Reflect.getOwnPropertyDescriptor(a,t);return n?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:n.enumerable,value:a[t]}:n},defineProperty(){n(11)},getPrototypeOf:e=>r(e.base_),setPrototypeOf(){n(12)}},k={};function P(e,t){const n=e[a];return(n?y(n):e)[t]}function H(e,t){if(!(t in e))return;let a=r(e);for(;a;){const e=Object.getOwnPropertyDescriptor(a,t);if(e)return e;a=r(a)}}function w(e){e.modified_||(e.modified_=!0,e.parent_&&w(e.parent_))}function F(e){e.copy_||(e.copy_=v(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function G(e,t){const a=g(e)?O("MapSet").proxyMap_(e,t):f(e)?O("MapSet").proxySet_(e,t):function(e,t){const a=Array.isArray(e),n={type_:a?1:0,scope_:t?t.scope_:$(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=n,i=j;a&&(r=[n],i=k);const{revoke:o,proxy:s}=Proxy.revocable(r,i);return n.draft_=s,n.revoke_=o,s}(e,t);return(t?t.scope_:$()).drafts_.push(a),a}function z(e){if(!l(e)||S(e))return e;const t=e[a];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=v(e,t.scope_.immer_.useStrictShallowCopy_)}else n=v(e,!0);return d(n,((e,t)=>{h(n,e,z(t))})),t&&(t.finalized_=!1),n}d(j,((e,t)=>{k[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),k.deleteProperty=function(e,t){return k.set.call(this,e,t,void 0)},k.set=function(e,t,a){return j.set.call(this,e[0],t,a,e[0])};var B=new class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,a,r)=>{if("function"==typeof t&&"function"!=typeof a){const e=a;a=t;const n=this;return function(t=e,...r){return n.produce(t,(e=>a.call(this,e,...r)))}}let i;if("function"!=typeof a&&n(6),void 0!==r&&"function"!=typeof r&&n(7),l(t)){const e=A(this),n=G(t,void 0);let o=!0;try{i=a(n),o=!1}finally{o?L(e):I(e)}return x(e,r),R(i,e)}if(!t||"object"!=typeof t){if(i=a(t),void 0===i&&(i=t),i===e&&(i=void 0),this.autoFreeze_&&b(i,!0),r){const e=[],a=[];O("Patches").generateReplacementPatches_(t,i,e,a),r(e,a)}return i}n(1)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...a)=>this.produceWithPatches(t,(t=>e(t,...a)));let a,n;return[this.produce(e,t,((e,t)=>{a=e,n=t})),a,n]},"boolean"==typeof t?.autoFreeze&&this.setAutoFreeze(t.autoFreeze),"boolean"==typeof t?.useStrictShallowCopy&&this.setUseStrictShallowCopy(t.useStrictShallowCopy)}createDraft(e){var t;l(e)||n(8),s(e)&&(s(t=e)||n(10),e=z(t));const r=A(this),i=G(e,void 0);return i[a].isManual_=!0,I(r),i}finishDraft(e,t){const r=e&&e[a];r&&r.isManual_||n(9);const{scope_:i}=r;return x(i,t),R(void 0,i)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let a;for(a=t.length-1;a>=0;a--){const n=t[a];if(0===n.path.length&&"replace"===n.op){e=n.value;break}}a>-1&&(t=t.slice(a+1));const n=O("Patches").applyPatches_;return s(e)?n(e,t):this.produce(e,(e=>n(e,t)))}},U=B.produce;B.produceWithPatches.bind(B),B.setAutoFreeze.bind(B),B.setUseStrictShallowCopy.bind(B),B.applyPatches.bind(B),B.createDraft.bind(B),B.finishDraft.bind(B);var V=i(633),W=i(274),J=i(365);const Y=U(((e,t)=>{-1===e.findIndex((e=>"timeunit"===e.type))&&(e.push({type:"formula",expr:`toDate(datum["${t}"])`,as:t}),e.push({type:"timeunit",field:t,units:["year","month","date","hours","minutes","seconds"],as:[V.DEFAULT_TRANSFORMED_TIME_DIMENSION,`${V.DEFAULT_TIME_DIMENSION}1`]}))})),K=e=>{if(e)return{field:e}},X=e=>e.find((e=>e.name===V.TABLE)),q=e=>e.find((e=>e.name===V.FILTERED_TABLE)),Z=e=>{if(0===e.length)return[];const t=e.map((e=>`datum.${e}`)).join(' + " | " + ');return[{type:"formula",as:V.SERIES_ID,expr:t}]},Q=e=>{var t;const a=null===(t=e[0])||void 0===t?void 0:t.excludeDataKeys,n=null==a?void 0:a.map((e=>({type:"filter",expr:`!datum.${e}`})));return{name:`${V.FILTERED_TABLE}ForTooltip`,source:V.FILTERED_TABLE,transform:n}},ee=require("vega"),te=({color:e,lineType:t,opacity:a,size:n})=>{let r=[e,t,a,n].map((e=>Array.isArray(e)?e[0]:e)).filter((e=>"string"==typeof e));r=[...new Set(r)];let i=[e,t,a].map((e=>Array.isArray(e)?e[1]:void 0)).filter((e=>"string"==typeof e));return i=[...new Set(i)],{facets:r,secondaryFacets:i}},ae=(e=[])=>{const t=[V.COLOR_SCALE,V.LINE_TYPE_SCALE,V.OPACITY_SCALE,"secondaryColor","secondaryLineType","secondaryOpacity"].reduce(((t,a)=>{const n=e.find((e=>e.name===a));return(null==n?void 0:n.domain)&&"fields"in n.domain&&n.domain.fields.length?[...t,n.domain.fields[0].toString()]:t}),[]);return[...new Set(t)]},ne=e=>{if(Array.isArray(e))return e;switch(e){case"dashed":return[7,4];case"dotted":return[2,3];case"dotDash":return[2,3,7,4];case"shortDash":return[3,4];case"longDash":return[11,4];case"twoDash":return[5,2,11,2];default:return[]}},re=e=>{if("number"==typeof e)return e;switch(e){case"XS":return 1;case"S":return 1.5;case"L":return 3;case"XL":return 4;default:return 2}},ie=e=>"rounded-square"===e?V.ROUNDED_SQUARE_PATH:e,oe=e=>({date:V.DATE_PATH,sentimentNegative:V.SENTIMENT_NEGATIVE_PATH,sentimentNeutral:V.SENTIMENT_NEUTRAL_PATH,sentimentPositive:V.SENTIMENT_POSITIVE_PATH}[e]||e),se=e=>Math.pow(le(e),2),le=e=>{if("number"==typeof e)return e;switch(e){case"XS":return 6;case"S":return 8;case"L":return 12;case"XL":return 16;default:return 10}},ce=[{name:V.TABLE,values:[],transform:[{type:"identifier",as:V.MARK_ID}]},{name:V.FILTERED_TABLE,source:V.TABLE}],ue=(e={},t={})=>{const{backgroundColor:a,colorScheme:n="light",description:r,title:i}=t,o={usermeta:{},title:i||void 0,description:r,data:ce,background:a?(0,W.getColorValue)(a,n):void 0};return Object.assign(Object.assign({},o),e||{})},de=(e,t)=>e.map((e=>{const a=t[e.name];return a&&(e.values=a),e})),me=(e,t)=>"time"===t?V.DEFAULT_TRANSFORMED_TIME_DIMENSION:e,pe=e=>{switch(e){case"currency":return"$,.2f";case"standardNumber":return",";default:return e}};function he(e,t){const a=(0,W.getSpectrumVegaConfig)(t);return e?(0,ee.mergeConfig)(a,e):a}const ge=(e,t,a,n,r)=>{const i=n||(0,J.toCamelCase)(`${a} ${t}`);let o=e.findIndex((e=>e.name===i));return-1===o&&(o=e.length,e.push(_e(t,a,Object.assign({name:i},r?{domain:{data:r,fields:[]}}:{})))),o},fe=(e,t,a)=>{let n=e.findIndex((e=>e.name===t));return-1===n&&(n=e.length,e.push({name:t,type:a})),n},ye=U(((e,t)=>(t.forEach((t=>{Ie(e.domain)?e.domain.fields.includes(t)||e.domain.fields.push(t):e.domain={data:V.TABLE,fields:[t]}})),e))),ve=(e,{scaleType:t,dimension:a,padding:n})=>{const r=ge(e,t,"x"),i=[me(a,t)];e[r]=ye(e[r],i),void 0!==n&&(e[r]=be(e[r],n))},be=U(((e,t)=>{"padding"in e&&(e.padding=t),"paddingOuter"in e&&(e.paddingOuter=t)})),Ee=(e,t,a="y",n,r)=>{const i=ge(e,"linear",a,n,r);e[i]=ye(e[i],t)},Se=(e,t,a)=>{if("string"==typeof a||Array.isArray(a)&&a.length){const n=fe(e,t),r=Array.isArray(a)?a[0]:a;e[n]=ye(e[n],[r])}},_e=(e,t,a)=>Object.assign(Object.assign({},Te(e,t)),a),Te=(e,t,a="vertical")=>{const n=t==={vertical:"x",horizontal:"y"}[a],r=Object.assign({name:(0,J.toCamelCase)(`${t} ${e}`),type:e,range:"x"===t?"width":"height",domain:{data:V.FILTERED_TABLE,fields:[]}},n?Oe(e):{});if("ordinal"===r.type){const{name:e,type:t,domain:a}=r;return{name:e,type:t,domain:a}}return"linear"!==r.type||n?r:Object.assign(Object.assign({},r),{nice:!0,zero:!0})},Oe=e=>{switch(e){case"band":{const{paddingInner:e,paddingOuter:t}=$e(V.PADDING_RATIO);return{paddingInner:e,paddingOuter:t}}case"linear":case"time":return{padding:V.LINEAR_PADDING};case"point":return{paddingOuter:V.DISCRETE_PADDING};default:return{}}},$e=(e,t)=>{const a=e;return{paddingInner:a,paddingOuter:void 0===t?V.DISCRETE_PADDING-(1-a)/2:t}},xe=(e,t)=>(0,J.toCamelCase)(`${e} ${t}`),Le=(e,t)=>({name:e,type:"ordinal",range:t,domain:{data:V.TABLE,fields:[]}}),Ie=e=>Boolean(e&&!Array.isArray(e)&&"data"in e&&"fields"in e),Ae=(e,t)=>{if(t||e.length)return{value:"pointer"}};function De(e,t,a){if(e.length){const n={signal:`merge(datum${a?".datum":""}, {'${V.COMPONENT_NAME}': '${t}'})`},r=e[0].excludeDataKeys;return(null==r?void 0:r.length)?[...r.map((e=>({test:`datum.${e}`,signal:"false"}))),n]:n}}const Re=(e,t=!1)=>e?{stroke:{signal:V.BACKGROUND_COLOR},strokeWidth:{value:t?1.5:1},strokeJoin:{value:"round"}}:{},Me=e=>{const t="hasOnClick"in e&&e.hasOnClick,a="metricRanges"in e&&e.metricRanges||[],n="trendlines"in e&&e.trendlines||[];return t||Ce(e)||Ne(e)||n.some((e=>e.displayOnHover))||a.some((e=>e.displayOnHover))},Ce=e=>{var t;return Boolean("chartPopovers"in e&&(null===(t=e.chartPopovers)||void 0===t?void 0:t.length))},Ne=e=>{var t;return Boolean("chartTooltips"in e&&(null===(t=e.chartTooltips)||void 0===t?void 0:t.length))},je=(e,t,a="ordinal")=>{const n="linear"===a?V.LINEAR_COLOR_SCALE:V.COLOR_SCALE;return Array.isArray(e)?{signal:`scale('colors', datum.${e[0]})[indexof(domain('secondaryColor'), datum.${e[1]})% length(scale('colors', datum.${e[0]}))]`}:"string"==typeof e?{scale:n,field:e}:{value:(0,W.getColorValue)(e.value,t)}},ke=e=>{if(e)return Array.isArray(e)?{signal:`scale('lineWidths', datum.${e[0]})[indexof(domain('secondaryLineWidth'), datum.${e[1]})% length(scale('lineWidths', datum.${e[0]}))]`}:"string"==typeof e?{scale:V.LINE_WIDTH_SCALE,field:e}:{value:re(e.value)}},Pe=e=>Array.isArray(e)?{signal:`scale('opacities', datum.${e[0]})[indexof(domain('secondaryOpacity'), datum.${e[1]})% length(scale('opacities', datum.${e[0]}))]`}:"string"==typeof e?{signal:`scale('${V.OPACITY_SCALE}', datum.${e})`}:{value:e.value},He=e=>"string"==typeof e?{scale:V.SYMBOL_SIZE_SCALE,field:e}:{value:se(e.value)},we=e=>Array.isArray(e)?{signal:`scale('lineTypes', datum.${e[0]})[indexof(domain('secondaryLineType'), datum.${e[1]})% length(scale('lineTypes', datum.${e[0]}))]`}:"string"==typeof e?{scale:V.LINE_TYPE_SCALE,field:e}:{value:ne(e.value)},Fe=(e,t)=>{const a=xe("x",e);return"time"===e?{scale:a,field:V.DEFAULT_TRANSFORMED_TIME_DIMENSION}:{scale:a,field:t}},Ge=(e,t)=>({scale:e||"yLinear",field:t}),ze=(e,t,a,n,r,i)=>({name:`${n}_pointsForVoronoi`,description:`${n}_pointsForVoronoi`,type:"symbol",from:{data:e},interactive:!1,encode:{enter:{y:Ge(i,a),fill:{value:"transparent"},stroke:{value:"transparent"}},update:{x:Fe(r,t)}}}),Be=(e,t)=>{const{chartPopovers:a,chartTooltips:n,name:r}=e,i="hasOnClick"in e&&e.hasOnClick;return{name:`${r}_voronoi`,description:`${r}_voronoi`,type:"path",from:{data:t},encode:{enter:{fill:{value:"transparent"},stroke:{value:"transparent"},isVoronoi:{value:!0},tooltip:De(null!=n?n:[],r,!0)},update:{cursor:Ae(null!=a?a:[],i)}},transform:[{type:"voronoi",x:"datum.x",y:"datum.y",size:[{signal:"max(width, 1)"},{signal:"max(height, 1)"}]}]}},Ue=(e,t,a,n,r,i,o)=>({name:`${r}_hoverGroup`,type:"group",marks:We().map(((s,l)=>({name:Ve(r,l),type:"symbol",from:{data:t},encode:{enter:{shape:{value:V.HOVER_SHAPE},y:Ge(o,n),fill:{value:"transparent"},stroke:{value:"transparent"},tooltip:De(e,r,!1),size:Ye(s)},update:{x:Fe(i,a)}}})))}),Ve=(e,t)=>`${e}_hover${t}`,We=()=>[...new Array(V.HOVER_SHAPE_COUNT)].map(((e,t)=>V.HOVER_SIZE/2**t)),Je=e=>[...new Array(V.HOVER_SHAPE_COUNT)].map(((t,a)=>Ve(e,a))),Ye=e=>({signal:`${e} * max(width, 1) / 1000`}),Ke=e=>{const{highlightedItem:t,idKey:a,name:n}=e,r=[V.DEFAULT_OPACITY_RULE];return Me(e)||void 0!==t?(it(r,e),Ce(e)?[{test:`!isValid(${V.SELECTED_GROUP}) && ${V.SELECTED_ITEM} && ${V.SELECTED_ITEM} !== datum.${a}`,value:1/V.HIGHLIGHT_CONTRAST_RATIO},Object.assign({test:`isValid(${V.SELECTED_ITEM}) && ${V.SELECTED_ITEM} === datum.${a}`},V.DEFAULT_OPACITY_RULE),{test:`isValid(${V.SELECTED_GROUP}) && ${V.SELECTED_GROUP} === datum.${n}_selectedGroupId`,value:1},{test:`isValid(${V.SELECTED_GROUP}) && ${V.SELECTED_GROUP} !== datum.${n}_selectedGroupId`,value:1/V.HIGHLIGHT_CONTRAST_RATIO},...r]:r):r},Xe=(e,t)=>{var a;return Me(e)||void 0!==e.highlightedItem?t:"trendlines"in e&&(null===(a=e.trendlines)||void 0===a?void 0:a.some((e=>Me(e))))?`${t}Trendline`:void 0};const qe=e=>e.chartTooltips.map((t=>Ze(t,e.name))),Ze=(e,t)=>{var{highlightBy:a="item"}=e,n=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]])}return a}(e,["highlightBy"]);return Object.assign({highlightBy:a,markName:t},n)},Qe=(e,t,a=!0)=>{const n=qe(t);for(const{highlightBy:r,markName:i}of n){if("item"===r)return;const n=q(e);n.transform||(n.transform=[]),"dimension"===r&&"donut"!==t.markType&&"venn"!==t.markType?n.transform.push(et([t.dimension],i)):"series"===r?n.transform.push(et([V.SERIES_ID],i)):Array.isArray(r)&&n.transform.push(et(r,i)),a&&e.push(tt(i))}},et=(e,t)=>({type:"formula",as:`${t}_highlightGroupId`,expr:e.map((e=>`datum.${e}`)).join(' + " | " + ')}),tt=e=>({name:`${e}_highlightedData`,source:V.FILTERED_TABLE,transform:[{type:"filter",expr:`${V.HIGHLIGHTED_GROUP} === datum.${e}_highlightGroupId`}]}),at=e=>qe(e).some((({highlightBy:e})=>e&&"item"!==e)),nt=(e,t)=>{if(at(t)){const a=e.find((e=>e.name===V.HIGHLIGHTED_GROUP));let n=t.name,r=`datum.${n}_highlightGroupId`;"interactionMode"in t&&t.interactionMode===V.INTERACTION_MODE.ITEM&&Je(n).forEach((e=>{rt(a,e,r)})),["scatter","line"].includes(t.markType)&&(r=`datum.${r}`,n+="_voronoi"),rt(a,n,r)}},rt=(e,t,a)=>{void 0===e.on&&(e.on=[]),e.on.push({events:`@${t}:mouseover`,update:a},{events:`@${t}:mouseout`,update:"null"})},it=(e,t)=>{if(e.unshift({test:`isArray(${V.HIGHLIGHTED_ITEM}) && length(${V.HIGHLIGHTED_ITEM}) > 0 && indexof(${V.HIGHLIGHTED_ITEM}, datum.${t.idKey}) === -1`,value:1/V.HIGHLIGHT_CONTRAST_RATIO},{test:`!isArray(${V.HIGHLIGHTED_ITEM}) && isValid(${V.HIGHLIGHTED_ITEM}) && ${V.HIGHLIGHTED_ITEM} !== datum.${t.idKey}`,value:1/V.HIGHLIGHT_CONTRAST_RATIO}),at(t)){const{name:a}=t;e.unshift(Object.assign({test:`${V.HIGHLIGHTED_GROUP} === datum.${a}_highlightGroupId`},V.DEFAULT_OPACITY_RULE))}},ot=(e,t,a)=>{const n=`domain("${e}Entries")[datum.index]`;return t?(null==a?void 0:a.length)?`indexof(pluck(data("${V.FILTERED_TABLE}"),"${e}_highlightGroupId"), ${n}) !== -1 ? ${n} : null`:`indexof(hiddenSeries, ${n}) === -1 ? ${n} : null`:n},st=(e,t=null)=>({name:e,value:t}),lt=(e,t,a,n=1,r)=>{const i=e.find((e=>e.name===V.HIGHLIGHTED_ITEM));if(i){void 0===i.on&&(i.on=[]);const e=new Array(n).fill("datum.").join(""),o=null==r?void 0:r.map((t=>`${e}${t}`)).join(" || ");i.on.push({events:`@${t}:mouseover`,update:(null==r?void 0:r.length)?`(${o}) ? null : ${e}${a}`:`${e}${a}`},{events:`@${t}:mouseout`,update:"null"})}},ct=(e,t,a=1,n)=>{const r=e.find((e=>e.name===V.HIGHLIGHTED_SERIES));if(r){void 0===r.on&&(r.on=[]);const e=new Array(a).fill("datum.").join(""),i=null==n?void 0:n.map((t=>`${e}${t}`)).join(" || ");r.on.push({events:`@${t}:mouseover`,update:(null==n?void 0:n.length)?`(${i}) ? null : ${e}${V.SERIES_ID}`:`${e}${V.SERIES_ID}`},{events:`@${t}:mouseout`,update:"null"})}},ut=(e,t=`${e.name}_facet`)=>{const{name:a,chartPopovers:n,chartTooltips:r,color:i,colorScheme:o,metricStart:s,metricEnd:l,isStacked:c,scaleType:u,dimension:d,opacity:m}=e;return{name:a,description:a,type:"area",from:{data:t},interactive:Me(e),encode:{enter:Object.assign({y:{scale:"yLinear",field:s},y2:{scale:"yLinear",field:l},fill:je(i,o),tooltip:De(null!=r?r:[],a)},Re(c,!0)),update:{x:mt(u,d),cursor:Ae(null!=n?n:[]),fillOpacity:{value:m},opacity:dt(e)}}}};function dt(e){const{chartPopovers:t,displayOnHover:a,isHighlightedByGroup:n,isMetricRange:r,highlightedItem:i,name:o}=e,s=1/V.HIGHLIGHT_CONTRAST_RATIO;if(r&&a)return[{test:`isValid(${V.HIGHLIGHTED_SERIES}) && ${V.HIGHLIGHTED_SERIES} === datum.${V.SERIES_ID}`,value:1},{test:`isValid(${V.HIGHLIGHTED_ITEM}) && indexof(pluck(data('${o}_highlightedData'), '${V.SERIES_ID}'), datum.${V.SERIES_ID}) > -1`},{test:`isValid(${V.SELECTED_SERIES}) && ${V.SELECTED_SERIES} === datum.${V.SERIES_ID}`,value:1},{value:0}];if(!Me(e)&&!i)return[V.DEFAULT_OPACITY_RULE];const l=[];return n&&l.push({test:`indexof(pluck(data('${o}_highlightedData'), '${V.SERIES_ID}'), datum.${V.SERIES_ID}) !== -1`,value:1}),!r&&(null==t?void 0:t.length)?[...l,{test:`!isValid(${V.SELECTED_SERIES}) && isValid(${V.HIGHLIGHTED_SERIES}) && ${V.HIGHLIGHTED_SERIES} !== datum.${V.SERIES_ID}`,value:s},{test:`!isValid(${V.SELECTED_SERIES}) && length(data('${o}_highlightedData')) > 0 && indexof(pluck(data('${o}_highlightedData'), '${V.SERIES_ID}'), datum.${V.SERIES_ID}) === -1`,value:s},{test:`isValid(${V.SELECTED_SERIES}) && ${V.SELECTED_SERIES} !== datum.${V.SERIES_ID}`,value:s},V.DEFAULT_OPACITY_RULE]:[...l,{test:`isValid(${V.HIGHLIGHTED_SERIES}) && ${V.HIGHLIGHTED_SERIES} !== datum.${V.SERIES_ID}`,value:s},{test:`length(data('${o}_highlightedData')) > 0 && indexof(pluck(data('${o}_highlightedData'), '${V.SERIES_ID}'), datum.${V.SERIES_ID}) === -1`,value:s},V.DEFAULT_OPACITY_RULE]}const mt=(e,t)=>"time"===e?{scale:"xTime",field:V.DEFAULT_TRANSFORMED_TIME_DIMENSION}:"linear"===e?{scale:"xLinear",field:t}:{scale:"xPoint",field:t};const pt=U(((e,t)=>{var a,n,r,i,{chartPopovers:o=[],chartTooltips:s=[],color:l=V.DEFAULT_COLOR,colorScheme:c=V.DEFAULT_COLOR_SCHEME,dimension:u=V.DEFAULT_TIME_DIMENSION,index:d=0,metric:m=V.DEFAULT_METRIC,metricStart:p,metricEnd:h,name:g,opacity:f=.8,scaleType:y="time"}=t,v=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]])}return a}(t,["chartPopovers","chartTooltips","color","colorScheme","dimension","index","metric","metricStart","metricEnd","name","opacity","scaleType"]);const b=Object.assign({chartPopovers:o,chartTooltips:s,color:l,colorScheme:c,dimension:u,index:d,metric:m,name:(0,J.toCamelCase)(g||`area${d}`),scaleType:y,opacity:f,metricStart:p,metricEnd:h},v);return!p&&!h||p&&h||(console.error(`${h?"metricEnd":"metricStart"} is defined but ${h?"metricStart":"metricEnd"} is not. Both must be defined in order to use the "start and end" method. Defaulting back to 'metric = ${m}'`),b.metricEnd=void 0,b.metricStart=void 0),e.data=ht(null!==(a=e.data)&&void 0!==a?a:[],b),e.signals=ft(null!==(n=e.signals)&&void 0!==n?n:[],b),e.scales=vt(null!==(r=e.scales)&&void 0!==r?r:[],b),e.marks=bt(null!==(i=e.marks)&&void 0!==i?i:[],b),e})),ht=U(((e,t)=>{var a,n;const{color:r,dimension:i,highlightedItem:o,metric:s,metricEnd:l,metricStart:c,name:u,order:d,scaleType:m}=t;if("time"===m){const t=X(e);t.transform=Y(null!==(a=t.transform)&&void 0!==a?a:[],i)}if(!l||!c){const t=q(e);t.transform=[...null!==(n=t.transform)&&void 0!==n?n:[],{type:"stack",groupby:[i],field:s,sort:K(d),as:[`${s}0`,`${s}1`]}]}if(Me(t)||void 0!==o){const a=Ce(t),n=Ne(t);e.push(gt(u,t.idKey,n,a,at(t))),a&&e.push({name:`${u}_selectedDataSeries`,source:V.FILTERED_TABLE,transform:[{type:"filter",expr:`isValid(${V.SELECTED_SERIES}) && ${V.SELECTED_SERIES} === datum.${r}`}]})}Qe(e,t,!1)})),gt=(e,t,a,n,r)=>{let i="";return r?i+=`${e}_controlledHoveredGroup === datum.${e}_highlightGroupId`:(i+=`isArray(${V.HIGHLIGHTED_ITEM}) && indexof(${V.HIGHLIGHTED_ITEM}, datum.${t}) > -1 || ${V.HIGHLIGHTED_ITEM} === datum.${t}`,a&&(i=`${e}_controlledHoveredId === datum.${t} || ${i}`)),n&&(i=`isValid(${V.SELECTED_ITEM}) && ${V.SELECTED_ITEM} === datum.${t} || !isValid(${V.SELECTED_ITEM}) && ${i}`),{name:`${e}_highlightedData`,source:V.FILTERED_TABLE,transform:[{type:"filter",expr:i}]}},ft=U(((e,t)=>{var a;const{chartTooltips:n,name:r}=t;Me(t)&&(ct(e,r,1,null===(a=n[0])||void 0===a?void 0:a.excludeDataKeys),t.highlightedItem&&yt(e,r),at(t)?e.push((e=>({name:`${e}_controlledHoveredGroup`,value:null,on:[{events:`@${e}:mouseout`,update:"null"}]}))(r)):e.push((e=>({name:`${e}_controlledHoveredId`,value:null,on:[{events:`@${e}:mouseout`,update:"null"}]}))(r)),nt(e,t))})),yt=(e,t)=>{const a=e.find((e=>e.name===V.HIGHLIGHTED_ITEM));a&&(void 0===a.on&&(a.on=[]),a.on.push({events:`@${t}:mouseover`,update:"null"}))},vt=U(((e,{metric:t,metricEnd:a,metricStart:n,dimension:r,color:i,scaleType:o,padding:s})=>(ve(e,{scaleType:o,dimension:r,padding:s}),Se(e,V.COLOR_SCALE,i),a&&n||(n=`${t}0`,a=`${t}1`),Ee(e,[n,a]),e))),bt=U(((e,t)=>{const{chartPopovers:a,chartTooltips:n,color:r,colorScheme:i,dimension:o,highlightedItem:s,metric:l,name:c,opacity:u,scaleType:d}=t;let{metricStart:m,metricEnd:p}=t,h=!1;return p&&m||(h=!0,m=`${l}0`,p=`${l}1`),e.push({name:`${c}_group`,type:"group",from:{facet:{name:`${c}_facet`,data:V.FILTERED_TABLE,groupby:r}},marks:[ut({chartPopovers:a,chartTooltips:n,color:r,colorScheme:i,dimension:o,isHighlightedByGroup:at(t),isStacked:h,highlightedItem:s,metricStart:m,metricEnd:p,name:c,opacity:u,scaleType:d}),...Et(t)]},..._t({chartPopovers:a,name:c,scaleType:d,color:r,dimension:o,metricEnd:p,metricStart:m}),...St(t)),e})),Et=e=>{const{name:t,dimension:a,metric:n,scaleType:r}=e;return Me(e)?[{name:`${t}_anchorPoint`,type:"symbol",from:{data:`${t}_highlightedData`},interactive:!1,encode:{enter:{y:{scale:"yLinear",field:`${n}1`},stroke:{value:"transparent"},fill:{value:"transparent"}},update:{x:mt(r,a)}}}]:[]},St=e=>{const{name:t,dimension:a,highlightedItem:n,metric:r,scaleType:i,color:o}=e;if(!Me(e)&&void 0===n)return[];const s=[{name:`${t}_point`,type:"symbol",from:{data:`${t}_highlightedData`},interactive:!1,encode:{enter:{y:{scale:"yLinear",field:`${r}1`},stroke:{scale:V.COLOR_SCALE,field:o},fill:{signal:V.BACKGROUND_COLOR}},update:{x:mt(i,a)}}}];return(qe(e).some((({highlightBy:e})=>"string"==typeof e&&["dimension","item"].includes(e)))||n)&&s.unshift({name:`${t}_rule`,type:"rule",from:{data:`${t}_highlightedData`},interactive:!1,encode:{enter:{y:{value:0},y2:{signal:"height"},strokeWidth:{value:1}},update:{x:mt(i,a)}}}),s},_t=({chartPopovers:e,name:t,scaleType:a,color:n,dimension:r,metricEnd:i,metricStart:o})=>e.length?[{name:`${t}_selectBorder`,type:"area",from:{data:`${t}_selectedDataSeries`},interactive:!1,encode:{enter:{y:{scale:"yLinear",field:o},y2:{scale:"yLinear",field:i},fill:{scale:V.COLOR_SCALE,field:n},stroke:{value:W.spectrumColors.light["static-blue"]},strokeWidth:{value:2},strokeJoin:{value:"round"}},update:{x:mt(a,r)}}}]:[];var Tt=i(743),Ot=i.n(Tt);const $t=({axisAnnotations:e,colorScheme:t,name:a,position:n,scaleType:r})=>"bottom"!==n?[]:e.map(((e,n)=>xt(e,n,a,t,r))),xt=({chartPopovers:e=[],chartTooltips:t=[],name:a,format:n,offset:r=V.DEFAULT_AXIS_ANNOTATION_OFFSET,color:i=V.DEFAULT_AXIS_ANNOTATION_COLOR,dataKey:o="annotations",options:s=[]},l,c,u,d)=>({chartPopovers:e,chartTooltips:t,color:i,colorScheme:u,dataKey:o,name:null!=a?a:`${c}Annotation${l}`,offset:r,options:s,axisName:c,format:null!=n?n:"time"===d?"span":"summary"});function Lt(e){const t=`${e}Primary`,a=`${e}Secondary`;return{primaryScale:t,secondaryScale:a,primaryDomain:`${t}Domain`,secondaryDomain:`${a}Domain`}}const It=(e,t="value",a,n)=>{const r=`isNumber(datum['${t}'])`;return"shortNumber"===e?[{test:r,signal:`formatShortNumber(datum['${t}'])`}]:"shortCurrency"===e?[{test:`${r} && abs(datum['${t}']) >= 1000`,signal:`upper(replace(format(datum['${t}'], '$.3~s'), /(\\d+)G/, '$1B'))`},{test:r,signal:`format(datum['${t}'], '$')`}]:n&&a?[{test:r,signal:`formatLocaleCurrency(datum, "${a}", "${n}", "${e}")`}]:[{test:r,signal:`format(datum['${t}'], '${pe(e)}')`}]},At=(e,t)=>{const{grid:a,hideDefaultLabels:n,labelAlign:r,labelFontWeight:i,labelOrientation:o,tickCountLimit:s,position:l,scaleType:c,ticks:u,tickMinStep:d,title:m,vegaLabelAlign:p,vegaLabelBaseline:h,vegaLabelOffset:g,vegaLabelPadding:f}=e;return Object.assign(Object.assign({scale:t,orient:l,grid:a,ticks:u,tickCount:wt(l,s,a),tickMinStep:"linear"!==c?void 0:d,title:m,labelAngle:Wt(o),labelFontWeight:i,labelOffset:Jt(r,t,g),labelPadding:f,labels:!n},Bt(l,o,r,p,h)),{encode:{labels:{update:{text:Yt(e,t)}}}})},Dt=(e,{granularity:t,grid:a,labelAlign:n,labelOrientation:r,position:i,ticks:o,title:s,vegaLabelAlign:l,vegaLabelBaseline:c})=>{const{tickCount:u}=Gt(t);return Object.assign(Object.assign({scale:e,orient:i,grid:a,ticks:o,tickCount:e.includes("Time")?u:void 0,title:s,formatType:"time",labelAngle:Wt(r),labelSeparation:12},Rt(t,i)),Bt(i,r,n,l,c))},Rt=(e,t)=>{const{secondaryLabelFormat:a,primaryLabelFormat:n}=Gt(e);return["left","right"].includes(t)?{format:`${n} ${a}`,encode:{labels:{update:{text:{signal:"formatVerticalAxisTimeLabels(datum)"}}}}}:{format:a}},Mt=(e,{granularity:t,labelAlign:a,labelOrientation:n,labelFontWeight:r,position:i,ticks:o,vegaLabelAlign:s,vegaLabelBaseline:l})=>{if(["left","right"].includes(i))return[];const{primaryLabelFormat:c,tickCount:u}=Gt(t);return[Object.assign(Object.assign({scale:e,orient:i,format:c,tickCount:e.includes("Time")?u:void 0,formatType:"time",labelOverlap:"greedy",labelFontWeight:r,labelAngle:Wt(n)},Bt(i,n,a,s,l)),{encode:{labels:{enter:{dy:{value:(o?28:20)*("top"===i?-1:1)}},update:{text:{signal:"formatHorizontalTimeAxisLabels(datum)"}}}}})]},Ct=(e,t)=>{var a;const n=e.filter((e=>"range"in e&&e.range===Nt(t)));let r;return r=n.length>1&&null!==(a=e.find((e=>e.name.includes("Trellis"))))&&void 0!==a?a:n[0],r||(r={name:Pt(t),type:"linear",range:Nt(t)},e.push(r),r)},Nt=e=>"left"===e||"right"===e?"height":"width",jt=e=>"left"===e||"right"===e?"width":"height",kt=e=>["left","right"].includes(e),Pt=e=>kt(e)?"yLinear":"xLinear",Ht=e=>kt(e)?"xLinear":"yLinear",wt=(e,t,a)=>{const n=["top","bottom"].includes(e)?"width":"height";return void 0!==t?{signal:`clamp(ceil(${n}/100), 2, ${t})`}:a?{signal:`clamp(ceil(${n}/100), 2, 10)`}:void 0},Ft=({subLabels:e,labelOrientation:t})=>Boolean(e.length&&"horizontal"===t),Gt=e=>{switch(e){case"second":return{secondaryLabelFormat:":%S",primaryLabelFormat:"%-I:%M %p",tickCount:"second"};case"minute":return{secondaryLabelFormat:"%-I:%M %p",primaryLabelFormat:"%b %-d",tickCount:"minute"};case"hour":return{secondaryLabelFormat:"%-I %p",primaryLabelFormat:"%b %-d",tickCount:"hour"};case"day":default:return{secondaryLabelFormat:"%-d",primaryLabelFormat:"%b",tickCount:"day"};case"week":return{secondaryLabelFormat:"%-d",primaryLabelFormat:"%b",tickCount:"week"};case"month":return{secondaryLabelFormat:"%b",primaryLabelFormat:"%Y",tickCount:"month"};case"quarter":return{secondaryLabelFormat:"Q%q",primaryLabelFormat:"%Y",tickCount:{interval:"month",step:3}};case"year":return{secondaryLabelFormat:"%Y",primaryLabelFormat:"",tickCount:"year"}}},zt=(e,t,a)=>a?Ut(e,t,a):{align:void 0,baseline:void 0},Bt=(e,t,a,n,r)=>{const{align:i,baseline:o}=Ut(e,t,a);return{labelAlign:null!=n?n:i,labelBaseline:null!=r?r:o}},Ut=(e,t,a)=>{let n,r;return Vt(e,t)?(n={start:"left",center:"center",end:"right"}[a],r=["top","left"].includes(e)?"bottom":"top"):(r={start:"top",center:"middle",end:"bottom"}[a],n=["bottom","left"].includes(e)?"right":"left"),{align:n,baseline:r}},Vt=(e,t)=>(["top","bottom"].includes(e)?"horizontal":"vertical")===t,Wt=e=>"horizontal"===e?0:270,Jt=(e,t,a)=>{if(void 0!==a)return a;switch(e){case"start":return{signal:`bandwidth('${t}') / -2`};case"end":return{signal:`bandwidth('${t}') / 2`};default:return}},Yt=({labelFormat:e,labelOrientation:t,numberFormat:a,position:n,truncateLabels:r,currencyLocale:i,currencyCode:o},s)=>"percentage"===e?[{test:"isNumber(datum.value)",signal:"format(datum.value, '~%')"},{signal:"datum.value"}]:"duration"===e?{signal:"formatTimeDurationLabels(datum)"}:[...It(a,void 0,i,o),...r&&s.includes("Band")&&Vt(n,t)?[{signal:'truncateText(datum.value, bandwidth("xBand")/(1- paddingInner), "normal", 14)'}]:[{signal:"datum.value"}]],Kt=(e,t,a,n,r,i)=>({update:Object.assign({text:[{test:`indexof(pluck(${i}, 'value'), datum.value) !== -1`,signal:`${i}[indexof(pluck(${i}, 'value'), datum.value)].${a}`},{signal:"datum.value"}],fontWeight:[{test:`indexof(pluck(${i}, 'value'), datum.value) !== -1 && ${i}[indexof(pluck(${i}, 'value'), datum.value)].fontWeight`,signal:`${i}[indexof(pluck(${i}, 'value'), datum.value)].fontWeight`},{value:t}]},Xt(r,i,n,e))}),Xt=(e,t,a,n)=>{const r=`indexof(pluck(${t}, 'value'), datum.value) !== -1 && ${t}[indexof(pluck(${t}, 'value'), datum.value)]`,i=`${t}[indexof(pluck(${t}, 'value'), datum.value)]`,{align:o,baseline:s}=Ut(e,a,n);return{align:[{test:`${r}.align`,signal:`${i}.align`},{value:o}],baseline:[{test:`${r}.baseline`,signal:`${i}.baseline`},{value:s}]}},qt=e=>e.referenceLines.map(((t,a)=>Zt(t,e,a))),Zt=(e,t,a)=>{var n,r,i;return Object.assign(Object.assign({},e),{color:e.color||"gray-800",colorScheme:t.colorScheme,iconColor:e.iconColor||V.DEFAULT_FONT_COLOR,labelColor:e.labelColor||V.DEFAULT_FONT_COLOR,labelFontWeight:null!==(n=e.labelFontWeight)&&void 0!==n?n:V.DEFAULT_LABEL_FONT_WEIGHT,layer:null!==(r=e.layer)&&void 0!==r?r:"front",name:`${t.name}ReferenceLine${a}`,lineType:null!==(i=e.lineType)&&void 0!==i?i:"solid"})},Qt=e=>Boolean(e&&["band","linear","point","time","utc"].includes(e)),ea=({scaleType:e},{value:t,position:a},n)=>{const r="string"==typeof t?`'${t}'`:t,i=`paddingInner * bandwidth('${n}') / (2 * (1 - paddingInner))`;return"band"===e?"before"===a?{signal:`scale('${n}', ${r}) - ${i}`}:"after"===a?{signal:`scale('${n}', ${r}) + bandwidth('${n}') + ${i}`}:{signal:`scale('${n}', ${r}) + bandwidth('${n}') / 2`}:{scale:n,value:t}},ta=({position:e,ticks:t},{color:a,colorScheme:n,name:r,lineType:i},o)=>{const s=t?9:0,l={top:{x:o,y:{value:-s},y2:{signal:"height"}},bottom:{x:o,y:{value:0},y2:{signal:`height + ${s}`}},left:{x:{value:-s},x2:{signal:"width"},y:o},right:{x:{value:0},x2:{signal:`width + ${s}`},y:o}};return{name:r,type:"rule",interactive:!1,encode:{enter:{stroke:{value:(0,W.getColorValue)(a,n)},strokeDash:{value:ne(null!=i?i:"solid")}},update:Object.assign({},l[e])}}},aa=(e,t,a)=>({top:{x:t,y:{value:-e}},bottom:{x:t,y:{signal:`height + ${e}`}},left:{x:{value:-e},y:Object.assign(Object.assign({},t),{offset:a})},right:{x:{signal:`width + ${e}`},y:Object.assign(Object.assign({},t),{offset:a})}}),na=({colorScheme:e,position:t},{icon:a,iconColor:n,name:r},i)=>{if(!a)return[];const o=aa(24,i);return[{name:`${r}_symbol`,type:"symbol",encode:{enter:{shape:{value:oe(a)},size:{value:324},fill:{value:(0,W.getColorValue)(n,e)}},update:Object.assign({},o[t])}}]},ra=(e,t,a)=>{const{label:n,name:r}=t;return n?[{name:`${r}_label`,type:"text",encode:Object.assign({},ia(e,Object.assign(Object.assign({},t),{label:n}),a))}]:[]},ia=({position:e},{colorScheme:t,icon:a,label:n,labelColor:r,labelFontWeight:i},o)=>{const{verticalOffset:s,horizontalOffset:l}=((e,t)=>{const a=kt(e);let n=a?40:28,r=a?4:5;return t&&(n+=a?25:20,a||(r+=25,n+=2)),{verticalOffset:n,horizontalOffset:r}})(e,a),c=aa(s,o,l);return{update:Object.assign(Object.assign({text:[{value:n}],fontWeight:[{value:i}],fill:{value:(0,W.getColorValue)(r,t)}},oa(e)),c[e])}},oa=e=>{switch(e){case"top":case"bottom":return{align:{value:"center"}};case"left":case"right":return{baseline:{value:"center"}}}},sa=e=>/[xy]TrellisGroup/g.test(JSON.stringify(e));var la=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]])}return a};const ca=U(((e,t)=>{var a,n,r,i,o,s,l,{name:c,axisAnnotations:u=[],baseline:d=!1,baselineOffset:m=0,colorScheme:p=V.DEFAULT_COLOR_SCHEME,granularity:h=V.DEFAULT_GRANULARITY,grid:g=!1,hideDefaultLabels:f=!1,index:y=0,labelAlign:v=V.DEFAULT_LABEL_ALIGN,labelFontWeight:b=V.DEFAULT_LABEL_FONT_WEIGHT,labelOrientation:E=V.DEFAULT_LABEL_ORIENTATION,labels:S=[],numberFormat:_="shortNumber",position:T,range:O,referenceLines:$=[],subLabels:x=[],ticks:L=!1}=t,I=la(t,["name","axisAnnotations","baseline","baselineOffset","colorScheme","granularity","grid","hideDefaultLabels","index","labelAlign","labelFontWeight","labelOrientation","labels","numberFormat","position","range","referenceLines","subLabels","ticks"]);const A=Ct(null!==(a=e.scales)&&void 0!==a?a:[],T),D=c||A.name,R=A.type,M=((e,t)=>{let a=e.find((e=>"range"in e&&e.range===jt(t)));return a||(a={name:Ht(t),type:"linear",range:jt(t)},e.push(a)),a.type})(null!==(n=e.scales)&&void 0!==n?n:[],T),C=Object.assign({axisAnnotations:u,baseline:d,baselineOffset:m,colorScheme:p,granularity:h,grid:g,hideDefaultLabels:f,index:y,labelAlign:v,labelFontWeight:b,labelOrientation:E,labels:S,name:`axis${y}`,numberFormat:_,position:T,range:O,referenceLines:$,subLabels:x,ticks:L,scaleType:null!=R?R:"linear"},I),N=null===(r=e.signals)||void 0===r?void 0:r.some((e=>"firstRscSeriesId"===e.name));e.data=ua(null!==(i=e.data)&&void 0!==i?i:[],Object.assign(Object.assign({},C),{scaleType:null!=R?R:"linear"})),e.signals=da(null!==(o=e.signals)&&void 0!==o?o:[],C),!O||"linear"!==R&&"time"!==R||(A.domain=O);const j=e.usermeta;return e.axes=pa(null!==(s=e.axes)&&void 0!==s?s:[],Object.assign(Object.assign({},C),{scaleName:D,opposingScaleType:M,usermeta:j,grid:C.grid&&!sa(e),dualMetricAxis:N})),e.marks=ga(null!==(l=e.marks)&&void 0!==l?l:[],Object.assign(Object.assign({},C),{usermeta:j,scaleName:D,opposingScaleType:M,dualMetricAxis:N})),e})),ua=U(((e,t)=>{$t(t).forEach((t=>{((e,{name:t,dataKey:a,color:n,colorScheme:r,options:i,format:o})=>{e.push(((e,t,a)=>({name:`${e}_details`,values:t.map((e=>Object.assign(Object.assign({},e),{color:(0,W.getColorValue)(e.color,a)})))}))(t,i,r)),"summary"===o?e.push(((e,t,a,n)=>({name:`${e}_summary`,source:V.FILTERED_TABLE,transform:[{type:"filter",expr:`datum.${t}`},{type:"flatten",fields:[t],as:[`${e}_id`]},{type:"aggregate",groupby:[`${e}_id`]},{type:"aggregate",groupby:["center"],fields:[t,t],ops:["count","values"],as:["number","annotations"]},{type:"formula",expr:`datum.annotations[0].${e}_id`,as:"id"},{type:"lookup",from:`${e}_details`,key:"id",values:["color"],fields:["id"]},{type:"formula",expr:`datum.number > 1 || datum.color == null ? '${(0,W.getColorValue)(a,n)}' : datum.color`,as:"color"}]}))(t,a,n,r)):e.push(((e,t,a,n)=>({name:`${e}_aggregate`,source:V.FILTERED_TABLE,transform:[{type:"filter",expr:`datum.${t}`},{type:"flatten",fields:[t],as:[`${e}_id`]},{type:"aggregate",groupby:[`${e}_id`],fields:["datetime","datetime"],ops:["min","max"]},{type:"formula",expr:"datum.max_datetime - datum.min_datetime",as:"width"},{type:"formula",expr:"datum.width / 2 + datum.min_datetime",as:"center"},{type:"aggregate",groupby:["center"],fields:["min_datetime","max_datetime","width",t,t],ops:["min","max","max","count","values"],as:["lower","upper","width","number","annotations"]},{type:"formula",expr:`datum.annotations[0].${e}_id`,as:"id"},{type:"lookup",from:`${e}_details`,key:"id",values:["color"],fields:["id"]},{type:"formula",expr:`datum.number > 1 || datum.color == null ? '${(0,W.getColorValue)(a,n)}' : datum.color`,as:"color"}]}))(t,a,n,r),(e=>({name:`${e}_range`,source:`${e}_aggregate`,transform:[{type:"filter",expr:`${e}_highlighted && datum.center == ${e}_highlighted.center && ${e}_highlighted.width > 0`}]}))(t))})(e,t)}))})),da=U(((e,t)=>{const{name:a,labels:n,position:r,subLabels:i,labelOrientation:o}=t;(null==n?void 0:n.length)&&e.push(st(`${a}_labels`,ma(n,r,o))),Ft(t)&&e.push(st(`${a}_subLabels`,i.map((e=>Object.assign(Object.assign({},e),zt(r,o,e.align)))))),$t(t).forEach((t=>{((e,{name:t,format:a})=>{"span"===a&&e.push((e=>({name:`${e}_highlighted`,value:null,on:[{events:`@${e}_icon:mouseover`,update:"datum"},{events:`@${e}_icon:mouseout`,update:`${e}_clicked`}]}))(t),(e=>({name:`${e}_clicked`,value:{},on:[{events:{markname:`${e}_icon`,type:"mousedown",between:[{type:"mousedown"},{type:"mouseup"}]},update:"datum"},{events:"window:mouseup",update:"{}"}]}))(t),(e=>({name:`${e}_selected`,update:`${e}_clicked.center`}))(t))})(e,t)}))})),ma=(e,t,a)=>e.map((e=>{if("object"==typeof e)return Object.assign(Object.assign({},e),zt(t,a,e.align))})).filter(Boolean);const pa=U(((e,t)=>{var{scaleName:a,opposingScaleType:n,dualMetricAxis:r}=t,i=la(t,["scaleName","opposingScaleType","dualMetricAxis"]);const o=[];i=Object.assign(Object.assign({},i),(e=>{let t={};if(e.includes("TrellisBand")){const a=`bandwidth('${e}') / -2`,n=e.startsWith("x")?"x":"y";t={position:"x"===n?"top":"left",labelFontWeight:"bold",labelAlign:void 0,title:void 0,vegaLabelAlign:"left",vegaLabelBaseline:"bottom",vegaLabelOffset:"x"===n?{signal:a}:{signal:`${a} - 8`},vegaLabelPadding:"x"===n?8:0}}return t})(a));const{baseline:s,colorScheme:l,usermeta:c,labelAlign:u,labelFontWeight:d,labelFormat:m,labelOrientation:p,name:h,position:g}=i;if("time"===m)o.push(...((e,t)=>[Dt(e,t),...Mt(e,t)])(a,i));else{const e=At(i,a);if(i.labels.length){const t=i.labels,a=`${h}_labels`;e.values=t.map((e=>(e=>"object"==typeof e?e.value:e)(e))),e.encode={labels:Kt(u,d,"label",p,g,a)}}if(Ft(i)){e.titlePadding=24;const t=((e,t)=>{const{labelAlign:a,labelFontWeight:n,labelOrientation:r,name:i,position:o,ticks:s}=e,l=`${i}_subLabels`,c=e.subLabels.map((e=>e.value));let u=At(e,t);return u=Object.assign(Object.assign({},u),{domain:!1,domainWidth:void 0,grid:!1,labelPadding:s?32:24,ticks:!1,title:void 0,values:c.length?c:void 0,encode:{labels:Object.assign({},Kt(a,n,"subLabel",r,o,l))}}),u})(i,a);ha({dualMetricAxis:r,axis:t,usermeta:c,scaleName:a,colorScheme:l,position:g,incrementMetricAxisCount:!1}),o.push(t)}ha({dualMetricAxis:r,axis:e,usermeta:c,scaleName:a,colorScheme:l,position:g,incrementMetricAxisCount:!0}),o.unshift(e)}"linear"!==n&&(o[0]=function(e,t=!1){return Object.assign(Object.assign({},e),{domain:t,domainWidth:2})}(o[0],s)),Qt(i.scaleType)&&qt(i).forEach((e=>{var t,n,r;const{label:i,icon:s,value:l,position:c}=e,u=null===(r=null===(n=null===(t=o[0].encode)||void 0===t?void 0:t.labels)||void 0===n?void 0:n.update)||void 0===r?void 0:r.text;!s&&!i||!u||!Array.isArray(u)||c&&"center"!==c||u.unshift({test:`abs(scale('${a}', ${l}) - scale('${a}', datum.value)) < 30`,value:""})})),$t(i).forEach((e=>{((e,{offset:t},a)=>{e.push({scale:a,orient:"bottom",values:[],offset:t})})(o,e,a)})),e.push(...o)})),ha=({dualMetricAxis:e,axis:t,usermeta:a,scaleName:n,colorScheme:r,position:i,incrementMetricAxisCount:o})=>{var s;const l=null!==(s=null==a?void 0:a.chartOrientation)&&void 0!==s?s:"vertical";e&&function(e,t){return"vertical"===t?kt(e):!kt(e)}(i,l)&&(a.metricAxisCount||(a.metricAxisCount=0),function(e,t,a,n=V.DEFAULT_COLOR_SCHEME){const r=Lt(a),{primaryScale:i,secondaryScale:o}=r;t?(e.scale=i,function(e,t=V.DEFAULT_COLOR_SCHEME){const a=W.spectrumColors[t][V.DEFAULT_FONT_COLOR],n=[{test:`length(domain('${V.COLOR_SCALE}')) -1 === 1`,signal:`scale('${V.COLOR_SCALE}', ${V.FIRST_RSC_SERIES_ID})`},{value:a}],r=[{test:`${V.MOUSE_OVER_SERIES} === ${V.LAST_RSC_SERIES_ID}`,value:1/V.HIGHLIGHT_CONTRAST_RATIO}],i={labels:{update:{fill:n,fillOpacity:r}},title:{update:{fill:n,fillOpacity:r}}};e.encode?e.encode=Ot()(e.encode,i):e.encode=i}(e,n)):(e.scale=o,function(e){const t=[{signal:`scale('${V.COLOR_SCALE}', ${V.LAST_RSC_SERIES_ID})`}],a=[{test:`isValid(${V.MOUSE_OVER_SERIES}) && ${V.MOUSE_OVER_SERIES} !== ${V.LAST_RSC_SERIES_ID}`,value:1/V.HIGHLIGHT_CONTRAST_RATIO}],n={labels:{enter:{fill:t},update:{fillOpacity:a}},title:{enter:{fill:t},update:{fillOpacity:a}}};e.encode?e.encode=Ot()(e.encode,n):e.encode=n}(e))}(t,0===a.metricAxisCount,n,r),o&&a.metricAxisCount++)},ga=U(((e,t)=>{const{baseline:a,baselineOffset:n,opposingScaleType:r,position:i,scaleName:o,scaleType:s,usermeta:l}=t;if(Qt(s)){const{back:a,front:n}=((e,t)=>{const a={back:[],front:[]},n=qt(e);for(const r of n){const{layer:n}=r,i=ea(e,r,t);a[n].push(ta(e,r,i),...na(e,r,i),...ra(e,r,i))}return a})(t,o);e.unshift(...a),e.push(...n)}const c=e.find((e=>{var t;return null===(t=e.name)||void 0===t?void 0:t.includes("Trellis")})),u=Boolean(c);a&&"linear"===r&&function(e,t,a,n){var r,i;const o=((e,t)=>{const a=kt(t)?"y":"x",n={x:{x:{value:0},x2:{signal:"width"},y:{scale:"yLinear",value:e}},y:{x:{scale:"xLinear",value:e},y:{value:0},y2:{signal:"height"}}};return{name:`${a}Baseline`,description:`${a}Baseline`,type:"rule",interactive:!1,encode:{update:Object.assign({},n[a])}}})(t,a);n&&"marks"in n?0===t?null===(r=n.marks)||void 0===r||r.push(o):null===(i=n.marks)||void 0===i||i.unshift(o):0===t?e.push(o):e.unshift(o)}(e,n,i,c),u&&function(e,t,a,n){var r,i,o,s;const l=(null===(r=t.name)||void 0===r?void 0:r.startsWith("x"))?"horizontal":"vertical",c="bottom"===e.position||"top"===e.position?"horizontal":"vertical",u=e.hideDefaultLabels||l!==c;let d=e.scaleType;if(l===c){const n=Ct(null!==(i=t.scales)&&void 0!==i?i:[],e.position);a=n.name,d=null!==(o=n.type)&&void 0!==o?o:"linear"}else e.title=void 0;let m=pa([],Object.assign(Object.assign({},e),{hideDefaultLabels:u,scaleName:a,scaleType:d,dualMetricAxis:!1,usermeta:n}));m=((e,t)=>{const{facetName:a,facetGroupBy:n,trellisScaleName:r}=(e=>{var t;const a=`${(null!==(t=e.name)&&void 0!==t?t:"x")[0]}TrellisBand`,n=e.from;return{facetGroupBy:n.facet.groupby,facetName:n.facet.name,trellisScaleName:a}})(t);return e.map((e=>e.title?Object.assign(Object.assign({},e),{encode:Object.assign(Object.assign({},e.encode),{title:{update:{opacity:[{test:`info(domain('${r}')[0] === data('${a}')[0].${n})`,value:1},{value:0}]}}})}):e))})(m,t),t.axes=[...null!==(s=t.axes)&&void 0!==s?s:[],...m]}(t,c,o,l),$t(t).forEach((t=>{((e,t,a)=>{const{format:n}=t;"summary"===n?e.push((({chartPopovers:e,name:t,offset:a})=>({name:`${t}_group`,type:"group",from:{data:`${t}_summary`},marks:[{name:`${t}_icon`,type:"path",from:{data:`${t}_summary`},zindex:2,encode:{enter:{stroke:{value:"transparent"},strokeWidth:{value:2},cursor:Ae(e)},update:{path:{signal:`'${V.ANNOTATION_SINGLE_ICON_SVG}'`},fill:{field:"color"},xc:{signal:"width - 12"},yc:{signal:`height + ${a}`}}}}]}))(t)):e.push((({chartPopovers:e,name:t,offset:a},n)=>({name:`${t}_group`,type:"group",marks:[{name:`${t}_range`,type:"group",marks:[{type:"rect",from:{data:`${t}_range`},encode:{update:{x:{scale:n,field:"lower",band:.5},y:{signal:`height + ${a}`},width:{value:2},height:{value:-4},fill:{field:"color"},fillOpacity:{signal:`${t}_selected ? 1.0 : 0.2`}}}},{type:"rect",from:{data:`${t}_range`},encode:{update:{x:{scale:n,field:"lower",band:.5},y:{signal:`height + ${a}`},x2:{scale:n,field:"upper",band:.5},height:{value:2},fill:{field:"color"},fillOpacity:{signal:`${t}_selected ? 1.0 : 0.2`}}}},{type:"rect",from:{data:`${t}_range`},encode:{update:{x:{scale:n,field:"upper",band:.5},y:{signal:`height + ${a} + 2`},width:{value:2},height:{value:-6},fill:{field:"color"},fillOpacity:{signal:`${t}_selected ? 1.0 : 0.2`}}}}]},{name:`${t}_icon`,type:"path",from:{data:`${t}_aggregate`},encode:{enter:{stroke:{value:"transparent"},strokeWidth:{value:2},cursor:Ae(e)},update:{path:{signal:`datum.width > 0 ? '${V.ANNOTATION_RANGED_ICON_SVG}' : '${V.ANNOTATION_SINGLE_ICON_SVG}'`},fill:{field:"color"},xc:{scale:n,field:"center",band:.5},yc:{signal:`height + ${a}`},fillOpacity:{signal:`(${t}_selected && ${t}_selected != datum.center) ? 0.0 : 1.0`}}}}]}))(t,a))})(e,t,o)}))}));const fa=(e,t)=>e.map((e=>ya(e,t))),ya=(e,t)=>{var{UNSAFE_highlightBy:a="item"}=e,n=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]])}return a}(e,["UNSAFE_highlightBy"]);return Object.assign({UNSAFE_highlightBy:a,markName:t},n)},va=(e,t,a=!0)=>{const n=fa(t.chartPopovers,t.name);for(const{UNSAFE_highlightBy:r,markName:i}of n){const n=q(e);n.transform||(n.transform=[]),"dimension"===r&&"donut"!==t.markType?n.transform.push(ba([t.dimension],i)):"series"===r?n.transform.push(ba([V.SERIES_ID],i)):Array.isArray(r)?n.transform.push(ba(r,i)):n.transform.push(ba([t.idKey],i)),a&&e.push(Ea(i))}},ba=(e,t)=>({type:"formula",as:`${t}_selectedGroupId`,expr:e.map((e=>`datum.${e}`)).join(' + " | " + ')}),Ea=e=>({name:`${e}_selectedData`,source:V.FILTERED_TABLE,transform:[{type:"filter",expr:`${V.SELECTED_GROUP} === datum.${e}_selectedGroupId`}]});const Sa=e=>e.trendlines.map(((t,a)=>_a(e,t,a))),_a=(e,t,a)=>{var{chartTooltips:n=[],color:r,dimensionExtent:i,dimensionRange:o=[null,null],displayOnHover:s=!1,highlightRawPoint:l=!1,lineType:c="dashed",lineWidth:u="M",method:d="linear",opacity:m=1,orientation:p="horizontal",trendlineAnnotations:h=[]}=t,g=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]])}return a}(t,["chartTooltips","color","dimensionExtent","dimensionRange","displayOnHover","highlightRawPoint","lineType","lineWidth","method","opacity","orientation","trendlineAnnotations"]);const f=Ca(e,p),y="time"===f&&Ia(d)&&"horizontal"===p,{trendlineDimension:v,trendlineMetric:b}=$a(e.dimension,e.metric,p,y),E=r?{value:r}:Ta(e.color);return Object.assign({chartTooltips:n,colorScheme:e.colorScheme,displayOnHover:s,dimensionExtent:null!=i?i:o,dimensionRange:o,dimensionScaleType:f,highlightRawPoint:l,isDimensionNormalized:y,lineType:c,lineWidth:u,method:d,metric:V.TRENDLINE_VALUE,name:`${e.name}Trendline${a}`,opacity:m,orientation:p,trendlineAnnotations:h,trendlineColor:E,trendlineDimension:v,trendlineMetric:b},g)},Ta=e=>Array.isArray(e)?e[0]:e,Oa=e=>Array.isArray(e)?e[0]:e,$a=(e,t,a,n)=>"horizontal"===a?{trendlineDimension:xa(e,n),trendlineMetric:t}:{trendlineDimension:t,trendlineMetric:e},xa=(e,t)=>t?`${e}Normalized`:e,La=e=>["average","median"].includes(e),Ia=e=>Da(e)||["exponential","logarithmic","power"].includes(e),Aa=e=>e.startsWith("movingAverage-"),Da=e=>e.startsWith("polynomial-")||["linear","quadratic"].includes(e),Ra=e=>{switch(e){case"linear":return 1;case"quadratic":return 2}const t=parseInt(e.split("-")[1]);if(t<1)throw new Error(`Invalid polynomial order: ${t}, order must be an interger greater than 0`);return t},Ma=(e,t,a)=>{const n=`${t}_extent`;return{signal:`[${e.map(((e,t)=>{switch(e){case null:return`${n}[${t}]`;case"domain":return`${n}[${t}] ${0===t?"-":"+"} (${n}[1] - ${n}[0]) * 0.3`;default:return a?`(${e} - data('${V.FILTERED_TABLE}')[0].datetimeMin + ${V.MS_PER_DAY}) / ${V.MS_PER_DAY}`:e}})).join(", ")}]`}},Ca=(e,t)=>"vertical"===t?"linear":"scaleType"in e?e.scaleType:e.dimensionScaleType,Na=(e,{method:t,trendlineDimension:a,trendlineMetric:n},r)=>{const{color:i,lineType:o}=e,{facets:s}=te({color:i,lineType:o}),l={average:"mean",median:"median"};return r?{type:"aggregate",groupby:s,ops:[l[t],"min","max"],fields:[n,a,a],as:[V.TRENDLINE_VALUE,`${a}Min`,`${a}Max`]}:{type:"joinaggregate",groupby:s,ops:[l[t]],fields:[n],as:[V.TRENDLINE_VALUE]}},ja=(e,t,a)=>{const{color:n,lineType:r}=e,{dimensionExtent:i,isDimensionNormalized:o,method:s,name:l,trendlineDimension:c,trendlineMetric:u}=t,{facets:d}=te({color:n,lineType:r});let m,p;switch(s){case"exponential":m="exp";break;case"logarithmic":m="log";break;case"power":m="pow";break;default:p=Ra(s),m="poly"}return{type:"regression",method:m,order:p,groupby:d,x:c,y:u,as:a?[c,V.TRENDLINE_VALUE]:void 0,params:!a,extent:a?Ma(i,l,o):void 0}},ka=(e,{method:t,trendlineMetric:a})=>{const n=parseInt(t.split("-")[1]),{color:r,lineType:i}=e,{facets:o}=te({color:r,lineType:i});if(isNaN(n)||n<1)throw new Error(`Invalid moving average frame width: ${n}, frame width must be an integer greater than 0`);return{type:"window",ops:["mean"],groupby:o,fields:[a],as:[V.TRENDLINE_VALUE],frame:[n-1,0]}},Pa=e=>[{type:"joinaggregate",fields:[e],as:[`${e}Min`],ops:["min"]},{type:"formula",expr:`(datum.${e} - datum.${e}Min + ${V.MS_PER_DAY}) / ${V.MS_PER_DAY}`,as:`${e}Normalized`}],Ha=(e,t)=>({type:"extent",field:e,signal:`${t}_extent`}),wa=(e,t)=>{const a=[];return null!==t[0]&&a.push(`datum.${e} >= ${t[0]}`),null!==t[1]&&a.push(`datum.${e} <= ${t[1]}`),a.length?[{type:"filter",expr:a.join(" && ")}]:[]},Fa=(e,t)=>{let a="";if(Da(t)){const n=Ra(t);a=["datum.coef[0]",...Array(n).fill(0).map(((t,a)=>`datum.coef[${a+1}] * pow(datum.${e}, ${a+1})`))].join(" + ")}else"exponential"===t?a=`datum.coef[0] + exp(datum.coef[1] * datum.${e})`:"logarithmic"===t?a=`datum.coef[0] + datum.coef[1] * log(datum.${e})`:"power"===t&&(a=`datum.coef[0] * pow(datum.${e}, datum.coef[1])`);return a?[{type:"formula",expr:a,as:V.TRENDLINE_VALUE}]:[]},Ga=({color:e,lineType:t},{name:a})=>{const{facets:n}=te({color:e,lineType:t});return{type:"lookup",from:`${a}_params`,key:"keys",fields:n,values:["coef"]}},za=(e,t)=>{var a;e.push(...Ba(t));const n=X(e);n.transform=Ka(null!==(a=n.transform)&&void 0!==a?a:[],t)},Ba=e=>{const t=[],{color:a,idKey:n,lineType:r,name:i}=e,o=Sa(e),s={name:`${i}_allTrendlineData`,source:[]};for(const n of o){const{displayOnHover:i,method:o,name:l}=n,{facets:c}=te({color:a,lineType:r});Ia(o)?t.push(...Va(e,n,c)):La(o)?t.push(...Ua(e,n,c)):Aa(o)&&t.push(Wa(e,n)),i&&t.push(Xa(l,o)),Me(n)&&s.source.push(`${l}_data`)}return o.some((e=>Me(e)))&&(t.push(s),t.push(Ja(i,n))),t},Ua=(e,t,a)=>{const n=[],{dimensionRange:r,name:i,trendlineDimension:o}=t,s=wa(o,r);return n.push({name:`${i}_highResolutionData`,source:V.FILTERED_TABLE,transform:[...qa(t.excludeDataKeys),...s,...Ya(e,t,!0),...Z(a)]}),Me(t)&&n.push({name:`${i}_data`,source:V.FILTERED_TABLE,transform:[...s,...Ya(e,t,!1)]}),n},Va=(e,t,a)=>{const n=[],{dimension:r,metric:i}=e,{dimensionRange:o,method:s,name:l,orientation:c,trendlineDimension:u}=t,{trendlineDimension:d}=$a(r,i,c,!1),m=wa(d,o);return n.push({name:`${l}_highResolutionData`,source:V.FILTERED_TABLE,transform:[...qa(t.excludeDataKeys),...m,...Ya(e,t,!0),...Z(a)]}),Me(t)&&n.push({name:`${l}_params`,source:V.FILTERED_TABLE,transform:[...m,...Ya(e,t,!1)]},{name:`${l}_data`,source:V.FILTERED_TABLE,transform:[...m,Ga(e,t),...Fa(u,s)]}),n},Wa=(e,t)=>({name:`${t.name}_data`,source:V.FILTERED_TABLE,transform:[...qa(t.excludeDataKeys),...Ya(e,t,!1),...wa(e.dimension,t.dimensionRange)]}),Ja=(e,t)=>({name:`${e}Trendline_highlightedData`,source:`${e}_allTrendlineData`,transform:[{type:"filter",expr:`${V.SELECTED_ITEM} === datum.${t} || !isValid(${V.SELECTED_ITEM}) && (isArray(${V.HIGHLIGHTED_ITEM}) && indexof(${V.HIGHLIGHTED_ITEM}, datum.${t}) || ${V.HIGHLIGHTED_ITEM} === datum.${t})`}]}),Ya=(e,t,a)=>{const{method:n,trendlineDimension:r}=t;return La(n)?[Na(e,t,a)]:Ia(n)?[ja(e,t,a)]:Aa(n)?[(i=r,{type:"collect",sort:{field:i}}),ka(e,t)]:[];var i},Ka=U(((e,t)=>{const{dimension:a,metric:n}=t,r=Sa(t);for(const{isDimensionNormalized:t,method:i,name:o,orientation:s,trendlineDimension:l}of r)if(Ia(i)){const{trendlineDimension:r}=$a(a,n,s,!1);t&&(e.some((e=>"as"in e&&e.as===`${r}Normalized`))||e.push(...Pa(r))),e.push(Ha(l,o))}})),Xa=(e,t)=>({name:`${e}_highlightedData`,source:Aa(t)?`${e}_data`:`${e}_highResolutionData`,transform:[{type:"filter",expr:`datum.${V.SERIES_ID} === ${V.HIGHLIGHTED_SERIES} || datum.${V.SERIES_ID} === ${V.SELECTED_SERIES}`}]}),qa=e=>{var t;return null!==(t=null==e?void 0:e.map((e=>({type:"filter",expr:`!datum.${e}`}))))&&void 0!==t?t:[]},Za=e=>`datum.${e} && datum.${e} === true`,Qa=(e,t)=>`(${V.SELECTED_ITEM} && ${V.SELECTED_ITEM} === datum.${t}) || (${V.SELECTED_GROUP} && ${V.SELECTED_GROUP} === datum.${e}_selectedGroupId)`,en=e=>{const{dimension:t,metric:a,metricAxis:n,name:r,scaleType:i}=e;return{name:`${r}_pointBackground`,description:`${r}_pointBackground`,type:"symbol",from:{data:`${r}_highlightedData`},interactive:!1,encode:{enter:{y:Ge(n,a),fill:{signal:V.BACKGROUND_COLOR},stroke:{signal:V.BACKGROUND_COLOR}},update:{size:cn(e),strokeWidth:un(e),x:Fe(i,t)}}}},tn=(e,t=!0)=>{const{color:a,colorScheme:n,dimension:r,metric:i,metricAxis:o,name:s,scaleType:l}=e;return{name:`${s}_point_${t?"highlight":"select"}`,type:"symbol",from:{data:`${s}${t?"_highlightedData":"_selectedData"}`},interactive:!1,encode:{enter:{y:Ge(o,i),stroke:je(a,n)},update:{fill:on(e),size:cn(e),stroke:sn(e),strokeOpacity:ln(e),strokeWidth:un(e),x:Fe(l,r)}}}},an=e=>tn(e,!0),nn=e=>tn(e,!1),rn=(e,t)=>{const{color:a,colorScheme:n,dimension:r,metricAxis:i,name:o,scaleType:s}=e;return{name:`${o}_secondaryPoint`,type:"symbol",from:{data:`${o}_highlightedData`},interactive:!1,encode:{enter:{y:Ge(i,t),fill:{signal:V.BACKGROUND_COLOR},stroke:je(a,n)},update:{x:Fe(s,r)}}}},on=e=>{const{color:t,colorScheme:a,idKey:n,name:r,staticPoint:i}=e,o=[],s=Qa(r,n);return i&&o.push(Object.assign({test:Za(i)},je(t,a))),Ce(e)&&o.push(Object.assign({test:s},je(t,a))),[...o,{signal:V.BACKGROUND_COLOR}]},sn=e=>{const{color:t,colorScheme:a,idKey:n,name:r,staticPoint:i}=e,o=[],s=Qa(r,n);return i&&o.push(Object.assign({test:Za(i)},je(t,a))),Ce(e)&&o.push({test:s,signal:V.BACKGROUND_COLOR}),[...o,je(t,a)]},ln=({opacity:e,staticPoint:t})=>{const a=Pe(e),n=[];return t&&n.push(Object.assign({test:Za(t)},((e=V.DEFAULT_OPACITY_RULE)=>"signal"in e?{signal:`${e.signal} / ${V.HIGHLIGHT_CONTRAST_RATIO}`}:{value:e.value/V.HIGHLIGHT_CONTRAST_RATIO})(a))),[...n,a]},cn=({staticPoint:e})=>{const t=[];return e&&t.push({test:Za(e),value:64}),[...t,{value:V.DEFAULT_SYMBOL_SIZE}]},un=({staticPoint:e})=>{const t=[];return e&&t.push({test:Za(e),value:6}),[...t,{value:V.DEFAULT_SYMBOL_STROKE_WIDTH}]},dn=e=>{const{colorScheme:t,dimension:a,idKey:n,metric:r,metricAxis:i,name:o,scaleType:s}=e,l=Qa(o,n);return{name:`${o}_pointSelectRing`,type:"symbol",from:{data:`${o}_selectedData`},interactive:!1,encode:{enter:{y:Ge(i,r),fill:{signal:V.BACKGROUND_COLOR},stroke:{value:(0,W.getColorValue)("static-blue",t)}},update:{size:[{test:l,value:196},{value:0}],strokeWidth:[{test:l,value:V.DEFAULT_SYMBOL_STROKE_WIDTH},{value:0}],x:Fe(s,a)}}}},mn=(e,t)=>{const{chartPopovers:a,color:n,colorScheme:r,dimension:i,lineType:o,lineWidth:s,metric:l,metricAxis:c,name:u,opacity:d,scaleType:m}=e,p=fa(null!=a?a:[],u).some((({UNSAFE_highlightBy:e})=>"dimension"===e));return{name:u,description:u,type:"line",from:{data:t},interactive:!1,encode:{enter:{y:Ge(c,l),stroke:je(n,r),strokeDash:we(o),strokeOpacity:Pe(d),strokeWidth:ke(s)},update:Object.assign({x:Fe(m,i)},p?{}:{opacity:pn(e)})}}},pn=({displayOnHover:e,interactiveMarkName:t,popoverMarkName:a,isHighlightedByGroup:n,highlightedItem:r})=>{if((!t||e)&&void 0===r)return[V.DEFAULT_OPACITY_RULE];const i=[];return n&&i.push({test:`indexof(pluck(data('${t}_highlightedData'), '${V.SERIES_ID}'), datum.${V.SERIES_ID}) !== -1`,value:1}),i.push({test:`isValid(${V.HIGHLIGHTED_SERIES}) && ${V.HIGHLIGHTED_SERIES} !== datum.${V.SERIES_ID}`,value:1/V.HIGHLIGHT_CONTRAST_RATIO},{test:`length(data('${t}_highlightedData')) > 0 && indexof(pluck(data('${t}_highlightedData'), '${V.SERIES_ID}'), datum.${V.SERIES_ID}) === -1`,value:1/V.HIGHLIGHT_CONTRAST_RATIO}),a&&i.push({test:`isValid(${V.SELECTED_SERIES}) && ${V.SELECTED_SERIES} !== datum.${V.SERIES_ID}`,value:1/V.HIGHLIGHT_CONTRAST_RATIO}),i.push(V.DEFAULT_OPACITY_RULE),i},hn=(e,t,a)=>{const{dimension:n,name:r,scaleType:i}=e;return[gn(n,r,i),en(e),...Ce(e)?[dn(e),nn(e)]:[],an(e),...a?[rn(e,a)]:[],...fn(t,e)]},gn=(e,t,a)=>({name:`${t}_hoverRule`,description:`${t}_hoverRule`,type:"rule",from:{data:`${t}_highlightedData`},interactive:!1,encode:{enter:{y:{value:0},y2:{signal:"height"},strokeWidth:{value:1}},update:{x:Fe(a,e),opacity:{signal:`length(data('${t}_selectedData')) > 0 ? 0 : 1`}}}}),fn=(e,t)=>{const{interactionMode:a=V.DEFAULT_INTERACTION_MODE}=t;return{nearest:yn,item:vn}[a](t,e)},yn=(e,t)=>{const{dimension:a,metric:n,metricAxis:r,name:i,scaleType:o}=e;return[ze(t,a,n,i,o,r),Be(e,`${i}_pointsForVoronoi`)]},vn=(e,t)=>{const{chartTooltips:a=[],dimension:n,metric:r,metricAxis:i,name:o,scaleType:s}=e;return[Ue(a,t,n,r,o,s,i)]},bn=(e,t)=>{const a=[];return((e,t)=>e.trendlineAnnotations.map(((a,n)=>(({badge:e=!1,dimensionValue:t="end",numberFormat:a="",prefix:n=""},r,{colorScheme:i,dimensionExtent:o,dimensionScaleType:s,displayOnHover:l,lineWidth:c,orientation:u,trendlineColor:d,trendlineDimension:m,name:p},h)=>({badge:e,colorScheme:i,dimensionValue:t,displayOnHover:l,markName:h,name:`${p}Annotation${r}`,numberFormat:a,prefix:n,trendlineColor:d,trendlineDimension:m,trendlineDimensionExtent:o,trendlineDimensionScaleType:s,trendlineName:p,trendlineOrientation:u,trendlineWidth:re(c)}))(a,n,e,t))))(e,t).forEach((e=>{a.push({name:`${e.name}_group`,type:"group",interactive:!1,marks:[En(e),Tn(e),...$n(e)]})})),a},En=e=>{const{name:t,trendlineName:a,trendlineWidth:n,displayOnHover:r}=e;return{name:`${t}_points`,type:"symbol",from:{data:r?`${a}_highlightedData`:`${a}_highResolutionData`},interactive:!1,encode:{enter:{opacity:{value:0},size:{value:Math.pow(n,2)},x:Sn(e),y:_n(e)}}}},Sn=({dimensionValue:e,trendlineDimension:t,trendlineDimensionExtent:a,trendlineDimensionScaleType:n,trendlineOrientation:r})=>{const i=xe("x",n);if("vertical"===r)return{scale:i,field:V.TRENDLINE_VALUE};switch(e){case"start":return Mn(a[0],t,i,"x");case"end":return Cn(a[1],t,i,"x");default:return{scale:i,value:e}}},_n=({dimensionValue:e,trendlineDimension:t,trendlineDimensionExtent:a,trendlineOrientation:n})=>{const r="yLinear";if("horizontal"===n)return{scale:r,field:V.TRENDLINE_VALUE};switch(e){case"start":return Mn(a[0],t,r,"y");case"end":return Cn(a[1],t,r,"y");default:return{scale:r,value:e}}},Tn=e=>{const{name:t,numberFormat:a,prefix:n,trendlineName:r,markName:i}=e,o=n?`'${n} ' + `:"",s=On(Object.assign({},e));return{name:t,type:"text",from:{data:`${t}_points`},zindex:1,interactive:!1,encode:{enter:{text:{signal:`${o}format(datum.datum.${V.TRENDLINE_VALUE}, '${a}')`},fill:s}},transform:[{type:"label",size:{signal:"[width, height]"},avoidMarks:[r,`${i}_group`],offset:[6,6,6,6,8.49,8.49,8.49,8.49],anchor:["top","bottom","right","left","top-right","top-left","bottom-right","bottom-left"]}]}},On=({badge:e,colorScheme:t,trendlineColor:a})=>{if(!e)return;const n=((e,t,a="ordinal")=>{const n=je(e,t,a);return"signal"in n?n.signal:"scale"in n&&"field"in n?`scale('${n.scale}', datum.${n.field})`:"value"in n&&n.value?`'${n.value}'`:""})(xn(a),t),r=[(0,W.getColorValue)("gray-50",t),(0,W.getColorValue)("gray-900",t)];return[{test:`contrast(${n}, '${r[0]}') >= 4.5`,value:r[0]},{value:r[1]}]},$n=({badge:e,colorScheme:t,name:a,trendlineColor:n})=>{if(!e)return[];const r=xn(n,2);return[{name:`${a}_badge`,description:`${a}_badge`,type:"rect",from:{data:`${a}`},interactive:!1,encode:{enter:{cornerRadius:{value:2},fill:je(r,t),opacity:{field:"opacity"},x:{signal:"datum.bounds.x1 - 3"},x2:{signal:"datum.bounds.x2 + 3"},y:{signal:"datum.bounds.y1 - 3"},y2:{signal:"datum.bounds.y2 + 3"}}}}]},xn=(e,t=1)=>"string"==typeof e?`${new Array(t).fill("datum.").join("")}${e}`:e,Ln=e=>{const{color:t,lineType:a}=e,{facets:n}=te({color:t,lineType:a}),r=[],i=Sa(e);for(const t of i){const{displayOnHover:a,method:i,name:o}=t;if(La(i))r.push(An(e,t));else{const s=In(o,i,a);r.push({name:`${o}_group`,type:"group",clip:!0,from:{facet:{name:`${o}_facet`,data:s,groupby:n}},marks:[Nn(e,t)]})}r.push(...bn(t,e.name))}return i.some((e=>Ne(e)))&&r.push(Pn(e,i.some((e=>e.highlightRawPoint)))),r},In=(e,t,a)=>a?`${e}_highlightedData`:Ia(t)?`${e}_highResolutionData`:`${e}_data`,An=(e,t)=>{const{colorScheme:a}=e,{dimensionExtent:n,dimensionScaleType:r,displayOnHover:i,lineType:o,lineWidth:s,name:l,orientation:c,trendlineColor:u,trendlineDimension:d}=t;return{name:l,type:"rule",clip:!0,from:{data:i?`${l}_highlightedData`:`${l}_highResolutionData`},interactive:!1,encode:{enter:Object.assign(Object.assign({},Dn(n,d,c)),{stroke:je(u,a),strokeDash:we({value:o}),strokeOpacity:Pe({value:t.opacity}),strokeWidth:ke({value:s})}),update:Object.assign(Object.assign({},Rn(n,d,r,c)),{opacity:pn(Hn(e,t))})}}},Dn=(e,t,a)=>"horizontal"===a?{y:{scale:"yLinear",field:V.TRENDLINE_VALUE}}:{y:Mn(e[0],t,"yLinear","y"),y2:Cn(e[1],t,"yLinear","y")},Rn=(e,t,a,n)=>{const r=xe("x",a);return"vertical"===n?{x:{scale:r,field:V.TRENDLINE_VALUE}}:{x:Mn(e[0],t,r,"x"),x2:Cn(e[1],t,r,"x")}},Mn=(e,t,a,n)=>{switch(e){case null:return{scale:a,field:`${t}Min`};case"domain":return"x"===n?{value:0}:{signal:"height"};default:return{scale:a,value:e}}},Cn=(e,t,a,n)=>{switch(e){case null:return{scale:a,field:`${t}Max`};case"domain":return"x"===n?{signal:"width"}:{value:0};default:return{scale:a,value:e}}},Nn=(e,t)=>{const{colorScheme:a}=e,{dimensionScaleType:n,isDimensionNormalized:r,lineType:i,lineWidth:o,name:s,orientation:l,trendlineColor:c,trendlineDimension:u}=t;return{name:s,type:"line",from:{data:`${s}_facet`},interactive:!1,encode:{enter:{y:jn(u,l),stroke:je(c,a),strokeDash:we({value:i}),strokeOpacity:Pe({value:t.opacity}),strokeWidth:ke({value:o})},update:{x:kn(u,n,l,r),opacity:pn(Hn(e,t))}}}},jn=(e,t)=>{const a="yLinear";return"horizontal"===t?{scale:a,field:V.TRENDLINE_VALUE}:{scale:a,field:e}},kn=(e,t,a,n)=>{const r=xe("x",t);return"vertical"===a?{scale:r,field:V.TRENDLINE_VALUE}:n?{scale:"xTrendline",field:e}:{scale:r,field:e}},Pn=(e,t)=>{const{metric:a,name:n}=e,r=Sa(e),i=Hn(e,r[0],{name:`${n}Trendline`,chartTooltips:r.map((e=>e.chartTooltips)).flat(),metric:V.TRENDLINE_VALUE});return{name:`${n}Trendline_hoverGroup`,type:"group",clip:!0,marks:hn(i,`${n}_allTrendlineData`,t?a:void 0)}},Hn=(e,{dimensionScaleType:t,displayOnHover:a,lineWidth:n,metric:r,name:i,opacity:o},s)=>{const{color:l,lineType:c}=e,u="popoverMarkName"in e?e.popoverMarkName:void 0,d="staticPoint"in e?e.staticPoint:void 0;return Object.assign(Object.assign(Object.assign({},e),{color:Ta(l),displayOnHover:a,lineType:Oa(c),lineWidth:{value:n},metric:r,name:i,opacity:{value:o},popoverMarkName:u,scaleType:t,staticPoint:d}),s)},wn=e=>{const{dimension:t}=e;return Sa(e).some((({dimensionScaleType:e,method:t})=>Ia(t)&&"time"===e))?[{name:"xTrendline",type:"linear",range:"width",domain:{data:V.FILTERED_TABLE,fields:[`${t}Normalized`]},padding:V.LINEAR_PADDING,zero:!1,nice:!1}]:[]},Fn=(e,t)=>{const{idKey:a,name:n}=t,r=Sa(t);r.some((e=>Ne(e)))&&(lt(e,`${n}Trendline_voronoi`,a,2),ct(e,`${n}Trendline_voronoi`,2)),r.some((e=>e.displayOnHover))&&ct(e,`${n}_voronoi`,2)},Gn=({trellisOrientation:e,name:t,trellisPadding:a})=>{const n="horizontal"===e?"x":"y";return{facetName:`${t}_trellis`,scaleName:`${n}TrellisBand`,markName:`${n}TrellisGroup`,rangeScale:"x"===n?"width":"height",axis:n,paddingInner:a}},zn=e=>Boolean(e.trellis),Bn=({color:e,lineType:t,opacity:a})=>[e,t,a].some((e=>Array.isArray(e)&&2===e.length)),Un=e=>{const{dualMetricAxis:t,type:a}=e;return Boolean(t&&!zn(e)&&"dodged"===a&&!Bn(e))},Vn=e=>{const{dimension:t,groupedPadding:a,orientation:n,name:r,paddingRatio:i}=e,{dimensionScaleKey:o,dimensionAxis:s,rangeScale:l}=tr(n);return{name:`${r}_group`,type:"group",from:{facet:{data:zn(e)?Gn(e).facetName:V.FILTERED_TABLE,name:`${r}_facet`,groupby:t}},encode:{enter:{[s]:{scale:o,field:t}}},signals:[{name:l,update:`bandwidth("${o}")`}],scales:[{name:`${r}_position`,type:"band",range:l,domain:{data:V.FILTERED_TABLE,field:`${r}_dodgeGroup`},paddingInner:null!=a?a:i}]}},Wn=e=>{const{dimensionAxis:t,rangeScale:a}=tr(e.orientation),n=`${e.name}_position`;return{[t]:{scale:n,field:`${e.name}_dodgeGroup`},[a]:{scale:n,band:1}}},Jn=e=>Object.assign(Object.assign({},(e=>{const{metric:t,type:a}=e,{metricAxis:n,metricScaleKey:r}=tr(e.orientation,e.metricAxis),i=`${n}2`;return"stacked"===a||Bn(e)?(e=>{const{metric:t,orientation:a}=e,{metricAxis:n,metricScaleKey:r}=tr(e.orientation,e.metricAxis),i=`${n}2`,o=`datum.${t}0`,s=`datum.${t}1`;return"vertical"===a?{[n]:[{test:`${o} === 0`,signal:`scale('${r}', ${o})`},{test:`${s} > 0`,signal:`max(scale('${r}', ${o}) - 1.5, scale('${r}', ${s}))`},{signal:`min(scale('${r}', ${o}) + 1.5, scale('${r}', ${s}))`}],[i]:{scale:r,field:`${t}1`}}:{[n]:[{test:`${o} === 0`,signal:`scale('${r}', ${o})`},{test:`${s} > 0`,signal:`min(scale('${r}', ${o}) + 1.5, scale('${r}', ${s}))`},{signal:`max(scale('${r}', ${o}) - 1.5, scale('${r}', ${s}))`}],[i]:{scale:r,field:`${t}1`}}})(e):Un(e)?{[n]:[{test:`datum.${V.SERIES_ID} === ${V.LAST_RSC_SERIES_ID}`,scale:`${r}Secondary`,value:0},{scale:`${r}Primary`,value:0}],[i]:[{test:`datum.${V.SERIES_ID} === ${V.LAST_RSC_SERIES_ID}`,scale:`${r}Secondary`,field:t},{scale:`${r}Primary`,field:t}]}:{[n]:{scale:r,value:0},[i]:{scale:r,field:t}}})(e)),(e=>{const{type:t,lineWidth:a,metric:n,hasSquareCorners:r}=e,i=r?0:Math.max(1,V.CORNER_RADIUS-re(a)/2);let o;return o="dodged"!==t||Bn(e)?(({name:e,metric:t,lineWidth:a,hasSquareCorners:n})=>{const r=`datum.${t}1 > 0 && data('${e}_stacks')[indexof(pluck(data('${e}_stacks'), '${V.STACK_ID}'), datum.${V.STACK_ID})].max_${t}1 === datum.${t}1`,i=`datum.${t}1 < 0 && data('${e}_stacks')[indexof(pluck(data('${e}_stacks'), '${V.STACK_ID}'), datum.${V.STACK_ID})].min_${t}1 === datum.${t}1`,o=n?0:Math.max(1,V.CORNER_RADIUS-re(a)/2);return{cornerRadiusTopLeft:[{test:r,value:o},{value:0}],cornerRadiusTopRight:[{test:r,value:o},{value:0}],cornerRadiusBottomLeft:[{test:i,value:o},{value:0}],cornerRadiusBottomRight:[{test:i,value:o},{value:0}]}})(e):{cornerRadiusTopLeft:[{test:`datum.${n} > 0`,value:i},{value:0}],cornerRadiusTopRight:[{test:`datum.${n} > 0`,value:i},{value:0}],cornerRadiusBottomLeft:[{test:`datum.${n} < 0`,value:i},{value:0}],cornerRadiusBottomRight:[{test:`datum.${n} < 0`,value:i},{value:0}]},((e,{orientation:t})=>"vertical"===t?e:{cornerRadiusTopLeft:e.cornerRadiusBottomLeft,cornerRadiusTopRight:e.cornerRadiusTopLeft,cornerRadiusBottomLeft:e.cornerRadiusBottomRight,cornerRadiusBottomRight:e.cornerRadiusTopRight})(o,e)})(e)),Yn=({chartTooltips:e,color:t,colorScheme:a,name:n,opacity:r})=>({fill:je(t,a),fillOpacity:Pe(r),tooltip:De(e,n)}),Kn=e=>({cursor:Ae(e.chartPopovers,e.hasOnClick),opacity:Ke(e),stroke:Xn(e),strokeDash:qn(e),strokeWidth:Zn(e)}),Xn=({name:e,chartPopovers:t,color:a,colorScheme:n,idKey:r})=>{const i=je(a,n);return Ce({chartPopovers:t})?[{test:`(${V.SELECTED_ITEM} && ${V.SELECTED_ITEM} === datum.${r}) || (${V.SELECTED_GROUP} && ${V.SELECTED_GROUP} === datum.${e}_selectedGroupId)`,value:(0,W.getColorValue)("static-blue",n)},i]:[i]},qn=({chartPopovers:e,idKey:t,lineType:a})=>{const n=we(a);return Ce({chartPopovers:e})?[{test:`isValid(${V.SELECTED_ITEM}) && ${V.SELECTED_ITEM} === datum.${t}`,value:[]},n]:[n]},Zn=({chartPopovers:e,idKey:t,lineWidth:a,name:n})=>{const r=re(a),i={value:r},o=fa(e,n),s=o.some((({UNSAFE_highlightBy:e})=>"dimension"===e));return 0===o.length||s?[i]:[{test:`(isValid(${V.SELECTED_ITEM}) && ${V.SELECTED_ITEM} === datum.${t}) || (isValid(${V.SELECTED_GROUP}) && ${V.SELECTED_GROUP} === datum.${n}_selectedGroupId)`,value:Math.max(r,2)},i]},Qn=(e,t)=>$e(e,t),er=e=>"stacked"===e.type||Bn(e)?[`${e.metric}1`]:[e.metric],tr=(e,t)=>"vertical"===e?{metricAxis:"y",dimensionAxis:"x",metricScaleKey:t||"yLinear",dimensionScaleKey:"xBand",rangeScale:"width"}:{metricAxis:"x",dimensionAxis:"y",metricScaleKey:t||"xLinear",dimensionScaleKey:"yBand",rangeScale:"height"},ar=e=>{const{metricAxis:t,orientation:a}=e,{metricScaleKey:n}=tr(a);return t||n};const nr=(e,t,a,n,r)=>{var{textKey:i}=e,o=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]])}return a}(e,["textKey"]);return Object.assign({barOptions:t,textKey:i||t.metric,dataName:a,dimensionScaleName:n,dimensionField:r},o)},rr=(e,t,a,n)=>{const r=((e,t,a,n)=>{const r=e.barAnnotations[0];if(r)return nr(r,e,t,a,n)})(e,t,a,n);return r?[{type:"group",name:`${e.name}_annotationGroup`,marks:[ir(r),or(r)]}]:[]},ir=({barOptions:e,dataName:t,dimensionField:a,dimensionScaleName:n,textKey:r,style:i})=>{const{metricAxis:o,dimensionAxis:s}=tr(e.orientation),l=cr(r,i),c=ur(e,l);return{name:`${e.name}_annotationText`,type:"text",from:{data:t},interactive:!1,zindex:1,encode:{enter:{[s]:{scale:n,field:a,band:.5},[o]:c,text:[{test:`bandwidth('${n}') > ${sr(e.orientation)}`,field:r}],fontSize:{value:V.ANNOTATION_FONT_SIZE},fontWeight:{value:V.ANNOTATION_FONT_WEIGHT},baseline:{value:"middle"},align:{value:"center"}}}}},or=({barOptions:e,dimensionScaleName:t,textKey:a,style:n})=>({name:`${e.name}_annotationBackground`,description:`${e.name}_annotationBackground`,type:"rect",from:{data:`${e.name}_annotationText`},interactive:!1,encode:{enter:Object.assign(Object.assign({},lr(null==n?void 0:n.width)),{y:{signal:`datum.bounds.y1 - ${V.ANNOTATION_PADDING}`},y2:{signal:`datum.bounds.y2 + ${V.ANNOTATION_PADDING}`},cornerRadius:{value:4},fill:[{test:`datum.datum.${a} && bandwidth('${t}') > ${sr(e.orientation)}`,signal:V.BACKGROUND_COLOR}]})}}),sr=e=>"vertical"===e?48:V.ANNOTATION_FONT_SIZE+2*V.ANNOTATION_PADDING,lr=e=>e?{xc:{signal:"(datum.bounds.x1 + datum.bounds.x2) / 2"},width:{value:e}}:{x:{signal:`datum.bounds.x1 - ${V.ANNOTATION_PADDING}`},x2:{signal:`datum.bounds.x2 + ${V.ANNOTATION_PADDING}`}},cr=(e,t)=>(null==t?void 0:t.width)?{value:t.width}:{signal:`getLabelWidth(datum.${e}, '${V.ANNOTATION_FONT_WEIGHT}', ${V.ANNOTATION_FONT_SIZE}) + ${2*V.ANNOTATION_PADDING}`},ur=(e,t)=>{const{type:a,metric:n,orientation:r}=e,i="stacked"===a||Bn(e)?`${n}1`:n,{metricScaleKey:o}=tr(r),s=(({orientation:e},t)=>"vertical"===e?""+((2*V.ANNOTATION_PADDING+V.ANNOTATION_FONT_SIZE)/2+2.5):"value"in t?""+(t.value/2+2.5):`((${t.signal}) / 2 + 2.5)`)(e,t);return"vertical"===r?[{test:`datum.${i} < 0`,signal:`max(scale('${o}', datum.${i}), scale('${o}', 0) + ${s})`},{signal:`min(scale('${o}', datum.${i}), scale('${o}', 0) - ${s})`}]:[{test:`datum.${i} < 0`,signal:`min(scale('${o}', datum.${i}), scale('${o}', 0) - ${s})`},{signal:`max(scale('${o}', datum.${i}), scale('${o}', 0) + ${s})`}]},dr=e=>{const{name:t}=e;return{name:`${t}_background`,description:`${t}_background`,type:"rect",from:{data:Bn(e)?`${t}_facet`:hr(e)},interactive:!1,encode:{enter:Object.assign(Object.assign({},Jn(e)),{fill:{signal:V.BACKGROUND_COLOR}}),update:Object.assign({},pr(e))}}},mr=e=>{const{name:t}=e;return{name:t,description:t,type:"rect",from:{data:Bn(e)?`${t}_facet`:hr(e)},interactive:Me(e),encode:{enter:Object.assign(Object.assign({},Jn(e)),Yn(e)),update:Object.assign(Object.assign({},pr(e)),Kn(e))}}},pr=e=>{const{dimension:t,orientation:a}=e;if(Bn(e))return Wn(e);const{dimensionAxis:n,rangeScale:r,dimensionScaleKey:i}=tr(a);return{[n]:{scale:i,field:t},[r]:{scale:i,band:1}}},hr=e=>zn(e)?Gn(e).facetName:V.FILTERED_TABLE;const gr=U(((e,t)=>{var a,n,r,i,{barAnnotations:o=[],chartPopovers:s=[],chartTooltips:l=[],color:c={value:"categorical-100"},colorScheme:u=V.DEFAULT_COLOR_SCHEME,dimension:d=V.DEFAULT_CATEGORICAL_DIMENSION,dualMetricAxis:m=!1,hasOnClick:p=!1,hasSquareCorners:h=!1,index:g=0,lineType:f={value:"solid"},lineWidth:y=0,metric:v=V.DEFAULT_METRIC,metricAxis:b,name:E,opacity:S={value:1},orientation:_="vertical",paddingRatio:T=V.PADDING_RATIO,trellisOrientation:O="horizontal",trellisPadding:$=V.TRELLIS_PADDING,type:x="stacked",trendlines:L=[]}=t,I=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]])}return a}(t,["barAnnotations","chartPopovers","chartTooltips","color","colorScheme","dimension","dualMetricAxis","hasOnClick","hasSquareCorners","index","lineType","lineWidth","metric","metricAxis","name","opacity","orientation","paddingRatio","trellisOrientation","trellisPadding","type","trendlines"]);const A=(0,J.toCamelCase)(E||`bar${g}`),D=Object.assign({barAnnotations:o,chartPopovers:s,chartTooltips:l,dimensionScaleType:"band",dualMetricAxis:m,orientation:_,color:c,colorScheme:u,dimension:d,hasOnClick:p,hasSquareCorners:h,index:g,interactiveMarkName:Xe({chartPopovers:s,chartTooltips:l,hasOnClick:p,highlightedItem:I.highlightedItem,trendlines:L},A),lineType:f,lineWidth:y,metric:v,metricAxis:b,name:A,opacity:S,paddingRatio:T,trellisOrientation:O,trellisPadding:$,trendlines:L,type:x},I);e.usermeta={chartOrientation:D.orientation},e.data=yr(null!==(a=e.data)&&void 0!==a?a:[],D),e.signals=fr(null!==(n=e.signals)&&void 0!==n?n:[],D),e.scales=Tr(null!==(r=e.scales)&&void 0!==r?r:[],D),e.marks=xr(null!==(i=e.marks)&&void 0!==i?i:[],D)})),fr=U(((e,t)=>{var a;const{barAnnotations:n,chartTooltips:r,chartPopovers:i,idKey:o,name:s,paddingRatio:l,paddingOuter:c,trendlines:u}=t,{paddingInner:d}=Qn(l,c);var m;e.push(st("paddingInner",d)),Un(t)&&e.push({name:`${V.FIRST_RSC_SERIES_ID}`,value:null,update:`length(domain("${V.COLOR_SCALE}")) > 0 ? domain("${V.COLOR_SCALE}")[0] : null`},{name:`${V.LAST_RSC_SERIES_ID}`,value:null,update:`length(domain("${V.COLOR_SCALE}")) > 0 ? peek(domain("${V.COLOR_SCALE}")) : null`},(m=s,{name:`${V.MOUSE_OVER_SERIES}`,value:null,on:[{events:`@${m}:mouseover`,update:`datum.${V.SERIES_ID}`},{events:`@${m}:mouseout`,update:"null"}]})),(n.length||i.length||r.length||u.length)&&(lt(e,s,o,1,null===(a=r[0])||void 0===a?void 0:a.excludeDataKeys),nt(e,t),Fn(e,t))})),yr=U(((e,t)=>{var a,n,r,i,o;const{dimension:s,dimensionDataType:l,metric:c,order:u,type:d}=t;if(l===V.TIME){const t=X(e);t.transform=Y(null!==(a=t.transform)&&void 0!==a?a:[],s)}const m=e.findIndex((e=>e.name===V.FILTERED_TABLE));e[m].transform=null!==(n=e[m].transform)&&void 0!==n?n:[],("stacked"===d||Bn(t))&&(null===(r=e[m].transform)||void 0===r||r.push({type:"stack",groupby:Er(t),field:c,sort:K(u),as:[`${c}0`,`${c}1`]}),null===(i=e[m].transform)||void 0===i||i.push(br(t)),e.push(vr(t))),("dodged"===d||Bn(t))&&(null===(o=e[m].transform)||void 0===o||o.push(Sr(t))),_r(e,t),za(e,t),Qe(e,t),va(e,t)})),vr=e=>{const{metric:t,name:a}=e;return{name:`${a}_stacks`,source:V.FILTERED_TABLE,transform:[{type:"aggregate",groupby:Er(e),fields:[`${t}1`,`${t}1`],ops:["min","max"]},br(e)]}},br=e=>({type:"formula",as:V.STACK_ID,expr:Er(e).map((e=>`datum.${e}`)).join(' + "," + ')}),Er=({trellis:e,color:t,dimension:a,lineType:n,opacity:r,type:i})=>{const{facets:o,secondaryFacets:s}=te({color:t,lineType:n,opacity:r});return[...e?[e]:[],a,..."dodged"===i?o:[],..."stacked"===i?s:[]]},Sr=({color:e,lineType:t,name:a,opacity:n,type:r})=>{const{facets:i,secondaryFacets:o}=te({color:e,lineType:t,opacity:n});return{type:"formula",as:`${a}_dodgeGroup`,expr:("dodged"===r?i:o).map((e=>`datum.${e}`)).join(' + "," + ')}},_r=(e,t)=>{if(Un(t)){const a=Lt(ar(t));a.primaryDomain&&a.secondaryDomain&&(e.push({name:a.primaryDomain,source:V.FILTERED_TABLE,transform:[{type:"filter",expr:`datum.${V.SERIES_ID} !== ${V.LAST_RSC_SERIES_ID}`}]}),e.push({name:a.secondaryDomain,source:V.FILTERED_TABLE,transform:[{type:"filter",expr:`datum.${V.SERIES_ID} === ${V.LAST_RSC_SERIES_ID}`}]}))}},Tr=U(((e,t)=>{const{color:a,lineType:n,opacity:r,metricAxis:i}=t,{metricAxis:o}=tr(t.orientation);if(Ee(e,er(t),o),i&&Ee(e,er(t),o,i),Un(t)){const a=Lt(ar(t));Ee(e,er(t),o,a.primaryScale,a.primaryDomain),Ee(e,er(t),o,a.secondaryScale,a.secondaryDomain)}Or(e,t),((e,t)=>{if(!t.trellis)return;const{scaleName:a,rangeScale:n,paddingInner:r}=Gn(t),i=fe(e,a,"band");e[i]=ye(e[i],[t.trellis]),e[i]=Object.assign(Object.assign({},e[i]),{range:n,paddingInner:r})})(e,t),Se(e,V.COLOR_SCALE,a),Se(e,V.LINE_TYPE_SCALE,n),Se(e,V.OPACITY_SCALE,r),$r(e,t)})),Or=(e,{dimension:t,paddingRatio:a,paddingOuter:n,orientation:r})=>{const{dimensionAxis:i}=tr(r),o=ge(e,"band",i);e[o]=ye(e[o],[t]);const{paddingInner:s,paddingOuter:l}=Qn(a,n);e[o]=Object.assign(Object.assign({},e[o]),{paddingInner:s,paddingOuter:l})},$r=(e,t)=>{const{color:a,lineType:n,opacity:r}=t;Bn(t)&&[{value:a,scaleName:"colors",secondaryScaleName:"secondaryColor"},{value:n,scaleName:"lineTypes",secondaryScaleName:"secondaryLineType"},{value:r,scaleName:"opacities",secondaryScaleName:"secondaryOpacity"}].forEach((({value:t,scaleName:a,secondaryScaleName:n})=>{if(Array.isArray(t)&&2===t.length){const r=fe(e,n,"ordinal");e[r]=ye(e[r],[t[1]]);const i=fe(e,a,"ordinal"),o=e[i];o.range={signal:a},e[i]=ye(o,[t[0]])}}))},xr=U(((e,t)=>{const{chartPopovers:a,name:n,type:r}=t,i=[];if(Bn(t)?i.push((e=>{const t=[];return t.push(dr(e)),t.push(mr(e)),t.push(...rr(e,`${e.name}_facet`,`${e.name}_position`,`${e.name}_dodgeGroup`)),Object.assign(Object.assign({},Vn(e)),{marks:t})})(t)):"stacked"===r?i.push(...(e=>{const t=[];return t.push(dr(e)),t.push(mr(e)),t.push(...rr(e,hr(e),tr(e.orientation).dimensionScaleKey,e.dimension)),t})(t)):i.push((e=>{const{name:t}=e;return Object.assign(Object.assign({},Vn(e)),{marks:[{name:`${t}_background`,from:{data:`${t}_facet`},type:"rect",interactive:!1,encode:{enter:Object.assign(Object.assign({},Jn(e)),{fill:{signal:V.BACKGROUND_COLOR}}),update:Object.assign({},Wn(e))}},{name:t,from:{data:`${t}_facet`},type:"rect",interactive:Me(e),encode:{enter:Object.assign(Object.assign({},Jn(e)),Yn(e)),update:Object.assign(Object.assign({},Wn(e)),Kn(e))}},...rr(e,`${t}_facet`,`${t}_position`,`${t}_dodgeGroup`)]})})(t)),fa(a,n).some((e=>"dimension"===e.UNSAFE_highlightBy))&&i.push((e=>{const{name:t,colorScheme:a,paddingRatio:n,orientation:r}=e,i="vertical"===r?{y:{value:0},y2:{signal:"height"},xc:{signal:`scale('xBand', datum.${t}_selectedGroupId) + bandwidth('xBand')/2`},width:{signal:`bandwidth('xBand')/(1 - ${n} / 2)`}}:{x:{value:0},x2:{signal:"width"},yc:{signal:`scale('yBand', datum.${t}_selectedGroupId) + bandwidth('yBand')/2`},height:{signal:`bandwidth('yBand')/(1 - ${n} / 2)`}};return{name:`${t}_selectionRing`,type:"rect",from:{data:`${t}_selectedData`},interactive:!1,encode:{enter:{fill:{value:"transparent"},strokeWidth:{value:2},stroke:{value:(0,W.getColorValue)("static-blue",a)},cornerRadius:{value:6}},update:i}}})(t)),zn(t)){const a=Lr(t);e.push(((e,t,a)=>{const{trellisOrientation:n}=e,r=e.trellis,{markName:i,facetName:o,scaleName:s,axis:l,rangeScale:c}=Gn(e);return{name:i,type:"group",from:{facet:{data:V.FILTERED_TABLE,name:o,groupby:r}},signals:[{name:c,update:`bandwidth('${s}')`}],encode:{enter:{[l]:{scale:s,field:r},height:{signal:"vertical"===n?`bandwidth('${s}')`:"height"},width:{signal:"horizontal"===n?`bandwidth('${s}')`:"width"}}},scales:[a],marks:t}})(t,i,a))}else e.push(...i);e.push(...Ln(t))})),Lr=e=>{const{orientation:t,trellisOrientation:a}=e;if(t===a){const{metricAxis:a}=tr(t);return((e,t,a)=>{let n=Te("linear",t,a);return n=ye(n,e),n})(er(e),a,t)}return Ir(e)},Ir=({dimension:e,orientation:t,paddingRatio:a,paddingOuter:n})=>{const{dimensionAxis:r}=tr(t);let i=Te("band",r,t);i=ye(i,[e]);const{paddingInner:o,paddingOuter:s}=Qn(a,n);return Object.assign(Object.assign({},i),{paddingInner:o,paddingOuter:s})};function Ar(e,t,a){if(!e||0===e.length)return`'${a}'`;const n=e.slice().sort(((e,t)=>(void 0!==e.thresholdMin?e.thresholdMin:-1e12)-(void 0!==t.thresholdMin?t.thresholdMin:-1e12))),r=[];r.push(`(datum.${t} < ${void 0!==n[0].thresholdMin?n[0].thresholdMin:-1e12}) ? '${a}' : `);for(let e=0;e<n.length-1;e++){const a=void 0!==n[e+1].thresholdMin?n[e+1].thresholdMin:-1e12;r.push(`(datum.${t} < ${a}) ? '${n[e].fill}' : `)}return r.push(`'${n[n.length-1].fill}'`),r.join("")}const Dr=U(((e,t)=>{var a,n,r,i,o,s,l;const c="column"===t.direction?"y":"x",u="column"===t.direction?"width":"bulletGroupWidth",d={name:"bulletGroup",type:"group",from:{facet:{data:"table",name:"bulletGroups",groupby:`${t.dimension}`}},encode:{update:{[c]:{scale:"groupScale",field:`${t.dimension}`},height:{signal:"bulletGroupHeight"},width:{signal:u}}},marks:[]},m=t.thresholds;Array.isArray(m)&&m.length>0?(d.data=[{name:"thresholds",values:m,transform:[{type:"identifier",as:"id"}]}],null===(a=d.marks)||void 0===a||a.push(function(e){const t="bulletGroupHeight - 3 - bulletThresholdHeight",a=e.showTarget&&e.showTargetValue?`${t} - targetValueLabelHeight`:t;return{name:`${e.name}Threshold`,description:`${e.name}Threshold`,type:"rect",from:{data:"thresholds"},clip:!0,encode:{enter:{cornerRadiusTopLeft:[{test:"!isDefined(datum.thresholdMin) && domain('xscale')[0] !== 0",value:3}],cornerRadiusBottomLeft:[{test:"!isDefined(datum.thresholdMin) && domain('xscale')[0] !== 0",value:3}],cornerRadiusTopRight:[{test:"!isDefined(datum.thresholdMax) && domain('xscale')[1] !== 0",value:3}],cornerRadiusBottomRight:[{test:"!isDefined(datum.thresholdMax) && domain('xscale')[1] !== 0",value:3}],fill:{field:"fill"},fillOpacity:{value:.2}},update:{x:{signal:"isDefined(datum.thresholdMin) ? scale('xscale', datum.thresholdMin) : 0"},x2:{signal:"isDefined(datum.thresholdMax) ? scale('xscale', datum.thresholdMax) : width"},height:{signal:"bulletThresholdHeight"},y:{signal:a}}}}}(t))):t.track&&(null===(n=d.marks)||void 0===n||n.push(function(e){const t=(0,W.getColorValue)("gray-200",e.colorScheme),a="column"===e.direction?"width":"bulletGroupWidth",n=e.showTarget&&e.showTargetValue?"bulletGroupHeight - 3 - 2 * bulletHeight - 20":"bulletGroupHeight - 3 - 2 * bulletHeight";return{name:`${e.name}Track`,description:`${e.name}Track`,type:"rect",from:{data:"bulletGroups"},encode:{enter:{fill:{value:t},cornerRadiusTopRight:[{test:"domain('xscale')[1] !== 0",value:3}],cornerRadiusBottomRight:[{test:"domain('xscale')[1] !== 0",value:3}],cornerRadiusTopLeft:[{test:"domain('xscale')[0] !== 0",value:3}],cornerRadiusBottomLeft:[{test:"domain('xscale')[0] !== 0",value:3}]},update:{x:{value:0},width:{signal:a},height:{signal:"bulletHeight"},y:{signal:n}}}}}(t))),null===(r=d.marks)||void 0===r||r.push(function(e){var t,a;const n=e.showTarget&&e.showTargetValue?"bulletGroupHeight - targetValueLabelHeight - 3 - 2 * bulletHeight":"bulletGroupHeight - 3 - 2 * bulletHeight",r=e.thresholdBarColor&&(null!==(a=null===(t=e.thresholds)||void 0===t?void 0:t.length)&&void 0!==a?a:0)>0?[{field:"barColor"}]:[{value:e.color}];return{name:`${e.name}Rect`,description:`${e.name}Rect`,type:"rect",from:{data:"bulletGroups"},encode:{enter:{cornerRadiusTopLeft:[{test:`datum.${e.metric} < 0`,value:3}],cornerRadiusBottomLeft:[{test:`datum.${e.metric} < 0`,value:3}],cornerRadiusTopRight:[{test:`datum.${e.metric} > 0`,value:3}],cornerRadiusBottomRight:[{test:`datum.${e.metric} > 0`,value:3}],fill:r},update:{x:{scale:"xscale",value:0},x2:{scale:"xscale",field:`${e.metric}`},height:{signal:"bulletHeight"},y:{signal:n}}}}}(t)),t.target&&!1!==t.showTarget&&(null===(i=d.marks)||void 0===i||i.push(function(e){const t=(0,W.getColorValue)("gray-900",e.colorScheme),a=e.showTarget&&e.showTargetValue?"bulletGroupHeight - targetValueLabelHeight - targetHeight":"bulletGroupHeight - targetHeight",n=e.showTarget&&e.showTargetValue?"bulletGroupHeight - targetValueLabelHeight":"bulletGroupHeight";return{name:`${e.name}Target`,description:`${e.name}Target`,type:"rule",from:{data:"bulletGroups"},encode:{enter:{stroke:{value:`${t}`},strokeWidth:{value:2}},update:{x:{scale:"xscale",field:`${e.target}`},y:{signal:a},y2:{signal:n}}}}}(t)),t.showTargetValue&&(null===(o=d.marks)||void 0===o||o.push(function(e){const t=(0,W.getColorValue)("gray-900",e.colorScheme);return{name:`${e.name}TargetValueLabel`,description:`${e.name}TargetValueLabel`,type:"text",from:{data:"bulletGroups"},encode:{enter:{text:{signal:`datum.${e.target} != null ? 'Target: ' + format(datum.${e.target}, '$,.2f') : 'No Target'`},align:{value:"center"},baseline:{value:"top"},fill:{value:`${t}`}},update:{x:{scale:"xscale",field:`${e.target}`},y:{signal:"bulletGroupHeight - targetValueLabelHeight + 6"}}}}}(t)))),"top"!==t.labelPosition&&"row"!==t.direction||(null===(s=d.marks)||void 0===s||s.push(function(e){const t=(0,W.getColorValue)("gray-600",e.colorScheme);return{name:`${e.name}Label`,description:`${e.name}Label`,type:"text",from:{data:"bulletGroups"},encode:{enter:{text:{signal:`datum.${e.dimension}`},align:{value:"left"},baseline:{value:"top"},fill:{value:`${t}`}},update:{x:{value:0},y:{value:0}}}}}(t)),null===(l=d.marks)||void 0===l||l.push(function(e){var t,a;const n=(0,W.getColorValue)(e.color,e.colorScheme),r=(0,W.getColorValue)("gray-900",e.colorScheme),i="column"===e.direction?"width":"bulletGroupWidth",o=e.thresholdBarColor&&(null!==(a=null===(t=e.thresholds)||void 0===t?void 0:t.length)&&void 0!==a?a:0)>0?`datum.barColor === '${n}' ? '${r}' : datum.barColor`:`'${r}'`;return{name:`${e.name}ValueLabel`,description:`${e.name}ValueLabel`,type:"text",from:{data:"bulletGroups"},encode:{enter:{text:{signal:`datum.${e.metric} != null ? format(datum.${e.metric}, '${e.numberFormat||""}') : ''`},align:{value:"right"},baseline:{value:"top"},fill:{signal:o}},update:{x:{signal:i},y:{value:0}}}}}(t))),e.push(d)})),Rr=U(((e,t)=>{if(t.metricAxis&&"column"===t.direction&&!t.showTargetValue&&e.push({labelOffset:2,scale:"xscale",orient:"bottom",ticks:!1,labelColor:"gray",domain:!1,tickCount:5,offset:{signal:"axisOffset"}}),"side"===t.labelPosition&&"column"===t.direction){const a=t.showTargetValue&&t.showTarget?-8:2;e.push(function(e){return{scale:"groupScale",orient:"left",tickSize:0,labelOffset:e,labelPadding:10,labelColor:"#797979",domain:!1}}(a)),e.push(function(e,t){return{scale:"groupScale",orient:"right",tickSize:0,labelOffset:t,labelPadding:10,domain:!1,encode:{labels:{update:{text:{signal:`info(data('table')[datum.index * (length(data('table')) - 1)].${e.metric}) != null ? format(info(data('table')[datum.index * (length(data('table')) - 1)].${e.metric}), '${e.numberFormat||""}') : ''`}}}}}}(t,a))}}));const Mr=W.spectrumColors.light["static-blue"],Cr=U(((e,t)=>{var a,n,r,i,o,{colorScheme:s=V.DEFAULT_COLOR_SCHEME,index:l=0,name:c,metric:u,dimension:d,target:m,color:p=Mr,direction:h=V.DEFAULT_BULLET_DIRECTION,numberFormat:g,showTarget:f=!0,showTargetValue:y=!1,labelPosition:v=V.DEFAULT_LABEL_POSITION,scaleType:b=V.DEFAULT_SCALE_TYPE,maxScaleValue:E=V.DEFAULT_SCALE_VALUE,thresholds:S=[],track:_=!1,thresholdBarColor:T=!1,metricAxis:O=!1}=t,$=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]])}return a}(t,["colorScheme","index","name","metric","dimension","target","color","direction","numberFormat","showTarget","showTargetValue","labelPosition","scaleType","maxScaleValue","thresholds","track","thresholdBarColor","metricAxis"]);const x=Object.assign({colorScheme:s,index:l,color:(0,W.getColorValue)(p,s),metric:null!=u?u:"currentAmount",dimension:null!=d?d:"graphLabel",target:null!=m?m:"target",name:(0,J.toCamelCase)(null!=c?c:`bullet${l}`),direction:h,numberFormat:null!=g?g:"",showTarget:f,showTargetValue:y,labelPosition:v,scaleType:b,maxScaleValue:E,track:_,thresholds:S,thresholdBarColor:T,metricAxis:O},$);e.data=Pr(null!==(a=e.data)&&void 0!==a?a:[],x),e.marks=Dr(null!==(n=e.marks)&&void 0!==n?n:[],x),e.scales=Nr(null!==(r=e.scales)&&void 0!==r?r:[],x),e.signals=jr(null!==(i=e.signals)&&void 0!==i?i:[],x),e.axes=Rr(null!==(o=e.axes)&&void 0!==o?o:[],x)})),Nr=U(((e,t)=>{const a="column"===t.direction?"bulletChartHeight":"width",n="column"===t.direction?"width":[0,{signal:"bulletGroupWidth"}];let r;r="flexible"===t.scaleType&&t.maxScaleValue>0?{data:"table",fields:["xPaddingForTarget",t.metric,"flexibleScaleValue"]}:"fixed"===t.scaleType&&t.maxScaleValue>0?[0,`${t.maxScaleValue}`]:{data:"table",fields:["xPaddingForTarget",t.metric]},e.push({name:"groupScale",type:"band",domain:{data:"table",field:t.dimension},range:[0,{signal:a}],paddingInner:{signal:"paddingRatio"}},{name:"xscale",type:"linear",domain:r,range:n,round:!0,clamp:!0,zero:!0})})),jr=U(((e,t)=>{e.push({name:"gap",value:12}),e.push({name:"bulletHeight",value:8}),e.push({name:"bulletThresholdHeight",update:"bulletHeight * 3"}),e.push({name:"targetHeight",update:"bulletThresholdHeight + 6"}),t.showTargetValue&&t.showTarget&&e.push({name:"targetValueLabelHeight",update:"20"}),e.push({name:"bulletGroupHeight",update:kr(t)}),"column"===t.direction?(e.push({name:"paddingRatio",update:"gap / (gap + bulletGroupHeight)"}),t.metricAxis&&!t.showTargetValue?(e.push({name:"bulletChartHeight",update:"length(data('table')) * bulletGroupHeight + (length(data('table')) - 1) * gap + 10"}),e.push({name:"axisOffset",update:"bulletChartHeight - height - 10"})):e.push({name:"bulletChartHeight",update:"length(data('table')) * bulletGroupHeight + (length(data('table')) - 1) * gap"})):(e.push({name:"bulletGroupWidth",update:"(width / length(data('table'))) - gap"}),e.push({name:"paddingRatio",update:"gap / (gap + bulletGroupWidth)"}),e.push({name:"bulletChartHeight",update:"bulletGroupHeight"}))}));function kr(e){return e.showTargetValue&&e.showTarget?"side"===e.labelPosition&&"column"===e.direction?"bulletThresholdHeight + targetValueLabelHeight + 10":"bulletThresholdHeight + targetValueLabelHeight + 24":"side"===e.labelPosition&&"column"===e.direction?"bulletThresholdHeight + 10":"bulletThresholdHeight + 24"}const Pr=U(((e,t)=>{const a=(e=>{let t=X(e);return t||(t={name:V.TABLE,values:[],transform:[]},e.push(t)),t})(e);a.transform=(e=>{var t,a,n;const r=[{type:"formula",expr:`isValid(datum.${e.target}) ? round(datum.${e.target} * 1.05) : 0`,as:"xPaddingForTarget"}];return"flexible"===e.scaleType&&r.push({type:"formula",expr:`${e.maxScaleValue}`,as:"flexibleScaleValue"}),e.thresholdBarColor&&(null!==(a=null===(t=e.thresholds)||void 0===t?void 0:t.length)&&void 0!==a?a:0)>0&&r.push({type:"formula",expr:Ar(null!==(n=e.thresholds)&&void 0!==n?n:[],e.metric,e.color),as:"barColor"}),r})(t)}));const Hr=e=>e.metricRanges.map(((t,a)=>wr(t,e.name,a))),wr=(e,t,a)=>{var{chartTooltips:n=[],lineType:r="dashed",lineWidth:i="S",rangeOpacity:o=.2,metric:s=V.DEFAULT_METRIC,displayOnHover:l=!1}=e,c=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]])}return a}(e,["chartTooltips","lineType","lineWidth","rangeOpacity","metric","displayOnHover"]);return Object.assign({chartTooltips:n,lineType:r,lineWidth:i,name:`${t}MetricRange${a}`,rangeOpacity:o,metric:s,displayOnHover:l},c)},Fr=(e,t)=>{const a={name:`${t.name}_area`,color:e.color,colorScheme:e.colorScheme,opacity:t.rangeOpacity,metricStart:t.metricStart,metricEnd:t.metricEnd,isStacked:!1,scaleType:"time",dimension:e.dimension,isMetricRange:!0,parentName:e.name,displayOnHover:t.displayOnHover},n=Object.assign(Object.assign({},e),{name:`${t.name}_line`,color:t.color?{value:t.color}:e.color,metric:t.metric,lineType:{value:t.lineType},lineWidth:{value:t.lineWidth},displayOnHover:t.displayOnHover}),r=`${t.name}_facet`;return[mn(n,r),ut(a,r)]},Gr=(e,t)=>{if(e.length)return t};const zr=U(((e,t)=>{var a,n,r,i,{chartPopovers:o=[],chartTooltips:s=[],color:l={value:"categorical-100"},colorScheme:c=V.DEFAULT_COLOR_SCHEME,dimension:u=V.DEFAULT_TIME_DIMENSION,hasOnClick:d=!1,index:m=0,lineType:p={value:"solid"},metric:h=V.DEFAULT_METRIC,metricAxis:g,metricRanges:f=[],name:y,opacity:v={value:1},scaleType:b="time",trendlines:E=[]}=t,S=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]])}return a}(t,["chartPopovers","chartTooltips","color","colorScheme","dimension","hasOnClick","index","lineType","metric","metricAxis","metricRanges","name","opacity","scaleType","trendlines"]);const _=(0,J.toCamelCase)(y||`line${m}`),T=Object.assign({chartPopovers:o,chartTooltips:s,color:l,colorScheme:c,dimension:u,hasOnClick:d,index:m,interactiveMarkName:Xe({chartPopovers:o,chartTooltips:s,hasOnClick:d,highlightedItem:S.highlightedItem,metricRanges:f,trendlines:E},_),lineType:p,metric:h,metricAxis:g,metricRanges:f,name:_,opacity:v,popoverMarkName:Gr(o,_),scaleType:b,trendlines:E},S);return T.isHighlightedByGroup=at(T),e.data=Br(null!==(a=e.data)&&void 0!==a?a:[],T),e.signals=Ur(null!==(n=e.signals)&&void 0!==n?n:[],T),e.scales=Vr(null!==(r=e.scales)&&void 0!==r?r:[],T),e.marks=Wr(null!==(i=e.marks)&&void 0!==i?i:[],T),e})),Br=U(((e,t)=>{var a;const{chartTooltips:n,dimension:r,highlightedItem:i,isSparkline:o,isMethodLast:s,name:l,scaleType:c,staticPoint:u}=t;if("time"===c){const t=X(e);t.transform=Y(null!==(a=t.transform)&&void 0!==a?a:[],r)}(Me(t)||void 0!==i)&&(e.push(((e,t,a,n,r)=>{const i=r?`${V.HIGHLIGHTED_GROUP} === datum.${e}_highlightGroupId`:`isArray(${V.HIGHLIGHTED_ITEM}) && indexof(${V.HIGHLIGHTED_ITEM}, datum.${t}) > -1 || ${V.HIGHLIGHTED_ITEM} === datum.${t}`;return{name:`${e}_highlightedData`,source:a,transform:[{type:"filter",expr:n?`${V.SELECTED_ITEM} && ${V.SELECTED_ITEM} === datum.${t} || !${V.SELECTED_ITEM} && ${i}`:i}]}})(l,t.idKey,V.FILTERED_TABLE,Ce(t),at(t))),e.push(Q(n))),(u||o)&&e.push(((e,t,a,n,r)=>({name:`${e}_staticPointData`,source:a,transform:[{type:"filter",expr:n&&r?"datum === data('table')[data('table').length - 1]":`datum.${t} === true`}]}))(l,u,V.FILTERED_TABLE,o,s)),za(e,t),Qe(e,t,!1),va(e,t),e.push(...(e=>{const t=[],a=Hr(e);for(const e of a){const{displayOnHover:a,name:n}=e;a&&t.push({name:`${n}_highlightedData`,source:V.FILTERED_TABLE,transform:[{type:"filter",expr:`isValid(${V.HIGHLIGHTED_SERIES}) && ${V.HIGHLIGHTED_SERIES} === datum.${V.SERIES_ID} || isValid(${V.SELECTED_SERIES}) && ${V.SELECTED_SERIES} === datum.${V.SERIES_ID}`}]})}return t})(t))})),Ur=U(((e,t)=>{const{idKey:a,name:n}=t;Fn(e,t),e.push(...(e=>{const t=[],{name:a}=e;return Hr(e).length&&ct(t,`${a}_voronoi`,2),t})(t)),Me(t)&&(lt(e,`${n}_voronoi`,a,2),ct(e,`${n}_voronoi`,2),Yr(e,t),nt(e,t))})),Vr=U(((e,t)=>{const{metricAxis:a,dimension:n,color:r,lineType:i,opacity:o,padding:s,scaleType:l}=t;return ve(e,{scaleType:l,dimension:n,padding:s}),Se(e,V.COLOR_SCALE,r),Se(e,V.LINE_TYPE_SCALE,i),Se(e,V.OPACITY_SCALE,o),Ee(e,Jr(t)),a&&Ee(e,Jr(t),"y",a),e.push(...wn(t)),e})),Wr=U(((e,t)=>{const{color:a,highlightedItem:n,isSparkline:r,lineType:i,name:o,opacity:s,staticPoint:l}=t,{facets:c}=te({color:a,lineType:i,opacity:s});e.push({name:`${o}_group`,type:"group",from:{facet:{name:`${o}_facet`,data:V.FILTERED_TABLE,groupby:c}},marks:[mn(t,`${o}_facet`)]}),(l||r)&&e.push((({name:e,metric:t,metricAxis:a,color:n,colorScheme:r,scaleType:i,dimension:o,isSparkline:s,pointSize:l=125})=>({name:`${e}_staticPoints`,description:`${e}_staticPoints`,type:"symbol",from:{data:`${e}_staticPointData`},interactive:!1,encode:{enter:{size:{value:l},fill:s?{signal:V.BACKGROUND_COLOR}:je(n,r),stroke:s?je(n,r):{signal:V.BACKGROUND_COLOR},y:Ge(a,t)},update:{x:Fe(i,o)}}}))(t)),e.push(...(e=>{const{color:t,lineType:a}=e,{facets:n}=te({color:t,lineType:a}),r=[],i=Hr(e);for(const t of i){const{displayOnHover:a,name:i}=t,o=a?`${i}_highlightedData`:V.FILTERED_TABLE;r.push({name:`${i}_group`,type:"group",clip:!0,from:{facet:{name:`${i}_facet`,data:o,groupby:n}},marks:Fr(e,t)})}return r})(t)),(Me(t)||void 0!==n)&&e.push(...hn(t,`${V.FILTERED_TABLE}ForTooltip`)),e.push(...Ln(t))})),Jr=e=>{const t=[e.metric];return Hr(e).forEach((e=>{e.scaleAxisToFit&&t.push(e.metricStart,e.metricEnd)})),t},Yr=(e,t)=>{const{idKey:a,interactionMode:n,name:r}=t;n===V.INTERACTION_MODE.ITEM&&Je(r).forEach((t=>{lt(e,t,a,1),ct(e,t,1)}))},Kr=U(((e,{colorScheme:t=V.DEFAULT_COLOR_SCHEME,highlightedItem:a,idKey:n,index:r=0,name:i,marks:o=[],dimension:s=V.DEFAULT_TIME_DIMENSION})=>{let{barCount:l,lineCount:c}=Xr();const u=(0,J.toCamelCase)(i||`combo${r}`);return[...o].reduce(((e,r)=>"bar"===r.markType?(l++,gr(e,Object.assign(Object.assign({},r),{colorScheme:t,highlightedItem:a,idKey:n,index:l,name:qr(r,u,l),dimension:Qr(r,s)}))):(c++,zr(e,Object.assign(Object.assign({},r),{colorScheme:t,highlightedItem:a,idKey:n,index:c,name:qr(r,u,c),dimension:Qr(r,s)})))),e)})),Xr=()=>({barCount:-1,lineCount:-1}),qr=(e,t,a)=>{if(e.name)return e.name;const n=Zr(e.markType);return(0,J.combineNames)(t,`${n}${a}`)},Zr=e=>e?e.charAt(0).toUpperCase()+e.slice(1):"",Qr=(e,t)=>{var a;return null!==(a=e.dimension)&&void 0!==a?a:t};const ei=e=>{if(e.donutSummaries.length)return ti(e.donutSummaries[0],e)},ti=(e,t)=>{var{numberFormat:a="shortNumber"}=e,n=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]])}return a}(e,["numberFormat"]);return Object.assign({donutOptions:t,numberFormat:a},n)},ai=e=>{const{donutOptions:t,label:a}=e;return{update:{x:{signal:"width / 2"},y:{signal:"height / 2"},text:ni(e),fontSize:[{test:`${V.DONUT_RADIUS} * ${t.holeRatio} < ${V.DONUT_SUMMARY_MIN_RADIUS}`,value:0},{signal:`${t.name}_summaryFontSize`}],align:{value:"center"},baseline:ri(a),limit:ii(e)}}},ni=({donutOptions:e,numberFormat:t})=>e.isBoolean?{signal:`format(datum['${e.metric}'], '.0%')`}:[...It(t,"sum"),{field:"sum"}],ri=e=>e?{value:"alphabetic"}:{value:"middle"},ii=({donutOptions:e,label:t})=>{const{holeRatio:a,name:n}=e,r=t?`${n}_summaryFontSize`:`${n}_summaryFontSize * 0.5`;return{signal:`2 * sqrt(pow(${V.DONUT_RADIUS} * ${a}, 2) - pow(${r}, 2))`}},oi=({donutOptions:e,label:t})=>({update:{x:{signal:"width / 2"},y:{signal:"height / 2"},dy:{signal:`ceil(${e.name}_summaryFontSize * 0.25)`},text:{value:t},fontSize:[{test:`${V.DONUT_RADIUS} * ${e.holeRatio} < ${V.DONUT_SUMMARY_MIN_RADIUS}`,value:0},{signal:`ceil(${e.name}_summaryFontSize * 0.5)`}],align:{value:"center"},baseline:{value:"top"},limit:{signal:`2 * sqrt(pow(${V.DONUT_RADIUS} * ${e.holeRatio}, 2) - pow(${e.name}_summaryFontSize * 0.75, 2))`}}});const si=(e,t)=>{var{percent:a=!1,value:n=!1,valueFormat:r="standardNumber"}=e,i=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]])}return a}(e,["percent","value","valueFormat"]);return Object.assign({donutOptions:t,percent:a,value:n,valueFormat:r},i)},li=({labelKey:e,value:t,percent:a,donutOptions:n})=>{const{name:r,color:i}=n;return{type:"text",name:`${r}_segmentLabel`,from:{data:V.FILTERED_TABLE},encode:{enter:Object.assign(Object.assign({},ui(r)),{text:{field:null!=e?e:i},fontWeight:{value:"bold"},dy:t||a?{signal:`datum['${r}_arcTheta'] <= 0.5 * PI || datum['${r}_arcTheta'] >= 1.5 * PI ? -16 : 0`}:void 0}),update:di}}},ci=e=>{if(!e.value&&!e.percent)return[];const{donutOptions:t}=e;return[{type:"text",name:`${t.name}_segmentLabelValue`,from:{data:V.FILTERED_TABLE},encode:{enter:Object.assign(Object.assign({},ui(t.name)),{text:mi(e),dy:{signal:`datum['${t.name}_arcTheta'] <= 0.5 * PI || datum['${t.name}_arcTheta'] >= 1.5 * PI ? 0 : 16`}}),update:di}}]},ui=e=>({radius:{signal:`${V.DONUT_RADIUS} + 6`},theta:{field:`${e}_arcTheta`},fontSize:pi(e),align:{signal:`datum['${e}_arcTheta'] <= PI ? 'left' : 'right'`},baseline:{signal:`datum['${e}_arcTheta'] <= 0.5 * PI || datum['${e}_arcTheta'] >= 1.5 * PI ? 'bottom' : 'top'`}}),di={x:{signal:"width / 2"},y:{signal:"height / 2"}},mi=({donutOptions:e,percent:t,value:a,valueFormat:n})=>{const r=`format(datum['${e.name}_arcPercent'], '.0%')`;if(a){const a=It(n,e.metric);return t?a.map((e=>Object.assign(Object.assign({},e),{signal:`${r} + "\\u00a0\\u00a0" + ${e.signal}`}))):a}if(t)return{signal:r}},pi=e=>[{test:`datum['${e}_arcLength'] < ${V.DONUT_SEGMENT_LABEL_MIN_ANGLE}`,value:0},{value:14}];const hi=U(((e,t)=>{var a,n,r,i,{chartPopovers:o=[],chartTooltips:s=[],color:l=V.DEFAULT_COLOR,colorScheme:c=V.DEFAULT_COLOR_SCHEME,donutSummaries:u=[],index:d=0,metric:m=V.DEFAULT_METRIC,name:p,startAngle:h=0,holeRatio:g=.85,isBoolean:f=!1,segmentLabels:y=[]}=t,v=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]])}return a}(t,["chartPopovers","chartTooltips","color","colorScheme","donutSummaries","index","metric","name","startAngle","holeRatio","isBoolean","segmentLabels"]);const b=Object.assign({chartPopovers:o,chartTooltips:s,color:l,colorScheme:c,donutSummaries:u,holeRatio:g,index:d,isBoolean:f,metric:m,name:(0,J.toCamelCase)(null!=p?p:`donut${d}`),segmentLabels:y,startAngle:h},v);e.data=gi(null!==(a=e.data)&&void 0!==a?a:[],b),e.scales=yi(null!==(n=e.scales)&&void 0!==n?n:[],b),e.marks=vi(null!==(r=e.marks)&&void 0!==r?r:[],b),e.signals=bi(null!==(i=e.signals)&&void 0!==i?i:[],b)})),gi=U(((e,t)=>{var a,n;const{name:r,isBoolean:i}=t,o=e.findIndex((e=>e.name===V.FILTERED_TABLE));var s;e[o].transform=null!==(a=e[o].transform)&&void 0!==a?a:[],null===(n=e[o].transform)||void 0===n||n.push(...fi(t)),i&&e.push({name:`${r}_booleanData`,source:V.FILTERED_TABLE,transform:[{type:"window",ops:["row_number"],as:[`${r}_rscRowIndex`]},{type:"filter",expr:`datum.${r}_rscRowIndex === 1`}]}),e.push(...(s=t,!ei(s)||s.isBoolean?[]:[{name:`${s.name}_summaryData`,source:V.FILTERED_TABLE,transform:[{type:"aggregate",fields:[s.metric],ops:["sum"],as:["sum"]}]}]))})),fi=({startAngle:e,metric:t,name:a})=>[{type:"pie",field:t,startAngle:e,endAngle:{signal:`${e} + 2 * PI`},as:[`${a}_startAngle`,`${a}_endAngle`]},{type:"formula",as:`${a}_arcTheta`,expr:`(datum['${a}_startAngle'] + datum['${a}_endAngle']) / 2`},{type:"formula",as:`${a}_arcLength`,expr:`datum['${a}_endAngle'] - datum['${a}_startAngle']`},{type:"formula",as:`${a}_arcPercent`,expr:`datum['${a}_arcLength'] / (2 * PI)`}],yi=U(((e,t)=>{const{color:a}=t;var n;Se(e,V.COLOR_SCALE,a),e.push(...(n=t,ei(n)?[{name:`${n.name}_summaryFontSizeScale`,type:"threshold",domain:[32,36,40,45,50,60],range:[28,32,36,40,45,50,60]}]:[]))})),vi=U(((e,t)=>{e.push((e=>{const{chartPopovers:t,chartTooltips:a,color:n,colorScheme:r,holeRatio:i,idKey:o,name:s}=e;return{type:"arc",name:s,description:s,from:{data:V.FILTERED_TABLE},encode:{enter:{fill:je(n,r),x:{signal:"width / 2"},y:{signal:"height / 2"},tooltip:De(a,s),stroke:{value:(0,W.getColorValue)("static-blue",r)}},update:{startAngle:{field:`${s}_startAngle`},endAngle:{field:`${s}_endAngle`},padAngle:{value:.01},innerRadius:{signal:`${i} * ${V.DONUT_RADIUS}`},outerRadius:{signal:V.DONUT_RADIUS},opacity:Ke(e),cursor:Ae(t),strokeWidth:[{test:`${V.SELECTED_ITEM} === datum.${o}`,value:2},{value:0}]}}}})(t)),e.push(...(e=>{const t=ei(e);if(!t)return[];const a=[];return e.isBoolean?a.push((e=>{var t;const{donutOptions:a,label:n}=e,r={type:"group",name:`${a.name}_percentText`,marks:[{type:"text",name:`${a.name}_booleanSummaryValue`,from:{data:`${a.name}_booleanData`},encode:ai(e)}]};return n&&(null===(t=r.marks)||void 0===t||t.push({type:"text",name:`${a.name}_booleanSummaryLabel`,from:{data:`${a.name}_booleanData`},encode:oi(Object.assign(Object.assign({},e),{label:n}))})),r})(t)):a.push((e=>{var t;const{donutOptions:a,label:n}=e,r={type:"group",name:`${a.name}_summaryGroup`,marks:[{type:"text",name:`${a.name}_summaryValue`,from:{data:`${a.name}_summaryData`},encode:ai(e)}]};return n&&(null===(t=r.marks)||void 0===t||t.push({type:"text",name:`${a.name}_summaryLabel`,from:{data:`${a.name}_summaryData`},encode:oi(Object.assign(Object.assign({},e),{label:n}))})),r})(t)),a})(t)),e.push(...(e=>{const{isBoolean:t,name:a}=e;if(t)return[];const n=(e=>{if(e.segmentLabels.length)return si(e.segmentLabels[0],e)})(e);return n?[{name:`${a}_segmentLabelGroup`,type:"group",marks:[li(n),...ci(n)]}]:[]})(t))})),bi=U(((e,t)=>{var a;const{chartTooltips:n,idKey:r,name:i}=t;e.push(...(e=>{if(!ei(e))return[];const{name:t,holeRatio:a}=e;return[{name:`${t}_summaryFontSize`,update:`scale('${t}_summaryFontSizeScale', ${V.DONUT_RADIUS} * ${a} * ${V.DONUT_SUMMARY_FONT_SIZE_RATIO})`}]})(t)),Me(t)&&lt(e,i,r,1,null===(a=n[0])||void 0===a?void 0:a.excludeDataKeys)})),Ei=(e,t,a)=>{e.length&&Ti(e).filter(_i).forEach((e=>{e.encode||(e.encode={update:{}}),e.encode.update||(e.encode.update={});const{update:n}=e.encode,{opacity:r}=n;if(void 0!==r){const e=Si(t,a);Array.isArray(n.opacity)||(n.opacity=[]);const r=Math.max(n.opacity.length-1,0);n.opacity.splice(r,0,e)}}))},Si=(e,t)=>{let a=`isValid(${V.HIGHLIGHTED_SERIES}) && ${V.HIGHLIGHTED_SERIES} !== datum.${V.SERIES_ID}`;return(null==e?void 0:e.length)&&(a=`isValid(${V.HIGHLIGHTED_GROUP}) && ${V.HIGHLIGHTED_GROUP} !== datum.${t}_highlightGroupId`),{test:a,value:1/V.HIGHLIGHT_CONTRAST_RATIO}},_i=e=>{var t;const a=null===(t=e.encode)||void 0===t?void 0:t.enter;if(!a)return!1;const{fill:n,stroke:r}=a;return!(!n||!("scale"in n)||n.scale!==V.COLOR_SCALE)||!!(n&&"signal"in n&&n.signal.includes("scale('colors',"))||!(!r||!("scale"in r)||r.scale!==V.COLOR_SCALE)},Ti=e=>{let t=e;for(const a of e)Oi(a)&&a.marks&&(t=[...t,...Ti(a.marks)]);return t},Oi=e=>"group"===e.type,$i=[V.COLOR_SCALE,V.LINE_TYPE_SCALE,V.LINEAR_COLOR_SCALE,V.OPACITY_SCALE,"secondaryColor","secondaryLineType","secondaryOpacity","secondarySymbolShape",V.SYMBOL_SHAPE_SCALE,V.SYMBOL_SIZE_SCALE],xi=e=>Boolean("domain"in e&&e.domain&&"fields"in e.domain),Li=(e,t)=>{if(!["left","right"].includes(e))return void 0!==t&&t>0?{signal:`max(1, floor(width / ${t+(V.DEFAULT_LEGEND_SYMBOL_WIDTH+V.DEFAULT_LEGEND_COLUMN_PADDING)}))`}:{signal:"floor(width / 220)"}},Ii=(e,t)=>e.length?[{type:"filter",expr:`indexof(${JSON.stringify(e)}, datum.${t}Entries) === -1`}]:[],Ai=(e,t)=>{const a=Ni(e,t),n=Ri(t),r=Di(t.name,t.legendLabels),i=Pi(t),o=Hi(t);return wi([a,r,n,i,o])},Di=(e,t)=>t?{labels:{update:{text:[{test:`indexof(pluck(${e}_labels, 'seriesName'), datum.value) > -1`,signal:`${e}_labels[indexof(pluck(${e}_labels, 'seriesName'), datum.value)].label`},{signal:"datum.value"}]}}}:{},Ri=e=>{const{highlight:t,highlightedSeries:a,name:n,hasMouseInteraction:r,descriptions:i,chartPopovers:o}=e;return t||a||i||(null==o?void 0:o.length)?{entries:{name:`${n}_legendEntry`,interactive:!0,enter:{tooltip:Mi(i,n)},update:{fill:{value:"transparent"}}},labels:{update:{opacity:Ci(e)}},symbols:{update:{opacity:Ci(e)}}}:r?{entries:{name:`${n}_legendEntry`,interactive:!0,enter:{fill:{value:"transparent"}}}}:{}},Mi=(e,t)=>{if(null==e?void 0:e.length)return{signal:`merge(datum, {'${V.COMPONENT_NAME}': '${t}'})`}},Ci=({highlight:e,highlightedSeries:t,keys:a,chartPopovers:n})=>{const r=(null==a?void 0:a.length)?V.HIGHLIGHTED_GROUP:V.HIGHLIGHTED_SERIES,i=(null==a?void 0:a.length)?V.SELECTED_GROUP:V.SELECTED_SERIES;if(e||t||(null==n?void 0:n.length))return[{test:`isValid(${r}) && datum.value !== ${r}`,value:1/V.HIGHLIGHT_CONTRAST_RATIO},{test:`isValid(${i}) && datum.value !== ${i}`,value:1/V.HIGHLIGHT_CONTRAST_RATIO},V.DEFAULT_OPACITY_RULE]},Ni=(e,t)=>{var a,n;const{color:r,lineType:i,lineWidth:o,name:s,opacity:l,symbolShape:c,colorScheme:u}=t,d={fillOpacity:ji({facets:e,facetType:V.OPACITY_SCALE,customValue:l,name:s}),shape:ji({facets:e,facetType:V.SYMBOL_SHAPE_SCALE,customValue:c,name:s}),size:ji({facets:e,facetType:V.SYMBOL_SIZE_SCALE,name:s}),strokeDash:ji({facets:e,facetType:V.LINE_TYPE_SCALE,customValue:i,name:s}),strokeWidth:ji({facets:e,facetType:V.LINE_WIDTH_SCALE,customValue:o,name:s})},m={fill:[...ki(t,"gray-300"),null!==(a=ji({facets:e,facetType:V.COLOR_SCALE,customValue:r,name:s}))&&void 0!==a?a:{value:W.spectrumColors[u]["categorical-100"]}],stroke:[...ki(t,"gray-300"),null!==(n=ji({facets:e,facetType:V.COLOR_SCALE,customValue:r,name:s}))&&void 0!==n?n:{value:W.spectrumColors[u]["categorical-100"]}]};return{entries:{name:`${s}_legendEntry`},symbols:JSON.parse(JSON.stringify({enter:d,update:m}))}},ji=({customValue:e,facets:t,facetType:a,name:n})=>{if(e)return"string"==typeof e?{signal:`scale('${a}', data('${n}Aggregate')[datum.index].${e})`}:{value:e.value};if(!t)return;const r={color:{scale:"secondaryColor",signal:"colors"},linearColor:{scale:"secondaryColor",signal:"colors"},lineType:{scale:"secondaryLineType",signal:"lineTypes"},lineWidth:{scale:"secondaryLineWidth",signal:"lineWidths"},opacity:{scale:"secondaryOpacity",signal:"opacities"},symbolShape:{scale:"secondarySymbolShape",signal:"symbolShapes"},symbolSize:{scale:"secondarySymbolSize",signal:"symbolSizes"},symbolPathWidth:{scale:"secondarySymbolPathWidth",signal:"symbolPathWidths"}},i=t.find((e=>e.facetType===a));if(!i)return;const o=t.find((e=>e.facetType===r[a].scale));if(o){const{scale:e,signal:t}=r[a];return{signal:`scale('${t}', data('${n}Aggregate')[datum.index].${i.field})[indexof(domain('${e}'), data('${n}Aggregate')[datum.index].${o.field})% length(scale('${t}', data('${n}Aggregate')[datum.index].${i.field}))]`}}return{signal:`scale('${a}', data('${n}Aggregate')[datum.index].${i.field})`}},ki=({colorScheme:e,hiddenSeries:t,isToggleable:a,keys:n,name:r},i)=>a||t.length?(null==n?void 0:n.length)?[{test:`indexof(pluck(data('${V.FILTERED_TABLE}'), '${r}_highlightGroupId'), datum.value) === -1`,value:(0,W.getColorValue)(i,e)}]:[{test:"indexof(hiddenSeries, datum.value) !== -1",value:(0,W.getColorValue)(i,e)}]:[],Pi=e=>{const{colorScheme:t}=e;return{labels:{update:{fill:[...ki(e,"gray-500"),{value:(0,W.getColorValue)("gray-700",t)}]}}}},Hi=e=>{const{isToggleable:t,keys:a,name:n,hasOnClick:r,chartPopovers:i}=e;let o={};return(t&&!a||r||(null==i?void 0:i.length))&&(o={entries:{name:`${n}_legendEntry`,interactive:!0,enter:{fill:{value:"transparent"},cursor:{value:"pointer"}}}}),o},wi=e=>{let t={};for(const a of e)t=Ot()(t,a);return t},Fi=e=>e&&"object"==typeof e&&"value"in e?ie(e.value):"circle";const Gi=U(((e,t)=>{var a,n,r,i,o,s,{color:l,hasMouseInteraction:c=!1,hasOnClick:u=!1,hiddenEntries:d=[],hiddenSeries:m=[],highlight:p=!1,highlightedSeries:h,index:g=0,isToggleable:f=!1,lineType:y,lineWidth:v,position:b="bottom",symbolShape:E,title:S,colorScheme:_=V.DEFAULT_COLOR_SCHEME}=t,T=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]])}return a}(t,["color","hasMouseInteraction","hasOnClick","hiddenEntries","hiddenSeries","highlight","highlightedSeries","index","isToggleable","lineType","lineWidth","position","symbolShape","title","colorScheme"]);const{formattedColor:O,formattedLineType:$,formattedLineWidth:x,formattedSymbolShape:L}=zi(l,y,v,E,_),I=`legend${g}`,A=Object.assign({color:O,hasMouseInteraction:c,hasOnClick:u,hiddenEntries:d,hiddenSeries:m,highlight:p,highlightedSeries:h,index:g,isToggleable:f,lineType:$,lineWidth:x,name:I,position:b,symbolShape:L,title:S,colorScheme:_},T);e.scales=Wi(null!==(a=e.scales)&&void 0!==a?a:[],A);const{ordinalFacets:D,continuousFacets:R}=T.keys?((e,t)=>{const a=[],n=[];return t.forEach((t=>{var r,i;xi(t)&&((e,t)=>e.domain.fields.some((e=>t.includes(e.toString()))))(t,e)&&("ordinal"===t.type||"point"===t.type?a.push({facetType:t.name,field:null===(r=t.domain.fields.find((t=>e.includes(t.toString()))))||void 0===r?void 0:r.toString()}):n.push({facetType:t.name,field:null===(i=t.domain.fields.find((t=>e.includes(t.toString()))))||void 0===i?void 0:i.toString()}))})),{ordinalFacets:a,continuousFacets:n}})(T.keys,null!==(n=e.scales)&&void 0!==n?n:[]):(e=>{const t=[],a=[];return e.forEach((e=>{$i.includes(e.name)&&xi(e)&&e.domain.fields.length&&("ordinal"===e.type||"point"===e.type?t.push({facetType:e.name,field:e.domain.fields[0].toString()}):a.push({facetType:e.name,field:e.domain.fields[0].toString()}))})),{ordinalFacets:t,continuousFacets:a}})(null!==(r=e.scales)&&void 0!==r?r:[]),M=[];if(D.length){e.scales.push({name:`${I}Entries`,type:"ordinal",domain:{data:`${I}Aggregate`,field:`${I}Entries`}});const t=[...new Set(D.map((e=>e.field)))];e.data=Yi(null!==(i=e.data)&&void 0!==i?i:[],Object.assign(Object.assign({},A),{facets:t})),e.signals=Ki(null!==(o=e.signals)&&void 0!==o?o:[],A),e.marks=Ji(null!==(s=e.marks)&&void 0!==s?s:[],A),M.push(Bi(D,A))}R.forEach((e=>{M.push(Ui(e,A))})),void 0===e.legends&&(e.legends=[]),e.legends.push(...M)})),zi=(e,t,a,n,r)=>{let i,o,s,l;return i=e&&"object"==typeof e?{value:(0,W.getColorValue)(e.value,r)}:e,o=t&&"object"==typeof t?{value:ne(t.value)}:t,s=a&&"object"==typeof a?{value:re(a.value)}:a,l=n&&"object"==typeof n?{value:ie(n.value)}:n,{formattedColor:i,formattedLineType:o,formattedLineWidth:s,formattedSymbolShape:l}},Bi=(e,t)=>{const{name:a,position:n,title:r,labelLimit:i,titleLimit:o}=t,s={fill:`${a}Entries`,direction:["top","bottom"].includes(n)?"horizontal":"vertical",orient:n,title:r,encode:Ai(e,t),columns:Li(n,i),labelLimit:i};return void 0!==o&&(s.titleLimit=o),s},Ui=(e,t)=>{const{symbolShape:a}=t;return e.facetType===V.SYMBOL_SIZE_SCALE?Object.assign(Object.assign({size:V.SYMBOL_SIZE_SCALE},Vi(t)),{symbolType:Fi(a)}):Object.assign({fill:V.LINEAR_COLOR_SCALE,gradientThickness:10},Vi(t))},Vi=({position:e,title:t,titleLimit:a})=>{const n={direction:["top","bottom"].includes(e)?"horizontal":"vertical",orient:e,title:t};return void 0!==a&&(n.titleLimit=a),n},Wi=U(((e,{color:t,lineType:a,opacity:n,symbolShape:r})=>{Se(e,V.COLOR_SCALE,t),Se(e,V.LINE_TYPE_SCALE,a),Se(e,V.OPACITY_SCALE,n),Se(e,V.SYMBOL_SHAPE_SCALE,r)})),Ji=U(((e,{highlight:t,keys:a,name:n})=>{t&&Ei(e,a,n)})),Yi=U(((e,{facets:t,hiddenEntries:a,keys:n,name:r})=>{const i=t.map((e=>`datum.${e}`)).join(' + " | " + ');if(e.push({name:`${r}Aggregate`,source:"table",transform:[{type:"aggregate",groupby:t},{type:"formula",as:`${r}Entries`,expr:i},...Ii(a,r)]}),null==n?void 0:n.length){const t=X(e);t.transform||(t.transform=[]),t.transform.push({type:"formula",as:`${r}_highlightGroupId`,expr:n.map((e=>`datum.${e}`)).join(' + " | " + ')})}})),Ki=U(((e,{hiddenSeries:t,highlight:a,isToggleable:n,keys:r,legendLabels:i,name:o})=>{a&&((e,t,a,n)=>{const r=(null==n?void 0:n.length)?V.HIGHLIGHTED_GROUP:V.HIGHLIGHTED_SERIES,i=e.find((e=>e.name===r));i&&(void 0===i.on&&(i.on=[]),i.on.push({events:`@${t}_legendEntry:mouseover`,update:ot(t,a,n)},{events:`@${t}_legendEntry:mouseout`,update:"null"}))})(e,o,Boolean(n||t),r),i&&e.push(st(`${o}_labels`,i))}));const Xi=e=>e.scatterPaths.map(((t,a)=>((e,t,a)=>{var{color:n="gray-500",groupBy:r,pathWidth:i={value:"M"},opacity:o=.5}=e,s=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]])}return a}(e,["color","groupBy","pathWidth","opacity"]),l=a.color,c=a.colorScheme,u=a.dimension,d=a.dimensionScaleType,m=a.lineType,p=a.metric,h=a.name,g=a.opacity,f=a.size;const{facets:y}=te({color:l,lineType:m,size:f,opacity:g});return Object.assign({color:n,colorScheme:c,dimension:u,dimensionScaleType:d,groupBy:null!=r?r:y,metric:p,index:t,pathWidth:i,name:`${h}Path${t}`,opacity:o},s)})(t,a,e))),qi=({color:e,colorScheme:t,dimension:a,dimensionScaleType:n,pathWidth:r,metric:i,name:o,opacity:s})=>({name:o,type:"trail",from:{data:`${o}_facet`},encode:{enter:{fill:{value:(0,W.getColorValue)(e,t)},fillOpacity:{value:s},size:Qi(r)},update:{opacity:Zi(),x:Fe(n,a),y:{scale:"yLinear",field:i}}}}),Zi=()=>{const e=1/V.HIGHLIGHT_CONTRAST_RATIO;return[{test:`isValid(${V.HIGHLIGHTED_SERIES}) || isValid(${V.HIGHLIGHTED_ITEM}) || isValid(${V.SELECTED_SERIES}) || isValid(${V.SELECTED_ITEM})`,value:e},V.DEFAULT_OPACITY_RULE]},Qi=e=>"string"==typeof e?{scale:V.SYMBOL_PATH_WIDTH_SCALE,field:e}:{value:re(e.value)},eo=U(((e,t)=>{const{name:a}=t,n={name:`${a}_group`,type:"group",marks:[to(t),...no(t),...ro(t)]};e.push(...(e=>{const t=[];return Xi(e).forEach((e=>{const{groupBy:a,name:n}=e;t.push({name:`${n}_group`,type:"group",from:{facet:{name:`${n}_facet`,data:V.FILTERED_TABLE,groupby:a}},marks:[qi(e)]})})),t})(t)),e.push(n),e.push(...Ln(t))})),to=e=>{const{color:t,colorScaleType:a,colorScheme:n,dimension:r,dimensionScaleType:i,lineType:o,lineWidth:s,metric:l,name:c,opacity:u,size:d}=e;return{name:c,description:c,type:"symbol",from:{data:V.FILTERED_TABLE},encode:{enter:{blend:{value:"light"===n?"multiply":"screen"},fill:je(t,n,a),fillOpacity:Pe(u),shape:{value:"circle"},size:He(d),strokeDash:we(o),strokeWidth:ke(s),stroke:je(t,n,a)},update:{opacity:ao(e),x:Fe(i,r),y:{scale:"yLinear",field:l}}}}},ao=e=>{const{highlightedItem:t,idKey:a}=e;if(!Me(e)&&void 0===t)return[V.DEFAULT_OPACITY_RULE];const n=1/V.HIGHLIGHT_CONTRAST_RATIO,r=[];return it(r,e),Ce(e)&&r.push({test:`isValid(${V.SELECTED_ITEM}) && ${V.SELECTED_ITEM} !== datum.${a}`,value:n}),[...r,V.DEFAULT_OPACITY_RULE]},no=e=>{const{dimension:t,dimensionScaleType:a,highlightedItem:n,metric:r,name:i}=e;return Me(e)||void 0!==n?[ze(`${V.FILTERED_TABLE}ForTooltip`,t,r,i,a),Be(e,`${i}_pointsForVoronoi`)]:[]},ro=e=>{const{dimension:t,dimensionScaleType:a,metric:n,name:r,size:i}=e;return Ce(e)?[{name:`${r}_selectRing`,type:"symbol",from:{data:`${r}_selectedData`},encode:{enter:{fill:{value:"transparent"},shape:{value:"circle"},size:io(i),strokeWidth:{value:2},stroke:{value:W.spectrumColors.light["static-blue"]}},update:{x:Fe(a,t),y:{scale:"yLinear",field:n}}}}]:[]},io=e=>{const t=He(e);return"value"in t&&"number"==typeof t.value?{value:Math.pow(Math.sqrt(t.value)+4,2)}:"scale"in t&&"field"in t?{signal:`pow(sqrt(scale('${t.scale}', datum.${t.field})) + 4, 2)`}:t};const oo=U(((e,t)=>{var a,n,r,i,{chartPopovers:o=[],chartTooltips:s=[],color:l={value:"categorical-100"},colorScaleType:c="ordinal",colorScheme:u=V.DEFAULT_COLOR_SCHEME,dimension:d=V.DEFAULT_LINEAR_DIMENSION,dimensionScaleType:m=V.DEFAULT_DIMENSION_SCALE_TYPE,index:p=0,lineType:h={value:"solid"},lineWidth:g={value:0},metric:f=V.DEFAULT_METRIC,name:y,opacity:v={value:1},scatterPaths:b=[],size:E={value:"M"},trendlines:S=[]}=t,_=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]])}return a}(t,["chartPopovers","chartTooltips","color","colorScaleType","colorScheme","dimension","dimensionScaleType","index","lineType","lineWidth","metric","name","opacity","scatterPaths","size","trendlines"]);const T=(0,J.toCamelCase)(y||`scatter${p}`),O=Object.assign({chartPopovers:o,chartTooltips:s,color:l,colorScaleType:c,colorScheme:u,dimension:d,dimensionScaleType:m,index:p,interactiveMarkName:Xe({chartPopovers:o,chartTooltips:s,highlightedItem:_.highlightedItem,trendlines:S},T),lineType:h,lineWidth:g,metric:f,name:T,opacity:v,scatterPaths:b,size:E,trendlines:S},_);e.data=so(null!==(a=e.data)&&void 0!==a?a:[],O),e.signals=lo(null!==(n=e.signals)&&void 0!==n?n:[],O),e.scales=co(null!==(r=e.scales)&&void 0!==r?r:[],O),e.marks=eo(null!==(i=e.marks)&&void 0!==i?i:[],O)})),so=U(((e,t)=>{var a;const{chartTooltips:n,dimension:r,dimensionScaleType:i,highlightedItem:o,idKey:s,name:l}=t;if("time"===i){const t=X(e);t.transform=Y(null!==(a=t.transform)&&void 0!==a?a:[],r)}(Me(t)||void 0!==o)&&e.push(Q(n)),Ce(t)&&e.push({name:`${l}_selectedData`,source:V.FILTERED_TABLE,transform:[{type:"filter",expr:`${V.SELECTED_ITEM} === datum.${s}`}]}),Qe(e,t),za(e,t)})),lo=U(((e,t)=>{const{idKey:a,name:n}=t;Fn(e,t),Me(t)&&(lt(e,`${n}_voronoi`,a,2),nt(e,t))})),co=U(((e,t)=>{const{color:a,colorScaleType:n,dimension:r,dimensionScaleType:i,lineType:o,lineWidth:s,metric:l,opacity:c,size:u}=t;ve(e,{scaleType:i,dimension:r}),Ee(e,[l]),Se(e,"linear"===n?V.LINEAR_COLOR_SCALE:V.COLOR_SCALE,a),Se(e,V.LINE_TYPE_SCALE,o),Se(e,V.LINE_WIDTH_SCALE,s),Se(e,V.OPACITY_SCALE,c),Se(e,V.SYMBOL_SIZE_SCALE,u),((e,t)=>{Xi(t).forEach((t=>{Se(e,V.SYMBOL_PATH_WIDTH_SCALE,t.pathWidth)}))})(e,t),e.push(...wn(t))})),uo=U(((e,{text:t,fontWeight:a=V.DEFAULT_TITLE_FONT_WEIGHT,position:n="middle",orient:r="top"})=>(e.title={text:t,fontWeight:a,anchor:n,frame:"group",orient:r},e)));var mo=i(561);function po(e){var t,a=function(e){for(var t=[],a=0;a<e.length;++a)for(var n=a+1;n<e.length;++n){let o=e[a],s=e[n];if(o&&s)for(var r=yo(o,s),i=0;i<r.length;++i){let e=r[i];e&&t.push({...e,parentIndex:[a,n]})}}return t}(e),n=a.filter((function(t){return function(e,t){for(var a=0;a<t.length;++a){let n=t[a];if(void 0!==n&&go(e,n)>n.radius+1e-10)return!1}return!0}(t,e)})),r=0,i=0,o=[];if(n.length>1){var s=vo(n),l=(n=n.map((e=>({...e,angle:Math.atan2(e.x-s.x,e.y-s.y)}))).sort(((e,t)=>t.angle-e.angle)))[n.length-1];for(t=0;t<n.length;++t){var c=n[t];i+=(l.x+c.x)*(c.y-l.y);for(var u={x:(c.x+l.x)/2,y:(c.y+l.y)/2},d=null,m=0;m<c.parentIndex.length;++m)if(l.parentIndex.indexOf(c.parentIndex[m])>-1){var p=e[c.parentIndex[m]],h=Math.atan2(c.x-p.x,c.y-p.y),g=Math.atan2(l.x-p.x,l.y-p.y),f=g-h;f<0&&(f+=2*Math.PI);var y=g-f/2,v=go(u,{x:p.x+p.radius*Math.sin(y),y:p.y+p.radius*Math.cos(y)});v>2*p.radius&&(v=2*p.radius),(null===d||d.width>v)&&(d={circle:p,width:v,p1:c,p2:l})}null!==d&&(o.push(d),r+=ho(d.circle.radius,d.width),l=c)}}else{var b=e[0];for(t=1;t<e.length;++t){let a=e[t];(null==b||a.radius<b.radius)&&(b=a)}var E=!1;for(t=0;t<e.length;++t){let a=e[t];if(void 0!==a&&go(a,b)>Math.abs(b.radius-a.radius)){E=!0;break}}E?r=i=0:(r=b.radius*b.radius*Math.PI,o.push({circle:b,p1:{x:b.x,y:b.y+b.radius},p2:{x:b.x-1e-10,y:b.y+b.radius},width:2*b.radius}))}return{overlap:r+(i/=2),stats:{area:r+i,arcArea:r,polygonArea:i,arcs:o,innerPoints:n,intersectionPoints:a}}}function ho(e,t){return e*e*Math.acos(1-t/e)-(e-t)*Math.sqrt(t*(2*e-t))}function go(e,t){return Math.sqrt((e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y))}function fo(e,t,a){if(a>=e+t)return 0;if(a<=Math.abs(e-t))return Math.PI*Math.min(e,t)*Math.min(e,t);var n=t-(a*a-e*e+t*t)/(2*a);return ho(e,e-(a*a-t*t+e*e)/(2*a))+ho(t,n)}function yo(e,t){var a=go(e,t),n=e.radius,r=t.radius;if(a>=n+r||a<=Math.abs(n-r))return[];var i=(n*n-r*r+a*a)/(2*a),o=Math.sqrt(n*n-i*i),s=e.x+i*(t.x-e.x)/a,l=e.y+i*(t.y-e.y)/a,c=-(t.y-e.y)*(o/a),u=-(t.x-e.x)*(o/a);return[{x:s+c,y:l-u},{x:s-c,y:l+u}]}function vo(e){let t=e.reduce(((e,t)=>({x:e.x+t.x,y:e.y+t.y})),{x:0,y:0});return t.x/=e.length,t.y/=e.length,t}var bo=new Map([["greedy",Oo],["MDS",To],["best",function(e,t){var a=Oo(e),n=$o;if(e.length>=8){var r=To(e,t);n(r,e)+1e-8<n(a,e)&&(a=r)}return a}]]),Eo=1e-10;function So(e,t,a){return Math.min(e,t)*Math.min(e,t)*Math.PI<=a+Eo?Math.abs(e-t):(0,mo.bisect)((function(n){return fo(e,t,n)-a}),0,e+t)}function _o(e,t,a,n){var r,i=0;for(r=0;r<t.length;++r)t[r]=0;for(r=0;r<a.length;++r)for(var o=e[2*r],s=e[2*r+1],l=r+1;l<a.length;++l){var c=e[2*l],u=e[2*l+1],d=a[r][l],m=n[r][l],p=(c-o)*(c-o)+(u-s)*(u-s),h=Math.sqrt(p),g=p-d*d;m>0&&h<=d||m<0&&h>=d||(i+=2*g*g,t[2*r]+=4*g*(o-c),t[2*r+1]+=4*g*(s-u),t[2*l]+=4*g*(c-o),t[2*l+1]+=4*g*(u-s))}return i}function To(e,t){var a,n=t.restarts||10,r=[],i={};for(a=0;a<e.length;++a){var o=e[a];1===o?.sets.length&&(o.sets[0]&&(i[o.sets[0]]=r.length),r.push(o))}var s=function(e,t,a){var n=(0,mo.zerosM)(t.length,t.length),r=(0,mo.zerosM)(t.length,t.length);return e.filter((function(e){return 2===e.sets.length})).map((function(e){var i=a[e.sets[0]],o=a[e.sets[1]];if(void 0===i||void 0===o)return e;var s=So(Math.sqrt(t[i].size/Math.PI),Math.sqrt(t[o].size/Math.PI),e.size);n[i][o]=n[o][i]=s;var l=0;e.size+1e-10>=Math.min(t[i].size,t[o].size)?l=1:e.size<=1e-10&&(l=-1),r[i][o]=r[o][i]=l})),{distances:n,constraints:r}}(e,r,i),l=s.distances,c=s.constraints,u=(0,mo.norm2)(l.map(mo.norm2))/l.length;l=l.map((function(e){return e.map((function(e){return e/u}))}));let d=function(e=1){return()=>{e=e+1831565813|0;let t=Math.imul(e^e>>>15,1|e);return t=Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}((t.seed??Math.random())*2**32>>>0);var m,p;for(a=0;a<n;++a){var h=(0,mo.zeros)(2*l.length).map((()=>d()));p=(0,mo.conjugateGradient)(((e,t)=>_o(e,t,l,c)),h,t),(!m||p.fx<m.fx)&&(m=p)}var g=m?.x,f={};for(a=0;a<r.length;++a){var y=r[a];let e=y?.sets[0];void 0===y||void 0===e||(f[e]={x:g[2*a]*u,y:g[2*a+1]*u,radius:Math.sqrt(y.size/Math.PI),setid:e,size:y.size,rowid:Object.keys(f).length})}if(t.history)for(let e of t.history)(0,mo.scale)(e.x,u);return f}function Oo(e,t){for(var a,n=$o,r={},i={},o=0;o<e.length;++o){var s=e[o];1==s.sets.length&&(a=s.sets[0],r[a]={x:1e10,y:1e10,rowid:Object.keys(r).length,size:s.size,setid:a,radius:Math.sqrt(s.size/Math.PI)},i[a]=[])}for(e=e.filter((function(e){return 2==e.sets.length})),o=0;o<e.length;++o){var l=e[o],c=l.weight?l.weight:1,u=l.sets[0],d=l.sets[1];if(void 0===u||void 0===d)continue;let t=r[u],a=r[d];!t.size||!a.size||(l.size+Eo>=Math.min(t.size,a.size)&&(c=0),i[u]?.push({set:d,size:l.size,weight:c}),i[d]?.push({set:u,size:l.size,weight:c}))}var m=[];for(a in i){let e=i[a];if(e){var p=0;for(o=0;o<e.length;++o){let t=e[o];t&&(p+=t.size*t.weight)}m.push({set:a,size:p})}}m.sort(((e,t)=>t.size-e.size));var h={};function g(e){return e.set in h}function f(e,t){let a=r[t];a&&(a.x=e.x,a.y=e.y),h[t]=!0}for(f({x:0,y:0},m[0]?.set??""),o=1;o<m.length;++o){var y=m[o]?.set,v=y?i[y]?.filter(g):null;let t=y?r[y]:null;if(v?.sort(((e,t)=>t.size-e.size)),0===v?.length||!v)throw"ERROR: missing pairwise overlap information";for(var b=[],E=0;E<v.length;++E){let e=v[E];if(!e)continue;var S=r[v[E].set];if(!S)continue;let a=So(t.radius,S.radius,e.size);b.push({x:S.x+a,y:S.y}),b.push({x:S.x-a,y:S.y}),b.push({y:S.y+a,x:S.x}),b.push({y:S.y-a,x:S.x});for(var _=E+1;_<v.length;++_)for(var T=r[v[_].set],O=So(t.radius,T.radius,v[_].size),$=yo({x:S.x,y:S.y,radius:a},{x:T.x,y:T.y,radius:O}),x=0;x<$.length;++x)b.push($[x])}var L=1e50,I=b[0];for(E=0;E<b.length;++E){r[y].x=b[E].x,r[y].y=b[E].y;var A=n(r,e);A<L&&(L=A,I=b[E])}f(I,y)}return r}function $o(e,t){for(var a,n=0,r=0;r<t.length;++r){var i,o=t[r];if(o&&1!==o.sets.length){if(2===o.sets.length){var s=e[o.sets[0]],l=e[o.sets[1]];if(void 0===s||void 0===l)continue;i=fo(s.radius,l.radius,go(s,l))}else i=po((a=o.sets,a.map((function(t){return e[t]})))).overlap;n+=(o.weight?o.weight:1)*(i-o.size)*(i-o.size)}}return n}function xo(e,t,a){var n;if(null===a?e.sort((function(e,t){return t.radius-e.radius})):e.sort(a),e.length>0){var r=e[0].x,i=e[0].y;for(n=0;n<e.length;++n)e[n].x-=r,e[n].y-=i}if(2==e.length){let t=e[0],a=e[1];t&&a&&go(t,a)<Math.abs(a.radius-t.radius)&&(a.x=t.x+t.radius-a.radius-1e-10,a.y=a.y)}if(e.length>1){var o,s,l=Math.atan2(e[1].x,e[1].y)-(t??0),c=Math.cos(l),u=Math.sin(l);for(n=0;n<e.length;++n){let t=e[n];t&&(o=t.x,s=t.y,t.x=c*o-u*s,t.y=u*o+c*s)}}if(e.length>2){for(var d=Math.atan2(e[2].x,e[2].y)-(t??0);d<0;)d+=2*Math.PI;for(;d>2*Math.PI;)d-=2*Math.PI;if(d>Math.PI){var m=e[1].y/(1e-10+e[1].x);for(n=0;n<e.length;++n){let t=e[n];if(t){var p=(t.x+m*t.y)/(1+m*m);t.x=2*p-t.x,t.y=2*p*m-t.y}}}}}function Lo(e){var t=function(t){return{max:Math.max.apply(null,e.map((function(e){return e[t]+e.radius}))),min:Math.min.apply(null,e.map((function(e){return e[t]-e.radius})))}};return{xRange:t("x"),yRange:t("y")}}function Io(e,{layout:t,height:a,width:n,padding:r,seed:i,orientation:o,set_id_delimiter:s,orientationOrder:l}){let c=e.filter((e=>0!==e.size&&e.sets.length>0));if(0===c.length)return{circles:[],intersections:[]};let u=function(e,t){(t=t??{}).maxIterations=t.maxIterations||500,t.seed=t.seed??Math.random();let a=bo.get(t.layout??"best");var n=$o;e=function(e){e=e.slice();var t,a,n,r,i=[],o={};for(let t of e)1==t.sets.length?i.push(t.sets[0]):2==t.sets.length&&(o[`${n=t.sets[0]},${r=t.sets[1]}`]=!0,o[`${r},${n}`]=!0);for(i.sort(((e,t)=>e.toString().localeCompare(t.toString()))),t=0;t<i.length;++t)for(n=i[t],a=t+1;a<i.length;++a)`${n},${r=i[a]}`in o||e.push({sets:[n,r],size:0});return e}(e);var r=a(e,t),i=[],o=[];for(let e of Object.keys(r)){let t=r[e];t&&(i.push(t.x),i.push(t.y),o.push(e))}for(var s=(0,mo.nelderMead)((function(t){for(var a={},i=0;i<o.length;++i){var s=o[i];let e=r[s];a[s]={x:t[2*i],y:t[2*i+1],radius:e.radius,setid:s,size:e.size,rowid:e.rowid}}return n(a,e)}),i,t).x,l=0;l<o.length;++l){let e=o[l],t=r[e];t.x=s[2*l],t.y=s[2*l+1]}return r}(c,{layout:t,seed:i});o!==Math.PI/2&&(u=function(e,t,a){null===t&&(t=Math.PI/2);var n,r,i=[];for(r in e){var o=e[r];o&&i.push({...o,setid:r})}var s=function(e){function t(e){if(e)return e.parent!==e&&(e.parent=t(e.parent)),e.parent}function a(e,a){var n=t(e),r=t(a);n&&(n.parent=r)}e.map((function(e){e.parent=e}));for(var n=0;n<e.length;++n)for(var r=n+1;r<e.length;++r){let t=e[n],o=e[r];if(t&&o){var i=t.radius+o.radius;go(t,o)+1e-10<i&&a(o,t)}}var o,s={};for(n=0;n<e.length;++n){let a=e[n];if(!a)continue;let r=t(e[n])?.parent?.setid;r&&(r in s||(s[r]=[]),s[r]&&s[r].push(a))}e.map((function(e){delete e.parent}));var l=[];for(o in s){let e=s[o];e&&l.push(e)}return l}(i);for(n=0;n<s.length;++n){let e=s[n];if(e){xo(e,t,a);var l=Lo(e);e.size=(l.xRange.max-l.xRange.min)*(l.yRange.max-l.yRange.min),e.bounds=l}}s.sort((function(e,t){return e.size&&t.size?t.size-e.size:0}));var c=s[0].bounds,u=(c.xRange.max-c.xRange.min)/50;function d(e,t,a){if(e&&e.size&&e.bounds){var n,r,o,s=e.bounds;t?n=c.xRange.max-s.xRange.min+u:(n=c.xRange.max-s.xRange.max,(o=(s.xRange.max-s.xRange.min)/2-(c.xRange.max-c.xRange.min)/2)<0&&(n+=o)),a?r=c.yRange.max-s.yRange.min+u:(r=c.yRange.max-s.yRange.max,(o=(s.yRange.max-s.yRange.min)/2-(c.yRange.max-c.yRange.min)/2)<0&&(r+=o));for(var l=0;l<e.length;++l){let t=e[l];t&&(t.x+=n,t.y+=r,i.push(t))}}}for(var m=1;m<s.length;)d(s[m],!0,!1),d(s[m+1],!1,!0),d(s[m+2],!0,!0),m+=3,c=Lo(i);var p={};for(let e of i)p[e.setid]=e;return p}(u,o,l)),u=function(e,t,a,n){var r=[],i=[];for(var o in e){let t=e[o];t&&(i.push(o),r.push(t))}t-=2*n,a-=2*n;var s=Lo(r),l=s.xRange,c=s.yRange;if(l.max==l.min||c.max==c.min)return e;for(var u=t/(l.max-l.min),d=a/(c.max-c.min),m=Math.min(d,u),p=(t-(l.max-l.min)*m)/2,h=(a-(c.max-c.min)*m)/2,g={},f=0;f<r.length;++f){var y=r[f];let e=i[f];!y||!e||(g[e]={...y,radius:m*y.radius,x:n+p+(y.x-l.min)*m,y:n+h+(y.y-c.min)*m})}return g}(u,n,a,r);let d=function(e,t,a=","){for(var n={},r=function(e){var t={},a=Object.keys(e);a.forEach((e=>t[e]=[]));for(var n=0;n<a.length;n++)for(var r=e[a[n]],i=n+1;i<a.length;++i){var o=e[a[i]],s=go(r,o);s+o.radius<=r.radius+1e-10?t[a[i]].push(a[n]):s+r.radius<=o.radius+1e-10&&t[a[n]].push(a[i])}return t}(e),i=0;i<t.length;++i){for(var o=t[i].sets,s={},l={},c=0;c<o.length;++c){s[o[c]]=!0;var u=r[o[c]];if(u)for(var d=0;d<u.length;++d)l[u[d]]=!0}var m=[],p=[];for(var h in e)h in s?m.push(e[h]):h in l||p.push(e[h]);var g=Do(m,p);n[o.join(a)]=g,g.disjoint&&t[i].size>0&&console.log("WARNING: area "+o+" not represented on screen")}return n}(u,c),m=c.map((e=>{let t=e.sets.join(","),{x:a,y:n,disjoint:r}=d[t];return{set_id:e.sets.join(s),sets:e.sets,path:Ao(e.sets.map((e=>u[e]))),textX:r?void 0:a,textY:r?void 0:n,size:e.size}})).filter((e=>e.sets.length>1));return{circles:Object.entries(u).map((([e,t])=>({set_id:e,x:t.x,y:t.y,size:Math.pow(2*t.radius,2),textX:d[e].x,textY:d[e].y}))),intersections:m}}function Ao(e){let{stats:t}=po(e);var a=t.arcs;if(0===a.length)return"M 0 0";if(1===a.length){var n=a[0].circle;return function(e,t,a){var n=[];return n.push("\nM",e.toString(),t.toString()),n.push("\nm",-a,0),n.push("\na",a,a,0,1,0,2*a,0),n.push("\na",a,a,0,1,0,2*-a,0),n.join(" ")}(n.x,n.y,n.radius)}var r=["\nM",a[0].p2.x,a[0].p2.y];for(let e of a){let t=e.circle.radius,a=e.width>t;r.push("\nA",t,t,0,a?1:0,1,e.p1.x,e.p1.y)}return r.join(" ")}function Do(e,t){var a,n=[];for(a=0;a<e.length;++a){var r=e[a];r&&(n.push({x:r.x,y:r.y}),n.push({x:r.x+r.radius/2,y:r.y}),n.push({x:r.x-r.radius/2,y:r.y}),n.push({x:r.x,y:r.y+r.radius/2}),n.push({x:r.x,y:r.y-r.radius/2}))}var i=n[0],o=Ro(n[0],e,t);for(a=1;a<n.length;++a){var s=Ro(n[a],e,t);s>=o&&(i=n[a],o=s)}var l=(0,mo.nelderMead)((function(a){return-1*Ro({x:a[0],y:a[1]},e,t)}),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,c={x:l[0],y:l[1]},u=!0;for(a=0;a<e.length;++a)if(go(c,e[a])>e[a].radius){u=!1;break}for(a=0;a<t.length;++a)if(go(c,t[a])<t[a].radius){u=!1;break}if(!u)if(1==e.length)c={x:e[0].x,y:e[0].y};else{let{stats:a}=po(e);c=0===a.arcs.length?{x:0,y:-1e3,disjoint:!0}:1===a.arcs.length?{x:a.arcs[0].circle.x,y:a.arcs[0].circle.y}:t.length?Do(e,[]):vo(a.arcs.map((function(e){return e.p1})))}return c}function Ro(e,t,a){var n,r,i=t[0].radius-go(t[0],e);for(n=1;n<t.length;++n)(r=t[n].radius-go(t[n],e))<=i&&(i=r);for(n=0;n<a.length;++n)(r=go(a[n],e)-a[n].radius)<=i&&(i=r);return i}const Mo=(e,t)=>{const{label:a}=e;return{type:"text",from:{data:t},interactive:!1,encode:{enter:{x:{field:"textX"},y:{field:"textY"},text:{field:`table_data.${a}`},align:{value:"center"},baseline:{value:"middle"}},update:{opacity:Ke(e)}}}},Co=new Map([["0deg",Math.PI/2],["90deg",0],["180deg",-3*Math.PI/2],["270deg",-Math.PI]]);const No=U(((e,t)=>{var a,n,r,i,{chartPopovers:o=[],chartTooltips:s=[],color:l=V.DEFAULT_VENN_COLOR,colorScheme:c=V.DEFAULT_COLOR_SCHEME,index:u=0,label:d=V.DEFAULT_VENN_LABEL,metric:m=V.DEFAULT_VENN_METRIC,name:p,orientation:h="0deg",chartHeight:g=100,chartWidth:f=100,data:y=[]}=t,v=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]])}return a}(t,["chartPopovers","chartTooltips","color","colorScheme","index","label","metric","name","orientation","chartHeight","chartWidth","data"]);const b=Object.assign({chartPopovers:o,chartTooltips:s,chartWidth:f,chartHeight:g,data:y,index:u,colorScheme:c,color:l,label:d,orientation:h,metric:m,name:(0,J.toCamelCase)(null!=p?p:`venn${u}`)},v);e.data=jo(null!==(a=e.data)&&void 0!==a?a:[],b),e.signals=Go(null!==(n=e.signals)&&void 0!==n?n:[],b),e.scales=Po(null!==(r=e.scales)&&void 0!==r?r:[]),e.marks=ko(null!==(i=e.marks)&&void 0!==i?i:[],b)})),jo=U(((e,t)=>{var a,n;const{circles:r,intersections:i}=(e=>{const{orientation:t,chartWidth:a,chartHeight:n}=e;return Io((e=>{const{data:t,metric:a,color:n}=e;return t.map((e=>{const t=Object.assign({},e);if(void 0===t[a])throw new Error("set the metric prop to the default 'size' or set your own");if(a!==V.DEFAULT_VENN_METRIC&&"number"==typeof t[a]&&(t.size=e[a]),void 0===t[n])throw new Error("set the color prop to the default 'sets' or set your own");return n!==V.DEFAULT_VENN_COLOR&&Array.isArray(t[n])&&(t.sets=structuredClone(e[n])),{size:t.size,sets:t.sets}})).filter((e=>e.sets.length>0))})(e),{orientation:Co.get(t),layout:"greedy",width:a,height:n,set_id_delimiter:"∩",padding:0})})(t);e.push({name:"circles",values:r,transform:[...wo(),{type:"formula",as:"strokeSize",expr:"datum.size * 1"},{type:"filter",expr:"indexof(hiddenSeries, datum.table_data.rscSeriesId) === -1"}]}),e.push({name:"intersections",values:i,transform:[...wo(),...Fo()]});const o=e.findIndex((e=>e.name===V.TABLE));e[o].transform=null!==(a=e[o].transform)&&void 0!==a?a:[],null===(n=e[o].transform)||void 0===n||n.push(...Ho(t))})),ko=U(((e,t)=>{e.push((e=>{const{colorScheme:t,idKey:a}=e;return{type:"symbol",name:`${e.name}_circle_strokes`,from:{data:"circles"},interactive:!1,encode:{enter:{x:{field:"x"},y:{field:"y"},size:{field:"size"},shape:{value:"circle"},stroke:{value:(0,W.getColorValue)("static-blue",t)},strokeWidth:{value:6}},update:{strokeOpacity:[{test:`${V.SELECTED_ITEM} === datum.${a}`,value:1},{value:0}]}}}})(t)),e.push((e=>{const{name:t,colorScheme:a,chartTooltips:n,chartPopovers:r}=e;return{type:"symbol",name:t,from:{data:"circles"},encode:{enter:{x:{field:"x"},y:{field:"y"},tooltip:De(n,t),size:{field:"size"},shape:{value:"circle"},fill:je("set_id",a),stroke:{signal:"chartBackgroundColor"},strokeWidth:{value:2}},update:{opacity:Ke(e),cursor:Ae(r)}}}})(t)),e.push((e=>{const{name:t,idKey:a,colorScheme:n}=e;return{type:"path",from:{data:"intersections"},name:`${t}_intersections_strokes`,interactive:!1,encode:{enter:{path:{field:"path"},strokeWidth:{value:6},strokeCap:{value:"round"},stroke:{value:(0,W.getColorValue)("static-blue",n)}},update:{strokeOpacity:[{test:`${V.SELECTED_ITEM} === datum.${a}`,value:1},{value:0}]}}}})(t)),e.push((e=>{const{name:t,chartTooltips:a,colorScheme:n,chartPopovers:r}=e;return{type:"path",from:{data:"intersections"},name:`${t}_intersections`,encode:{enter:{path:{field:"path"},fill:je("set_id",n),strokeWidth:{value:2},stroke:{signal:"chartBackgroundColor"},strokeCap:{value:"square"},tooltip:De(a,`${t}`)},update:{opacity:Ke(e),cursor:Ae(r)}}}})(t)),e.push(Mo(t,"circles"),Mo(t,"intersections"))})),Po=U((e=>{Se(e,V.COLOR_SCALE,"set_legend"),Se(e,V.COLOR_SCALE,"set_id")})),Ho=e=>[{type:"formula",as:"set_id",expr:`join(datum.${e.color}, '∩')`},{type:"formula",as:"set_legend",expr:`length(datum.${e.color}) > 1 ? datum.${e.color}[0]: join(datum.${e.color}, '∩')`}],wo=()=>[{type:"lookup",key:"set_id",fields:["set_id"],from:V.TABLE,as:["table_data"]},{type:"formula",as:"rscSeriesId",expr:"datum.table_data.set_id"},{type:"formula",expr:"datum.table_data.rscMarkId",as:"rscMarkId"}],Fo=()=>[{type:"formula",as:"hidden",expr:"hiddenSeries"},{type:"flatten",fields:["sets"],as:["intersect_set"]},{type:"formula",as:"hide_intersection",expr:"indexof(datum.hidden, datum.intersect_set) === -1 ? 0 : 1"},{type:"joinaggregate",groupby:["set_id"],fields:["hide_intersection"],ops:["sum"]},{type:"filter",expr:"datum.sum_hide_intersection === 0"},{type:"window",groupby:["set_id"],ops:["row_number"],as:["row_num"]},{type:"filter",expr:"datum.row_num === 1"}],Go=U(((e,t)=>{var a,n;const{chartTooltips:r,name:i,idKey:o}=t;Me(t)&&(lt(e,i,o,1,null===(a=r[0])||void 0===a?void 0:a.excludeDataKeys),lt(e,`${i}_intersections`,o,1,null===(n=r[0])||void 0===n?void 0:n.excludeDataKeys))}));function zo({axes:e=[],backgroundColor:t=V.DEFAULT_BACKGROUND_COLOR,chartHeight:a,chartWidth:n,colors:r="categorical12",colorScheme:i=V.DEFAULT_COLOR_SCHEME,data:o,description:s,hiddenSeries:l=[],highlightedItem:c,highlightedSeries:u,idKey:d=V.MARK_ID,legends:m=[],lineTypes:p=V.DEFAULT_LINE_TYPES,lineWidths:h=["M"],marks:g=[],opacities:f,symbolShapes:y=["rounded-square"],symbolSizes:v=["XS","XL"],title:b,titles:E=[]}){var S,_;const T={axes:e,backgroundColor:t,chartHeight:a,chartWidth:n,colors:r,colorScheme:i,data:o,description:s,hiddenSeries:l,highlightedItem:c,highlightedSeries:u,idKey:d,legends:m,lineTypes:p,lineWidths:h,marks:g,opacities:f,symbolShapes:y,symbolSizes:v,title:b,titles:E};let O=ue(null,{backgroundColor:t,colorScheme:i,description:s,title:b});O.signals=Vo(T),O.scales=Ko(r,i,p,h,f,y,v);let{areaCount:$,barCount:x,bulletCount:L,comboCount:I,donutCount:A,lineCount:D,scatterCount:R,vennCount:M}=Uo();const C={colorScheme:i,idKey:d,highlightedItem:c};return O=[...g].reduce(((e,t)=>{switch(t.markType){case"area":return $++,pt(e,Object.assign(Object.assign(Object.assign({},t),C),{index:$}));case"bar":return x++,gr(e,Object.assign(Object.assign(Object.assign({},t),C),{index:x}));case"bullet":return L++,Cr(e,Object.assign(Object.assign(Object.assign({},t),C),{index:L}));case"combo":return I++,Kr(e,Object.assign(Object.assign(Object.assign({},t),C),{index:I}));case"donut":return A++,hi(e,Object.assign(Object.assign(Object.assign({},t),C),{index:A}));case"line":return D++,zr(e,Object.assign(Object.assign(Object.assign({},t),C),{index:D}));case"scatter":return R++,oo(e,Object.assign(Object.assign(Object.assign({},t),C),{index:R}));case"venn":return M++,No(e,Object.assign(Object.assign(Object.assign({},t),C),{index:M,data:o,chartWidth:n,chartHeight:a}));case"bigNumber":return e;default:return console.error(`Invalid component type: ${t} is not a supported chart mark option child`),e}}),O),O=[...m].reduce(((e,t,a)=>Gi(e,Object.assign(Object.assign(Object.assign({},t),C),{index:a,hiddenSeries:l,highlightedSeries:u}))),O),O=[...e].reduce(((e,t,a)=>ca(e,Object.assign(Object.assign(Object.assign({},t),C),{index:a}))),O),E.length&&(O=uo(O,E[0])),O=JSON.parse(JSON.stringify(O)),O.data=os(null!==(S=O.data)&&void 0!==S?S:[],{facets:ae(O.scales)}),u&&Ei(null!==(_=O.marks)&&void 0!==_?_:[]),O=Bo(O),ps(O)}const Bo=U((e=>{var t;e.scales=null===(t=e.scales)||void 0===t?void 0:t.filter((e=>!("domain"in e&&e.domain&&"fields"in e.domain&&0===e.domain.fields.length)))})),Uo=()=>({areaCount:-1,barCount:-1,comboCount:-1,donutCount:-1,bulletCount:-1,lineCount:-1,scatterCount:-1,vennCount:-1}),Vo=({backgroundColor:e,colors:t,colorScheme:a,lineTypes:n,opacities:r,hiddenSeries:i,highlightedItem:o,highlightedSeries:s})=>{const l="transparent"===e?"gray-50":e;return[st(V.BACKGROUND_COLOR,(0,W.getColorValue)(l,a)),st("colors",Wo(t,a)),st("lineTypes",Jo(n)),st("opacities",Yo(r)),st("hiddenSeries",null!=i?i:[]),st(V.HIGHLIGHTED_ITEM,o),st(V.HIGHLIGHTED_GROUP),st(V.HIGHLIGHTED_SERIES,s),st(V.SELECTED_ITEM),st(V.SELECTED_SERIES),st(V.SELECTED_GROUP)]},Wo=(e,t)=>ls(e)?rs(e,t).map((e=>[e])):e.map((e=>rs(e,t))),Jo=e=>cs(e)?is(e).map((e=>[e])):e.map((e=>is(e))),Yo=e=>e?ds(e)?e.map((e=>[e])):e:[[1]],Ko=(e,t,a,n,r,i,o)=>[Xo(e,t),qo(e,t),Zo(a),as(n),ns(r),Qo(i),es(o),ts(o)],Xo=(e,t)=>{const a=ls(e)?rs(e,t):e.map((e=>rs(e,t)[0]));return Le("color",a)},qo=(e,t)=>{const a=ls(e)?rs(e,t):e.map((e=>rs(e,t)[0]));return{name:V.LINEAR_COLOR_SCALE,type:"linear",range:a,domain:{data:V.TABLE,fields:[]}}},Zo=e=>{const t=cs(e)?is(e):e.map((e=>ne(e[0])));return Le(V.LINE_TYPE_SCALE,t)},Qo=e=>{const t=ms(e)?function(e){return e.map((e=>ie(e)))}(e):e.map((e=>ie(e[0])));return Le(V.SYMBOL_SHAPE_SCALE,t)},es=e=>({name:V.SYMBOL_SIZE_SCALE,type:"linear",zero:!1,range:e.map((e=>se(e))),domain:{data:V.TABLE,fields:[]}}),ts=e=>({name:V.SYMBOL_PATH_WIDTH_SCALE,type:"linear",zero:!1,range:e.map((e=>le(e))),domain:{data:V.TABLE,fields:[]}}),as=e=>{const t=e.map((e=>re(e)));return Le(V.LINE_WIDTH_SCALE,t)},ns=e=>{if(null==e?void 0:e.length){const t=ds(e)?e:e.map((e=>e[0]));return Le(V.OPACITY_SCALE,t)}return{name:V.OPACITY_SCALE,type:"point",range:[1,0],padding:1,align:1,domain:{data:V.TABLE,fields:[]}}};function rs(e,t){return Array.isArray(e)?e.map((e=>(0,W.getColorValue)(e,t))):W.colorSchemes[e]}function is(e){return e.map((e=>ne(e)))}const os=U(((e,{facets:t})=>{var a,n,r;if(0===t.length)return;null===(n=null===(a=e[0])||void 0===a?void 0:a.transform)||void 0===n||n.push(...Z(t));const i=e.findIndex((e=>e.name===V.FILTERED_TABLE));-1!==i&&(e[i].transform=[{type:"filter",expr:`indexof(hiddenSeries, datum.${V.SERIES_ID}) === -1`},...null!==(r=e[i].transform)&&void 0!==r?r:[]])})),ss=e=>Boolean(!Array.isArray(e)&&e in W.colorSchemes),ls=e=>ss(e)||e.some((e=>!ss(e)&&"string"==typeof e)),cs=e=>e.some((e=>"string"==typeof e||us(e))),us=e=>Array.isArray(e)&&!e.some((e=>"number"!=typeof e)),ds=e=>!e.some((e=>Array.isArray(e))),ms=e=>!e.some((e=>Array.isArray(e))),ps=e=>"function"==typeof structuredClone?structuredClone(e):JSON.parse(JSON.stringify(e));function hs(e,t){if((a=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var a,n=e.slice(0,a);return[n.length>1?n[0]+n.slice(2):n,+e.slice(a+1)]}V.MARK_ID,V.SERIES_ID,V.TRENDLINE_VALUE,V.GROUP_DATA;var gs,fs=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ys(e){if(!(t=fs.exec(e)))throw new Error("invalid format: "+e);var t;return new vs({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function vs(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function bs(e,t){var a=hs(e,t);if(!a)return e+"";var n=a[0],r=a[1];return r<0?"0."+new Array(-r).join("0")+n:n.length>r+1?n.slice(0,r+1)+"."+n.slice(r+1):n+new Array(r-n.length+2).join("0")}ys.prototype=vs.prototype,vs.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const Es={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>bs(100*e,t),r:bs,s:function(e,t){var a=hs(e,t);if(!a)return e+"";var n=a[0],r=a[1],i=r-(gs=3*Math.max(-8,Math.min(8,Math.floor(r/3))))+1,o=n.length;return i===o?n:i>o?n+new Array(i-o+1).join("0"):i>0?n.slice(0,i)+"."+n.slice(i):"0."+new Array(1-i).join("0")+hs(e,Math.max(0,t+i-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Ss(e){return e}var _s=Array.prototype.map,Ts=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Os(e){var t,a,n=void 0===e.grouping||void 0===e.thousands?Ss:(t=_s.call(e.grouping,Number),a=e.thousands+"",function(e,n){for(var r=e.length,i=[],o=0,s=t[0],l=0;r>0&&s>0&&(l+s+1>n&&(s=Math.max(1,n-l)),i.push(e.substring(r-=s,r+s)),!((l+=s+1)>n));)s=t[o=(o+1)%t.length];return i.reverse().join(a)}),r=void 0===e.currency?"":e.currency[0]+"",i=void 0===e.currency?"":e.currency[1]+"",o=void 0===e.decimal?".":e.decimal+"",s=void 0===e.numerals?Ss:function(e){return function(t){return t.replace(/[0-9]/g,(function(t){return e[+t]}))}}(_s.call(e.numerals,String)),l=void 0===e.percent?"%":e.percent+"",c=void 0===e.minus?"−":e.minus+"",u=void 0===e.nan?"NaN":e.nan+"";function d(e){var t=(e=ys(e)).fill,a=e.align,d=e.sign,m=e.symbol,p=e.zero,h=e.width,g=e.comma,f=e.precision,y=e.trim,v=e.type;"n"===v?(g=!0,v="g"):Es[v]||(void 0===f&&(f=12),y=!0,v="g"),(p||"0"===t&&"="===a)&&(p=!0,t="0",a="=");var b="$"===m?r:"#"===m&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",E="$"===m?i:/[%p]/.test(v)?l:"",S=Es[v],_=/[defgprs%]/.test(v);function T(e){var r,i,l,m=b,T=E;if("c"===v)T=S(e)+T,e="";else{var O=(e=+e)<0||1/e<0;if(e=isNaN(e)?u:S(Math.abs(e),f),y&&(e=function(e){e:for(var t,a=e.length,n=1,r=-1;n<a;++n)switch(e[n]){case".":r=t=n;break;case"0":0===r&&(r=n),t=n;break;default:if(!+e[n])break e;r>0&&(r=0)}return r>0?e.slice(0,r)+e.slice(t+1):e}(e)),O&&0==+e&&"+"!==d&&(O=!1),m=(O?"("===d?d:c:"-"===d||"("===d?"":d)+m,T=("s"===v?Ts[8+gs/3]:"")+T+(O&&"("===d?")":""),_)for(r=-1,i=e.length;++r<i;)if(48>(l=e.charCodeAt(r))||l>57){T=(46===l?o+e.slice(r+1):e.slice(r))+T,e=e.slice(0,r);break}}g&&!p&&(e=n(e,1/0));var $=m.length+e.length+T.length,x=$<h?new Array(h-$+1).join(t):"";switch(g&&p&&(e=n(x+e,x.length?h-T.length:1/0),x=""),a){case"<":e=m+e+T+x;break;case"=":e=m+x+e+T;break;case"^":e=x.slice(0,$=x.length>>1)+m+e+T+x.slice($);break;default:e=x+m+e+T}return s(e)}return f=void 0===f?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,f)):Math.max(0,Math.min(20,f)),T.toString=function(){return e+""},T}return{format:d,formatPrefix:function(e,t){var a,n=d(((e=ys(e)).type="f",e)),r=3*Math.max(-8,Math.min(8,Math.floor((a=t,((a=hs(Math.abs(a)))?a[1]:NaN)/3)))),i=Math.pow(10,-r),o=Ts[8+r/3];return function(e){return n(i*e)+o}}}}var $s=i(542);const xs=(e="en-US")=>{const{number:t}=(0,$s.getLocale)(e),a="string"==typeof e?e:null==e?void 0:e.number;return{formatTimeDurationLabels:Rs(t),formatLocaleCurrency:Is(t),formatShortNumber:Ls(a),consoleLog:Ms,formatHorizontalTimeAxisLabels:As(),formatVerticalAxisTimeLabels:Ds(),getLabelWidth:Cs,truncateText:Ns}},Ls=e=>{const t="string"==typeof e?e:navigator.language,a="object"==typeof e?e.decimal:void 0;return e=>{const n=new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(1.1).replace(/\d/g,""),r=Intl.NumberFormat(t,{notation:"compact"}).format(e);return a?r.replace(n,a):r}},Is=(e=$s.numberLocales["en-US"])=>({value:t},a,n,r)=>{if("string"==typeof t)return t;try{const i={style:"currency",currency:n,maximumFractionDigits:0},o=new Intl.NumberFormat(a,i).format(0);let s=2;"currency"!==r&&(s=parseInt(r.split(".")[1].replace("f","")));const l=Os(e);return o.replace("0",l.format(`,.${s}f`)(t))}catch(a){return console.error("Error formatting currency: ",a),Os(e).format("$,.2f")(t)}},As=()=>{let e;return t=>{const a=0===t.index||e!==t.label;return e=t.label,a?t.label:""}},Ds=()=>{let e;return t=>{const a=t.label.split(" "),n=a[0],r=0===t.index||e!==n;return e=n,r?t.label:a[1]}},Rs=(e=$s.numberLocales["en-US"])=>{const t=Os(e),a=t.format("02,d"),n=t.format(",d");return({value:e})=>{if("string"==typeof e)return e;const t=e<0?"-":"",r=Math.abs(e),i=a(Math.floor(r%60));return r<3600?`${t}${n(Math.floor(r/60))}:${i}`:`${t}${n(Math.floor(r/60/60))}:${a(Math.floor(r/60%60))}:${i}`}},Ms=e=>(console.log(e),e),Cs=(e,t="bold",a=12)=>{const n=document.createElement("canvas").getContext("2d");return null===n?0:(n.font=`${t} ${a}px ${W.ADOBE_CLEAN_FONT}`,n.measureText(e).width)},Ns=(e,t,a="normal",n=12)=>{t-=4;const r=Cs(e,a,n),i=Cs("…",a,n);if(r<=t)return e;let o=e.slice(0,e.length-1).trim();for(let e=o.length;e>0&&(o=o.slice(0,o.length-1).trim(),!(Cs(o,a,n)+i<=t));e--);return 0===o.length?e:o+"…"},js={consoleLog:Ms,formatHorizontalTimeAxisLabels:As(),formatVerticalAxisTimeLabels:Ds(),getLabelWidth:Cs,truncateText:Ns},ks=({locale:e="en-US",height:t=400,width:a=600,padding:n=0,renderer:r="svg",config:i,colorScheme:o=V.DEFAULT_COLOR_SCHEME})=>{const s=xs(e),{number:l,time:c}=(0,$s.getLocale)(e);return{actions:!1,ast:!0,expressionFunctions:s,formatLocale:l,height:t,width:a,padding:n,renderer:r,timeFormatLocale:c,config:null!=i?i:he(void 0,o)}}})(),o})()));
3
3
  //# sourceMappingURL=index.js.map