Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vega-parser

Package Overview
Dependencies
Maintainers
1
Versions
151
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vega-parser - npm Package Compare versions

Comparing version 1.0.0-beta.2 to 1.0.0-beta.3

4

build/vega-parser.min.js

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-util"),require("vega-expression"),require("vega-dataflow")):"function"==typeof define&&define.amd?define(["exports","vega-util","vega-expression","vega-dataflow"],t):t(e.vega=e.vega||{},e.vega,e.vega,e.vega)}(this,function(e,t,n,a){"use strict";function i(e){return"_["+t.stringValue("$"+e)+"]"}function r(e,t,n){var a=De+e;n.hasOwnProperty(a)||(n[a]=t.signalRef(e))}function o(e,t,n){var a=je+e;if(!n.hasOwnProperty(a))try{n[a]=t.scaleRef(e)}catch(e){}}function l(e,t,n,a){var i=Fe+t;a.hasOwnProperty(i)||(a[i]=n.getData(e).indataRef(n,t))}function s(e,t,n){var a=Ce+e;n.hasOwnProperty(a)||(n[a]=t.getData(e).tuplesRef())}function u(e){return Ne.hasOwnProperty(e)}function d(e,t,n,a,i){for(var r,o=0,l=e.length;t<l;++t){if(r=e[t],i&&i.indexOf(r)>=0&&--o,r===n&&!o)return t;a&&a.indexOf(r)>=0&&++o}return t}function f(e){for(var t=[],n=0,a=e.length,i=0;i<a;)i=d(e,i,Ke,Je+Xe,He+Ye),t.push(e.substring(n,i).trim()),n=++i;if(0===t.length)throw"Empty event selector: "+e;return t}function c(e){return"["===e[0]?p(e):g(e)}function p(e){var t,n,a=1,i=e.length,r=1;if(r=d(e,r,He,Je),r===i)throw"Empty between selector: "+e;if(t=f(e.substring(a,r)),2!==t.length)throw"Between selector must have two elements: "+e;if(e=e.slice(r+1).trim(),e[0]!==Qe)throw"Expected '>' after between selector: "+e;return t=t.map(c),n=c(e.slice(1).trim()),n.between?{between:t,stream:n}:(n.between=t,n)}function g(e){var t,n,a={source:"view"},i=[],r=[0,0],o=0,l=0,s=e.length,f=0;if(e[s-1]===Ye){if(f=e.lastIndexOf(Xe),!(f>=0))throw"Unmatched right brace: "+e;try{r=h(e.substring(f+1,s-1))}catch(t){throw"Invalid throttle specification: "+e}e=e.slice(0,f).trim(),s=e.length,f=0}if(!s)throw e;if("@"===e[0]&&(o=++f),t=d(e,f,Ge),t<s&&(i.push(e.substring(l,t).trim()),l=f=++t),f=d(e,f,Je),f===s)i.push(e.substring(l,s).trim());else if(i.push(e.substring(l,f).trim()),n=[],l=++f,l===s)throw"Unmatched left bracket: "+e;for(;f<s;){if(f=d(e,f,He),f===s)throw"Unmatched left bracket: "+e;if(n.push(e.substring(l,f).trim()),f<s-1&&e[++f]!==Je)throw"Expected left bracket: "+e;l=++f}if(!(s=i.length)||Ze.test(i[s-1]))throw"Invalid event selector: "+e;return s>1?(a.type=i[1],o?a.markname=i[0].slice(1):u(i[0])?a.marktype=i[0]:a.source=i[0]):a.type=i[0],"!"===a.type.slice(-1)&&(a.consume=!0,a.type=a.type.slice(0,-1)),null!=n&&(a.filter=n),r[0]&&(a.throttle=r[0]),r[1]&&(a.debounce=r[1]),a}function h(e){var t=e.split(Ke);if(!e.length||t.length>2)throw e;return t.map(function(t){var n=+t;if(n!==n)throw e;return n})}function m(e,n){var a=e.merge?v:e.stream?y:e.type?x:t.error("Invalid stream specification: "+JSON.stringify(e));return a(e,n)}function v(e,t){var n=e.merge.map(function(e){return m(e,t)}),a=b({merge:n},e,t);return t.addStream(a).id}function y(e,t){var n=m(e.stream,t),a=b({stream:n},e,t);return t.addStream(a).id}function x(e,t){var n=t.event(e.source||et,e.type),a=b({stream:n},e,t);return 1===Object.keys(a).length?n:t.addStream(a).id}function b(e,n,a){var i,r;return(i=n.between)&&(2!==i.length&&t.error("Stream between parameter must have 2 entries."),e.between=[m(i[0],a),m(i[1],a)]),r=n.marktype||n.markname,(n.filter||r)&&(i=n.filter?t.array(n.filter):[],r&&i.push(k(n.marktype,n.markname)),e.filter=Le("("+i.join(")&&(")+")").$expr),null!=(i=n.throttle)&&(e.throttle=+i),null!=(i=n.debounce)&&(e.debounce=+i),n.consume&&(e.consume=!0),e}function k(e,t){var n="event.item";return n+(e&&"*"!==e?"&&"+n+".mark.marktype==='"+e+"'":"")+(t?"&&"+n+".mark.name==='"+t+"'":"")}function S(e,n){return t.isArray(e)?e.map(function(e){return S(e,n)}):t.isObject(e)?e.signal?n.signalRef(e.signal):t.error("Unsupported parameter object: "+JSON.stringify(e)):e}function w(e,n,a,i){var r,o,l;if(e.signal)r="datum",l=ut(e.signal,n,a);else if(e.group||e.parent){for(o=Math.max(1,e.level||1),r="item";o-- >0;)r+=".mark.group";e.parent?(l=e.parent,r+=".datum"):l=e.group}else e.datum?(r="datum",l=e.datum):t.error("Invalid field reference: "+JSON.stringify(e));return e.signal||(t.isString(l)?(i[l]=1,l=t.splitAccessPath(l).map(t.stringValue).join("][")):l=w(l,n,a,i)),r+"["+l+"]"}function R(e,n){if(!t.isString(e))return-1;var a=n.scaleType(e);return"band"===a||"point"===a?1:0}function z(e,n,a,i){var r;if(t.isString(e))r=je+e,a.hasOwnProperty(r)||(a[r]=n.scaleRef(e)),r=t.stringValue(r);else{for(r in n.scales)a[je+r]=n.scaleRef(r);r=t.stringValue(je)+"+"+dt(e,n,a,i)}return"_["+r+"]"}function O(e,n,a,i){var r,o,l,s={},u="var o=item,datum=o.datum,$;";for(r in e)o=e[r],t.isArray(o)?u+=vt(r,o,i,a,s):(l=ht(r,o,i,a,s),u+=mt("o",r,l));return u+=lt(e,n),u+="return 1;",{$expr:u,$fields:Object.keys(s),$output:Object.keys(e)}}function $(e){return t.isObject(e)?e:{value:e}}function P(e,n){for(var a in n)"interactive"!==a&&(e[a]=t.extend(e[a]||{},n[a]));return e}function E(e,t,n,a,i){var r,o;i=i||{},i.encoders={$encode:r={}},e=_(e,t,n,a.config);for(o in e)r[o]=O(e[o],t,i,a);return i}function _(e,n,a,i){var r,o,l;if(i=i&&(a===xt?i.group:a===yt?i.mark&&i.mark[n]:null)){r={};for(o in i)l=D(o,e)||("fill"===o||"stroke"===o)&&(D("fill",e)||D("stroke",e)),l||(r[o]={value:i[o]});e=t.extend({},e),e.enter=t.extend(r,e.enter)}return e}function D(e,t){return t.enter&&t.enter[e]||t.update&&t.update[e]}function j(e,t,n,a){this.id=-1,this.type=e,this.value=t,this.params=n,a&&(this.parent=a)}function F(e,t,n,a){return new j(e,t,n,a)}function C(e,t){return F("Operator",e,t)}function A(e){return{$ref:e.id}}function W(e,t){return t?{$field:e,$name:t}:{$field:e}}function M(e,t){return{$compare:e,$order:t}}function L(e){return{$key:e}}function U(e){return t.isObject(e)?(e.order===nn?"-":"+")+V(e.op,e.field):""}function V(e,t){return(e&&e.signal?"$"+e.signal:e||"")+(e&&t?"_":"")+(t&&t.signal?"$"+t.signal:t||"")}function q(e){return e&&e.signal}function T(e){return function(t,n,a){return F(e,n,t||void 0,a)}}function B(e,t,n){var a,i,r,o={};for(i=0,r=e.params.length;i<r;++i)a=e.params[i],o[a.name]=N(a,t,n);return o}function N(e,n,a){var i,r=e.type;return"index"===r?J(e,n,a):"param"===r?H(e,n,a):"projection"===r?a.projectionRef(n[e.name]):(i=n[e.name],void 0===i?void(e.required&&t.error("Missing required parameter: "+e.name)):e.array&&!q(i)?i.map(function(t){return I(e,t,a)}):I(e,i,a))}function I(e,n,a){var i=e.type;if(q(n))return Q(i)?t.error("Expression references can not be signals."):Z(i)?a.fieldRef(n):ee(i)?a.compareRef(n):a.signalRef(n.signal);var r=e.expr||Z(i);return r&&Y(n)?Le(n.expr,a):r&&G(n)?W(n.field):Q(i)?Le(n,a):K(i)?A(a.getData(n).values):Z(i)?W(n):ee(i)?M(t.array(n.field),t.array(n.order)):n}function J(e,n,a){return t.isString(n.from)||t.error('Lookup "from" parameter must be a string literal.'),a.getData(n.from).lookupRef(a,n.key)}function H(e,n,a){var i=n[e.name];return e.array?(t.isArray(i)||t.error("Expected an array of sub-parameters. Instead: "+i),i.map(function(t){return X(e,t,a)})):X(e,i,a)}function X(e,n,a){var i,r,o,l,s;for(l=0,s=e.params.length;l<s;++l){r=e.params[l];for(o in r.key)if(r.key[o]!==n[o]){r=null;break}if(r)break}return r||t.error("Unsupported parameter: "+JSON.stringify(n)),i=t.extend(B(r,n,a),r.key),A(a.add(yn(i)))}function Y(e){return e&&e.expr}function G(e){return e&&e.field}function K(e){return"data"===e}function Q(e){return"expr"===e}function Z(e){return"field"===e}function ee(e){return"compare"===e}function te(e,t,n,a){this.scope=e,this.input=t,this.output=n,this.values=a,this.index={}}function ne(e){return t.isString(e)?e:null}function ae(e,t,n){var a,i=V(n.op,n.field);if(t.ops){for(var r=0,o=t.as.length;r<o;++r)if(t.as[r]===i)return}else t.ops=["count"],t.fields=[null],t.as=["count"];n.op&&(t.ops.push((a=n.op.signal)?e.signalRef(a):n.op),t.fields.push(e.fieldRef(n.field)),t.as.push(i))}function ie(e,t,n,a,i,r,o){var l,s,u=t[n]||(t[n]={}),d=U(r),f=ne(i);if(null!=f&&(e=t.scope,f+=d?"|"+d:"",l=u[f]),!l){var c=r?{field:en,pulse:t.countsRef(e,i,r)}:{field:e.fieldRef(i),pulse:A(t.output)};d&&(c.sort=e.sortRef(r)),s=e.add(F(a,void 0,c)),o&&(t.index[i]=s),l=A(s),null!=f&&(u[f]=l)}return l}function re(e,t){return null!=e?e:t}function oe(e,t,n){var a,i=+t.symbolSize;return a=n&&n.update&&n.update.fontSize,a||(a=n&&n.enter&&n.enter.fontSize),a&&(a=a.value),a||(a=+t.labelFontSize),e.size?{$expr:"Math.max(ceil(sqrt(_.scale(datum))),"+a+")"}:Math.max(Math.ceil(Math.sqrt(i)),a)}function le(e){return Mn.hasOwnProperty(e)}function se(e){return"quantile"===e}function ue(e,n){return t.isObject(e)?e.signal?n.signalRef(e.signal):t.error("Unsupported object: "+e):e}function de(e,n,a){if(e)return e.signal?a.signalRef(e.signal):(t.isArray(e)?fe:e.fields?pe:ce)(e,n,a)}function fe(e,t,n){return e.map(function(e){return ue(e,n)})}function ce(e,n,a){var i=a.getData(e.data);return i||t.error("Can not find data set: "+e.data),le(n.type)?i.valuesRef(a,e.field,he(e.sort,!1)):se(n.type)?i.domainRef(a,e.field):i.extentRef(a,e.field)}function pe(e,n,a){var i=e.data,r=e.fields.reduce(function(e,n){return e.push(t.isString(n)?{data:i,field:n}:n),e},[]);return(le(n.type)?ge:se(n.type)?me:ve)(e,a,r)}function ge(e,n,a){var i,r,o,l;return i=a.map(function(e){var a=n.getData(e.data);return a||t.error("Can not find data set: "+e.data),a.countsRef(n,e.field)}),r=n.add(an({groupby:en,ops:["sum"],fields:[n.fieldRef("count")],as:["count"],pulse:i})),o=n.add(ln({pulse:A(r)})),l=n.add(On({field:en,sort:n.sortRef(he(e.sort,!0)),pulse:A(o)})),A(l)}function he(e,n){return e&&(e.field||e.op?e.field||"count"===e.op?n&&e.field?t.error("Multiple domain scales can not sort by field."):n&&e.op&&"count"!==e.op&&t.error("Multiple domain scales support op count only."):t.error("No field provided for sort aggregate op: "+e.op):t.isObject(e)?e.field="key":e={field:"key"}),e}function me(e,n,a){var i=a.map(function(e){var a=n.getData(e.data);return a||t.error("Can not find data set: "+e.data),a.domainRef(n,e.field)});return A(n.add(vn({values:i})))}function ve(e,n,a){var i=a.map(function(e){var a=n.getData(e.data);return a||t.error("Can not find data set: "+e.data),a.extentRef(n,e.field)});return A(n.add(mn({extents:i})))}function ye(e,n){var a=e.range,i=n.config.range;if(a.signal)return n.signalRef(a.signal);if(t.isString(a))i&&i.hasOwnProperty(a)?a=i[a]:"width"===a?a=[0,{signal:"width"}]:"height"===a?a=le(e.type)?[0,{signal:"height"}]:[{signal:"height"},0]:t.error("Unrecognized scale range value: "+a);else{if(le(e.type)&&!t.isArray(a))return de(a,e,n);t.isArray(a)||t.error("Unsupported range type: "+a)}return a.map(function(e){return ue(e,n)})}function xe(e,t){var n=[];e.transform&&e.transform.forEach(function(e){n.push($n(e,t))}),e.on&&e.on.forEach(function(n){jn(n,t,e.name)}),t.addDataPipeline(e.name,be(e,t,n))}function be(e,t,n){var a,i,r,o,l,s=[],u=null,d=!1,f=!1;for(e.values?s.push(u=ke({$ingest:e.values,$format:e.format})):e.url?s.push(u=ke({$request:e.url,$format:e.format})):e.source&&(a=t.getData(e.source),u=a.output,s.push(null)),i=0,r=n.length;i<r;++i)o=n[i],l=o.metadata,u||l.source||s.push(u=ke()),s.push(o),l.generates&&(f=!0),l.modifies&&!f&&(d=!0),l.source?u=o:l.changes&&(u=null);return a&&(s[0]=kn({derive:d,pulse:A(a.output)}),d&&s.splice(1,0,ke())),u||s.push(ke()),s.push(Rn({})),s}function ke(e){var t=ln({},e);return t.metadata={source:!0},t}function Se(e,t){return{scale:e.scale,range:t}}function we(e,n){var a,i,r,o,l;return n.background=e.background||n.config.background,l=A(n.root=n.add(C())),n.addSignal("width",e.width||-1),n.addSignal("height",e.height||-1),n.addSignal("padding",$e(e.padding)),t.array(e.signals).forEach(function(e){Hn[e.name]||Pe(e,n)}),i=n.add(ln()),r=P({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},e.encode),r=n.add(dn(E(r,Ue,xt,n,{pulse:A(i)}))),o=n.add(zn({legendMargin:n.config.legendMargin,autosize:e.autosize||n.config.autosize,mark:l,pulse:A(r)})),n.pushState(A(r),A(o)),Jn(e,n,!0),a=n.add(on({mark:l,pulse:A(o)})),a=n.add(Sn({pulse:A(a)})),a=n.add(Rn({pulse:A(a)})),n.addData("root",new te(n,i,i,a)),n}function Re(e){this.config=e,this.bindings=[],this.field={},this.signals={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.background=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._markpath=[]}function ze(e){this.config=e.config,this.field=Object.create(e.field),this.signals=Object.create(e.signals),this.scales=Object.create(e.scales),this.events=Object.create(e.events),this.data=Object.create(e.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++e._nextsub[0],this._nextsub=e._nextsub,this._parent=e._parent.slice(),this._encode=e._encode.slice(),this._markpath=e._markpath}function Oe(){return{autosize:"pad",background:null,group:null,mark:{arc:{fill:"steelblue"},area:{fill:"steelblue"},image:null,line:{stroke:"steelblue"},path:{stroke:"steelblue"},rect:{fill:"steelblue"},rule:{stroke:"#000"},shape:{stroke:"steelblue"},symbol:{fill:"steelblue",size:64},text:{fill:"#000",font:"sans-serif",fontSize:11}},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domainDefault:!0,domainWidth:1,domainColor:"#000",gridDefault:!1,gridWidth:1,gridColor:"#ddd",gridDash:[],gridOpacity:1,tickPadding:2,tickRound:!0,tickSize:5,tickWidth:1,tickColor:"#000",tickLabelColor:"#000",tickLabelFont:"sans-serif",tickLabelFontSize:10,titleAlign:"center",titlePadding:2,titleColor:"#000",titleFont:"sans-serif",titleFontSize:11,titleFontWeight:"bold"},legend:{orient:"right",offset:18,padding:0,entryPadding:5,titlePadding:5,gradientWidth:100,gradientHeight:20,gradientStrokeColor:"#ddd",gradientStrokeWidth:0,gradientLabelBaseline:"top",gradientLabelOffset:2,labelColor:"#000",labelFontSize:10,labelFont:"sans-serif",labelAlign:"left",labelBaseline:"middle",labelOffset:8,symbolType:"circle",symbolSize:100,symbolColor:"#888",symbolStrokeWidth:1.5,titleColor:"#000",titleFont:"sans-serif",titleFontSize:11,titleFontWeight:"bold",titleAlign:"left",titleBaseline:"top"},range:{category:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],symbol:["circle","cross","diamond","square","triangle-up","triangle-down","triangle-right","triangle-left"]}}}var $e=function(e){return t.isObject(e)?e:t.isNumber(e)?{top:e,bottom:e,left:e,right:e}:{top:0,left:0,bottom:0,right:0}},Pe=function(e,t){var n=t.addSignal(e.name,e.value);e.react===!1&&(n.react=!1),e.bind&&t.addBinding(e.name,e.bind)},Ee="Literal",_e="Identifier",De="$",je="%",Fe="@",Ce=":",Ae="event.vega.",We=function(e){var t=n.functions(e);return t.view=Ae+"view",t.item=Ae+"item",t.group=Ae+"group",t.xy=Ae+"xy",t.x=Ae+"x",t.y=Ae+"y",t.encode="this.encode",t.modify="this.modify",t.format="this.format",t.timeFormat="this.timeFormat",t.utcFormat="this.utcFormat",t.pad="this.pad",t.truncate="this.truncate",t.rgb="this.rgb",t.lab="this.lab",t.hcl="this.hcl",t.hsl="this.hsl",t.gradient="this.gradient",t.copy="this.scaleCopy",t.domain="this.domain",t.bandwidth="this.bandwidth",t.indata="this.indata",t.inrange="this.inrange",t.invert="this.scaleInvert",t.range="this.range",t.scale="this.scale",t.span="this.span",t.tuples="this.tuples",t.clampRange="this.clampRange",t.pinchDistance="this.pinchDistance",t.pinchAngle="this.pinchAngle",t.open="this.open",t.screen=function(){return"window.screen"},t.windowsize=function(){return"[window.innerWidth, window.innerHeight]"},t},Me=n.codegen({blacklist:["_"],whitelist:["datum","event"],fieldvar:"datum",globalvar:i,functions:We,constants:n.constants}),Le=function(e,a,i){var u,d,f={};try{u=n.parse(e)}catch(n){t.error("Expression parse error: "+e)}return u.visit(function(e){if("CallExpression"===e.type){var i=e.callee.name,r=e.arguments;switch(i){case"bandwidth":case"copy":case"domain":case"range":case"gradient":case"invert":case"scale":r[0].type===Ee?o(r[0].value,a,f):r[0].type===_e&&(i=r[0].name,r[0]=new n.ASTNode(Ee),r[0].raw='{signal:"'+i+'"}');break;case"indata":r[0].type!==Ee&&t.error("First argument to indata must be a string literal."),r[1].type!==Ee&&t.error("Second argument to indata must be a string literal."),l(r[0].value,r[1].value,a,f);break;case"tuples":r[0].type!==Ee&&t.error("First argument to tuples must be a string literal."),s(r[0].value,a,f)}}}),d=Me(u),d.globals.forEach(function(e){r(e,a,f)}),{$expr:i?i+"return("+d.code+");":d.code,$fields:d.fields,$params:f}},Ue="group",Ve="rect",qe="rule",Te="symbol",Be="text",Ne=t.toSet(["*","arc","area","group","image","line","path","rect","rule","shape","symbol","text"]),Ie=function(e){return f(e.trim()).map(c)},Je="[",He="]",Xe="{",Ye="}",Ge=":",Ke=",",Qe=">",Ze=/[\[\]\{\}]/,et="view",tt=function(e,t){return e.signal?t.getSignal(e.signal).id:m(e,t)},nt="var datum=event.item&&event.item.datum;",at=function(e,n,a){var i,r=e.events,o=e.update,l=e.encode,s=[],u="";r||t.error("Signal update missing events specification."),t.isString(r)&&(r=Ie(r)),r=t.array(r).filter(function(e){return e.signal?(s.push(e),0):1}),r.length&&s.push(r.length>1?{merge:r}:r[0]),null!=l&&(o&&t.error("Signal encode and update are mutually exclusive."),o="encode(item(),"+t.stringValue(l)+")"),u=t.isString(o)?Le(o,n,nt):null!=o.expr?Le(o.expr,n,nt):null!=o.value?o.value:null!=o.signal?{$expr:"_.value",$params:{value:n.signalRef(o.signal)}}:t.error("Invalid signal update specification."),i={target:a,update:u},e.force&&(i.options={force:!0}),s.forEach(function(e){e={source:tt(e,n)},n.addUpdate(t.extend(e,i))})},it=function(e,t){var n=t.getSignal(e.name);if(e.update){var a=Le(e.update,t);n.update=a.$expr,n.params=a.$params}e.on&&e.on.forEach(function(e){at(e,t,n.id)})},rt=function(e,t){var n={};for(var a in e)"name"!==a&&(n[a]=S(e[a],t));t.addProjection(e.name,n)},ot=t.toSet(["rule"]),lt=function(e,t){var n="";return ot[t]?n:(e.x2&&(e.x?(n+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;",n+="o.width=o.x2-o.x;"):n+=e.width?"o.x=o.x2-o.width;":"o.x=o.x2;"),e.xc&&(n+=e.width?"o.x=o.xc-o.width/2;":"o.x=o.xc;"),e.y2&&(e.y?(n+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;",n+="o.height=o.y2-o.y;"):n+=e.height?"o.y=o.y2-o.height;":"o.y=o.y2;"),e.yc&&(n+=e.height?"o.y=o.yc-o.height/2;":"o.y=o.yc;"),n)},st=function(e,t,n,a){function i(e,i,r,o){var l=ht(null,i,t,n,a),s=ht(null,r,t,n,a),u=ht(null,o,t,n,a);return"this."+e+"("+[l,s,u].join(",")+").toString()"}return e.c?i("hcl",e.h,e.c,e.l):e.h||e.s?i("hsl",e.h,e.s,e.l):e.l||e.a?i("lab",e.l,e.a,e.b):e.r||e.g||e.b?i("rgb",e.r,e.g,e.b):null},ut=function(e,n,a){var i=De+e;return a.hasOwnProperty(i)||(a[i]=n.signalRef(e)),"_["+t.stringValue(i)+"]"},dt=function(e,n,a,i){return w(t.isObject(e)?e:{datum:e},n,a,i)},ft=function(e,t,n,a,i){var r,o,l,s=z(e.scale,n,a,i);return null!=e.range?(r=+e.range,o=s+".range()",t=0===r?o+"[0]":"($="+o+","+(1===r?"$[$.length-1]":"$[0]+"+r+"*($[$.length-1]-$[0])")+")"):(t=null!=t?s+"("+t+")":null,e.band&&(l=R(e.scale,n))&&(o=s+".bandwidth",r=+e.band,r=o+"()"+(1===r?"":"*"+r),l<0&&(r="("+o+"?"+r+":0)"),t=(t?t+"+":"")+r,e.extra&&(t="(datum.extra?"+s+"(datum.extra.value):"+t+")")),null==t&&(t="0")),t},ct=function(e,n,a,i){return"this.gradient("+z(e.gradient,n,a,i)+","+t.stringValue(e.start)+","+t.stringValue(e.stop)+","+t.stringValue(e.count)+")"},pt=function(e,n,a,i){return t.isObject(e)?"("+ht(null,e,n,a,i)+")":e},gt=function(e,n,a,i){var r=Le(e,n);return r.$fields.forEach(function(e){i[e]=1}),t.extend(a,r.$params),r.$expr},ht=function(e,n,a,i,r){if(null!=n.gradient)return ct(n,a,i,r);var o=null!=n.color?st(n.color,a,i,r):null!=n.field?dt(n.field,a,i,r):null!=n.signal?ut(n.signal,a,i):null!=n.expr?gt(n.expr,a,i,r):null!=n.value?t.stringValue(n.value):null;return null!=n.scale&&(o=ft(n,o,a,i,r)),null!=n.exponent&&(o="Math.pow("+o+","+pt(n.exponent,a,i,r)+")"),null!=n.mult&&(o+="*"+pt(n.mult,a,i,r)),null!=n.offset&&(o+="+"+pt(n.offset,a,i,r)),n.round&&(o="Math.round("+o+")"),o},mt=function(e,n,a){return e+"["+t.stringValue(n)+"]="+a+";"},vt=function(e,t,n,a,i){var r="";return t.forEach(function(t){var o=ht(e,t,n,a,i);r+=t.test?gt(t.test,n,a,i)+"?"+o+":":o}),mt("o",e,r)},yt="mark",xt="frame",bt="scope",kt="axis",St="axis-domain",wt="axis-grid",Rt="axis-label",zt="axis-tick",Ot="axis-title",$t="legend",Pt="legend-entry",Et="legend-gradient",_t="legend-label",Dt="legend-symbol",jt="legend-title",Ft=function(e,t,n,a,i,r){return{type:e,role:t,key:n,from:a,interactive:!(!r||!r.interactive),encode:P(i,r)}},Ct=function(e,t,n){var a={value:0},i={};return i.enter={opacity:a,x:a,y:a,width:{value:t.gradientWidth},height:{value:t.gradientHeight},stroke:{value:t.gradientStrokeColor},strokeWidth:{value:t.gradientStrokeWidth}},i.exit={opacity:a},i.update={x:a,y:a,width:{value:t.gradientWidth},height:{value:t.gradientHeight},fill:{gradient:e},opacity:{value:1}},Ft(Ve,Et,void 0,void 0,i,n)},At="top",Wt="left",Mt="right",Lt="bottom",Ut="index",Vt="label",qt="perc",Tt="size",Bt="total",Nt="value",It="datum."+qt+'<=0?"left":datum.'+qt+'>=1?"right":"center"',Jt=function(e,t,n,a){var i,r,o={value:0},l={};return l.enter=i={opacity:o,text:{field:Vt},fill:{value:t.labelColor},font:{value:t.labelFont},fontSize:{value:t.labelFontSize},baseline:{value:t.gradientLabelBaseline}},l.exit={opacity:o},l.update=r={opacity:{value:1}},i.x=r.x={field:qt,mult:t.gradientWidth},i.y=r.y={value:t.gradientHeight,offset:t.gradientLabelOffset},i.align=r.align={expr:It},Ft(Be,_t,Vt,a,l,n)},Ht=function(e,t,n,a){var i,r,o={value:0},l={};return l.enter=i={opacity:o,fill:{value:t.labelColor},text:{field:Vt},font:{value:t.labelFont},fontSize:{value:t.labelFontSize},align:{value:t.labelAlign},baseline:{value:t.labelBaseline}},l.exit={opacity:o},l.update=r={opacity:{value:1}},i.x=r.x={field:Tt,offset:t.labelOffset},i.y=r.y={field:Tt,mult:.5,offset:{field:Bt,offset:{field:{group:"entryPadding"},mult:{field:Ut}}}},Ft(Be,_t,Vt,a,l,n)},Xt=function(e,t,n,a){var i,r,o={value:0},l={};return l.enter=i={opacity:o,shape:{value:t.symbolType},size:{value:t.symbolSize},strokeWidth:{value:t.symbolStrokeWidth}},e.fill||(i.stroke={value:t.symbolColor}),l.exit={opacity:o},l.update=r={opacity:{value:1}},i.x=r.x={field:Tt,mult:.5},i.y=r.y={field:Tt,mult:.5,offset:{field:Bt,offset:{field:{group:"entryPadding"},mult:{field:Ut}}}},["shape","size","fill","stroke","opacity"].forEach(function(t){e[t]&&(r[t]=i[t]={scale:e[t],field:Nt})}),Ft(Te,Dt,Vt,a,l,n)},Yt=function(e,t,n,a){var i={value:0},r={};return r.enter={x:{field:{group:"padding"}},y:{field:{group:"padding"}},opacity:i,fill:{value:t.titleColor},font:{value:t.titleFont},fontSize:{value:t.titleFontSize},fontWeight:{value:t.titleFontWeight},align:{value:t.titleAlign},baseline:{value:t.titleBaseline}},r.exit={opacity:i},r.update={opacity:{value:1},text:{field:"title"}},Ft(Be,jt,null,a,r,n)},Gt=function(e,t,n,a,i){return{type:Ue,role:e,from:t,interactive:n,encode:a,marks:i}},Kt=function(e){return e.role||(e.type===Ue&&(e.legends||e.axes)?bt:yt)},Qt=function(e){return{clip:e.clip||!1,interactive:e.interactive!==!1,marktype:e.type,name:e.name||void 0,role:Kt(e),zindex:+e.zindex||void 0}},Zt=function(e){return e},en=W("key"),tn="ascending",nn="descending",an=T("Aggregate"),rn=T("AxisTicks"),on=T("Bound"),ln=T("Collect"),sn=T("Compare"),un=T("DataJoin"),dn=T("Encode"),fn=T("Facet"),cn=T("Field"),pn=T("Key"),gn=T("LegendEntries"),hn=T("Mark"),mn=T("MultiExtent"),vn=T("MultiValues"),yn=T("Params"),xn=T("PreFacet"),bn=T("Projection"),kn=T("Relay"),Sn=T("Render"),wn=T("Scale"),Rn=T("Sieve"),zn=T("ViewLayout"),On=T("Values"),$n=function(e,n){var i=a.definition(e.type);i||t.error("Unrecognized transform type: "+e.type);var r=F(i.type,null,B(i,e,n));return e.signal&&n.addSignal(e.signal,r),r.metadata=i.metadata||{},r},Pn=function(e,n,a){var i,r,o,l;return e?(i=e.facet)&&(n||t.error("Only group marks can be faceted."),null!=i.field?l=A(a.getData(i.data).output):(r=a.keyRef(i.groupby),e.data||(o=$n(t.extend({type:"aggregate",groupby:t.array(i.groupby)},i.aggregate)),o.params.key=r,o.params.pulse=A(a.getData(i.data).output),l=A(a.add(o))))):l=A(a.add(ln(null,[{}]))),l||(l=e.$ref?e:A(e.mark?a.getData(Zt(e.mark)).output:a.getData(e.data).output)),{key:r,pulse:l}};te.fromEntries=function(e,t){var n=t.length,a=1,i=t[0],r=t[n-1],o=t[n-2];for(e.add(t[0]);a<n;++a)t[a].params.pulse=A(t[a-1]),e.add(t[a]);return new te(e,i,o,r)};var En=te.prototype;En.countsRef=function(e,t,n){var a,i,r,o=this,l=o.counts||(o.counts={}),s=ne(t);return null!=s&&(e=o.scope,a=l[s]),a?n&&n.field&&ae(e,a.agg.params,n):(r={groupby:e.fieldRef(t,"key"),pulse:A(o.output)},n&&n.field&&ae(e,r,n),i=e.add(an(r)),a=e.add(ln({pulse:A(i)})),a={agg:i,ref:A(a)},null!=s&&(l[s]=a)),a.ref},En.tuplesRef=function(){return A(this.values)},En.extentRef=function(e,t){return ie(e,this,"extent","Extent",t,!1)},En.domainRef=function(e,t){return ie(e,this,"domain","Values",t,!1)},En.valuesRef=function(e,t,n){return ie(e,this,"vals","Values",t,n||!0)},En.lookupRef=function(e,t){return ie(e,this,"lookup","TupleIndex",t,!1)},En.indataRef=function(e,t){return ie(e,this,"indata","TupleIndex",t,!0,!0)};var _n=function(e,n,a){var i,r,o,l,s=e.from.facet,u=s.name,d=A(n.getData(s.data).output);s.name||t.error("Facet must have a name: "+JSON.stringify(s)),s.data||t.error("Facet must reference a data set: "+JSON.stringify(s)),s.field?l=n.add(xn({field:n.fieldRef(s.field),pulse:d})):s.groupby?l=n.add(fn({key:n.keyRef(s.groupby),group:a.pulse,pulse:d})):t.error("Facet must specify groupby or field: "+JSON.stringify(s)),i=n.fork(),r=i.add(ln()),o=i.add(Rn({pulse:A(r)})),i.addData(u,new te(i,r,r,o)),i.addSignal("parent",null),l.params.subflow={$subflow:Jn(e,i).toRuntime()}},Dn=function(e,t,n){var a=t.add(xn({pulse:n.pulse})),i=t.fork();i.add(Rn()),i.addSignal("parent",null),a.params.subflow={$subflow:Jn(e,i).toRuntime()}},jn=function(e,t,n){var a,i,r=e.remove,o=e.insert,l=e.toggle,s=e.modify,u=e.values,d=t.add(C());a="if("+e.trigger+',modify("'+n+'",'+[o,r,l,s,u].map(function(e){return null==e?"null":e}).join(",")+"),0)",i=Le(a,t),d.update=i.$expr,d.params=i.$params},Fn=function(e,n){var a,i,r,o,l,s,u,d,f,c,p=Kt(e),g=e.type===Ue,h=e.from&&e.from.facet,m=p===bt||p===xt;i=Pn(e.from,g,n),a=n.add(un(i)),a=r=n.add(ln({pulse:A(a)})),a=n.add(hn({markdef:Qt(e),scenepath:{$itempath:n.markpath()},pulse:A(a)})),d=A(a),a=n.add(dn(E(e.encode,e.type,p,n,{pulse:d}))),e.transform&&e.transform.forEach(function(e){var i=$n(e,n);(i.metadata.generates||i.metadata.changes)&&t.error("Mark transforms should not generate new data."),i.params.pulse=A(a),n.add(a=i)}),a.params.parent=n.encode(),f=A(a),(h||m)&&(a=n.add(zn({legendMargin:n.config.legendMargin,mark:d,pulse:f})),n.operators.pop(),n.pushState(f,A(a)),h?_n(e,n,i):Dn(e,n,i),n.popState(),n.operators.push(a)),o=n.add(on({mark:d,pulse:A(a)})),c=A(o),!g||h||m||(n.pushState(f,c),p===yt?Dn(e,n,i):Jn(e,n),n.popState()),l=n.add(Sn({pulse:c})),s=n.add(Rn({pulse:c},void 0,n.parent())),null!=e.name&&(u=Zt(e.name),n.addData(u,new te(n,r,l,s)),e.on&&e.on.forEach(function(e){(e.insert||e.remove||e.toggle)&&t.error("Marks only support modify triggers."),jn(e,n,u)}))},Cn=function(e,n){var a,i,r,o,l,s,u,d,f=e.type||"symbol",c=n.config.legend,p=e.encode||{},g=!!e.interactive,h=e.size||e.shape||e.fill||e.stroke||e.opacity;return h||t.error("Missing valid scale for legend."),a={orient:re(e.orient,c.orient),title:e.title},i=A(n.add(ln(null,[a]))),s=P({update:{offset:$(re(e.offset,c.offset)),padding:$(re(e.padding,c.padding)),titlePadding:$(re(e.titlePadding,c.titlePadding))}},p.legend),u={update:{x:{field:{group:"padding"}},y:{field:{group:"padding"}},entryPadding:$(re(e.entryPadding,c.entryPadding))}},"gradient"===f?(r=A(n.add(gn({type:"gradient",scale:n.scaleRef(h),count:n.property(e.count),values:n.property(e.values),formatSpecifier:n.property(e.format)}))),d=[Ct(h,c,p.gradient),Jt(e,c,p.labels,r)]):(r=A(n.add(gn({size:oe(e,c,p.labels),scale:n.scaleRef(h),count:n.property(e.count),values:n.property(e.values),formatSpecifier:n.property(e.formatSpecifier)}))),d=[Xt(e,c,p.symbols,r),Ht(e,c,p.labels,r)]),d=[Gt(Pt,i,g,u,d)],a.title&&(l=Yt(e,c,p.title,i),u.update.y.offset={field:{group:"titlePadding"},offset:l.encode.update.fontSize||l.encode.enter.fontSize},d.push(l)),o=Gt($t,i,g,s,d),e.zindex&&(o.zindex=e.zindex),Fn(o,n)},An=["identity","ordinal","band","point","index","linear","pow","sqrt","log","sequential","time","utc","quantize","quantile","threshold"],Wn=t.toSet(An),Mn=t.toSet(An.slice(1,5)),Ln=function(e,n){var a,i,r=e.type||"linear";Wn.hasOwnProperty(r)||t.error("Unrecognized scale type: "+r),a={type:r,domain:de(e.domain,e,n)},null!=e.range&&(null!=e.bandSize&&t.error("Scale range and bandSize are mutually exclusive."),a.range=ye(e,n));for(i in e)a[i]||"name"===i||(a[i]=ue(e[i],n));n.addScale(e.name,a)},Un=function(e,n){var a=n.config,i=e.orient,r=i===At||i===Lt?a.axisX:a.axisY,o=a["axis"+i[0].toUpperCase()+i.slice(1)],l="band"===n.scaleType(e.scale)&&a.axisBand;return r||o||l?t.extend({},a.axis,r,o,l):a.axis},Vn=function(e,t,n,a){var i,r,o=e.orient,l={value:0},s={};return s.enter=i={opacity:l,stroke:{value:t.tickColor},strokeWidth:{value:t.tickWidth}},s.exit={opacity:l},s.update=r={opacity:{value:1}},o===At||o===Lt?(i.y=l,r.x=i.x=Se(e,0),r.x2=i.x2=Se(e,1)):(i.x=l,r.y=i.y=Se(e,0),r.y2=i.y2=Se(e,1)),Ft(qe,St,null,a,s,n)},qn=function(e,t,n,a){var i,r,o,l,s=e.orient,u=s===Wt||s===At?1:-1,d=u*e.offset||0,f={value:0},c={};return c.enter=i={opacity:f,stroke:{value:t.gridColor},strokeWidth:{value:t.gridWidth},strokeDash:{value:t.gridDash}},c.exit=r={opacity:f},c.update=o={opacity:{value:t.gridOpacity}},l={scale:e.scale,field:Nt,band:t.bandPosition,round:t.tickRound,extra:t.tickExtra},s===At||s===Lt?(i.y={value:d},o.y2=i.y2={signal:"height",mult:u,offset:d},o.x=i.x=r.x=l):(i.x={value:d},o.x2=i.x2={signal:"width",mult:u,offset:d},o.y=i.y=r.y=l),Ft(qe,wt,Nt,a,c,n)},Tn=function(e,t,n,a){var i,r,o,l,s,u=e.orient,d=u===Wt||u===At?-1:1,f=null!=e.tickSize?e.tickSize:t.tickSize,c={value:0},p={};return p.enter=i={opacity:c,stroke:{value:t.tickColor},strokeWidth:{value:t.tickWidth}},p.exit=r={opacity:c},p.update=o={opacity:{value:1}},l=$(f),l.mult=d,s={scale:e.scale,field:Nt,band:t.bandPosition,round:t.tickRound,extra:t.tickExtra},u===At||u===Lt?(o.y=i.y=c,o.y2=i.y2=l,o.x=i.x=r.x=s):(o.x=i.x=c,o.x2=i.x2=l,o.y=i.y=r.y=s),Ft(qe,zt,Vt,a,p,n)},Bn=function(e,t,n,a){var i,r,o,l,s,u=e.orient,d=u===Wt||u===At?-1:1,f=null!=e.tickSize?e.tickSize:t.tickSize,c=null!=e.tickPadding?e.tickPadding:t.tickPadding,p={value:0},g={};return g.enter=i={opacity:p,fill:{value:t.tickLabelColor},font:{value:t.tickLabelFont},fontSize:{value:t.tickLabelFontSize},text:{field:Vt}},g.exit=r={opacity:p},g.update=o={opacity:{value:1}},l=$(f),l.mult=d,l.offset=$(c),l.offset.mult=d,s={scale:e.scale,field:Nt,band:.5},u===At||u===Lt?(o.y=i.y=l,o.x=i.x=r.x=s,o.align={value:"center"},o.baseline={value:u===At?"bottom":"top"}):(o.x=i.x=l,o.y=i.y=r.y=s,o.align={value:u===Mt?"left":"right"},o.baseline={value:"middle"}),Ft(Be,Rt,Vt,a,g,n)},Nn=function(e,t,n,a){var i,r,o=e.orient,l=o===Wt||o===At?-1:1,s=o===At||o===Lt,u={};return u.enter={opacity:{value:0},fill:{value:t.titleColor},font:{value:t.titleFont},fontSize:{value:t.titleFontSize},fontWeight:{value:t.titleFontWeight},align:{value:t.titleAlign}},u.exit={opacity:{value:0}},u.update=i={opacity:{value:1},text:{field:"title"}},r={scale:e.scale,range:.5},s?(i.x=r,i.angle={value:0},i.baseline={value:o===At?"bottom":"top"}):(i.y=r,i.angle={value:90*l},i.baseline={value:"bottom"}),null!=t.titleAngle&&(i.angle={value:t.titleAngle}),null!=t.titleBaseline&&(i.baseline={value:t.titleBaseline}),null!=t.titleX?i.x={value:t.titleX}:s&&!D(n,"x")&&(u.enter.auto={value:!0}),null!=t.titleY?i.y={value:t.titleY}:s||D(n,"y")||(u.enter.auto={value:!0}),Ft(Be,Ot,null,a,u,n)},In=function(e,t){var n,a,i,r,o,l,s=Un(e,t),u=e.encode||{},d=!!e.interactive;return n={orient:e.orient,domain:null!=e.domain?!!e.domain:s.domainDefault,grid:null!=e.grid?!!e.grid:s.gridDefault,title:e.title},a=A(t.add(ln({},[n]))),o=P({update:{range:{expr:'abs(span(range("'+e.scale+'")))'},offset:$(e.offset||0),position:$(e.position||0),titlePadding:$(e.titlePadding||s.titlePadding),minExtent:$(e.minExtent||s.minExtent),maxExtent:$(e.maxExtent||s.maxExtent)}},u.axis),i=A(t.add(rn({
scale:t.scaleRef(e.scale),extra:s.tickExtra,count:t.property(e.count),values:t.property(e.values),formatSpecifier:t.property(e.format)}))),l=[Tn(e,s,u.ticks,i),Bn(e,s,u.labels,i)],n.grid&&l.unshift(qn(e,s,u.grid,i)),n.domain&&l.push(Vn(e,s,u.domain,a)),n.title&&l.push(Nn(e,s,u.title,a)),r=Gt(kt,a,d,o,l),e.zindex&&(r.zindex=e.zindex),Fn(r,t)},Jn=function(e,n,a){var i=t.array(e.signals);return a||i.forEach(function(e){Pe(e,n)}),t.array(e.projections).forEach(function(e){rt(e,n)}),t.array(e.data).forEach(function(e){xe(e,n)}),t.array(e.scales).forEach(function(e){Ln(e,n)}),i.forEach(function(e){it(e,n)}),t.array(e.axes).forEach(function(e){In(e,n)}),t.array(e.marks).forEach(function(e){Fn(e,n)}),t.array(e.legends).forEach(function(e){Cn(e,n)}),n},Hn=t.toSet(["width","height","padding"]),Xn=Re.prototype=ze.prototype;Xn.fork=function(){return new ze(this)},Xn.toRuntime=function(){return this.finish(),{background:this.background,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings}},Xn.id=function(){return(this._subid?this._subid+":":0)+this._id++},Xn.add=function(e){return this.operators.push(e),e.id=this.id(),e},Xn.addStream=function(e){return this.streams.push(e),e.id=this.id(),e},Xn.addUpdate=function(e){return this.updates.push(e),e},Xn.finish=function(){function e(e,t,n){var a,i;e&&(a=e.data||(e.data={}),i=a[t]||(a[t]=[]),i.push(n))}var t,n;this.root&&(this.root.root=!0);for(t in this.signals)this.signals[t].signal=t;for(t in this.scales)this.scales[t].scale=t;for(t in this.data){n=this.data[t],e(n.input,t,"input"),e(n.output,t,"output"),e(n.values,t,"values");for(var a in n.index)e(n.index[a],t,"index:"+a)}return this},Xn.pushState=function(e,t){this._encode.push(A(this.add(Rn({pulse:e})))),this._parent.push(t),this._markpath.push(-1)},Xn.popState=function(){this._parent.pop(),this._encode.pop(),this._markpath.pop()},Xn.parent=function(){return t.peek(this._parent)},Xn.encode=function(){return t.peek(this._encode)},Xn.markpath=function(){var e=this._markpath;return++e[e.length-1],e.slice()},Xn.fieldRef=function(e,n){if(t.isString(e))return W(e,n);e.signal||e.expr||t.error("Unsupported field reference: "+JSON.stringify(e));var a,i,r,o,l=this.field[e.signal||e.expr];return l||(e.expr?(r=Le(i=e.expr,this),o=this.add(C(null,r.$params)),o.update=r.$expr,a={name:A(o)}):a={name:A(this.signals[i=e.signal])},n&&(a.as=n),this.field[i]=l=A(this.add(cn(a)))),l},Xn.compareRef=function(e){function n(e){return q(e)?(i=!0,A(a[e.signal])):e}var a=this.signals,i=!1,r=t.array(e.field).map(n),o=t.array(e.order).map(n);return i?A(this.add(sn({fields:r,orders:o}))):M(r,o)},Xn.keyRef=function(e){function n(e){return q(e)?(i=!0,A(a[e.signal])):e}var a=this.signals,i=!1;return e=t.array(e).map(n),i?A(this.add(pn({fields:e}))):L(e)},Xn.sortRef=function(e){if(!e)return e;var t=[V(e.op,e.field),"_id"],n=e.order||tn;return n.signal?A(this.add(sn({fields:t,orders:[n=this.signalRef(n.signal),n]}))):M(t,[n,n])},Xn.event=function(e,t){var n=e+":"+t;if(!this.events[n]){var a=this.id();this.streams.push({id:a,source:e,type:t}),this.events[n]=a}return this.events[n]},Xn.addSignal=function(e,n){this.signals.hasOwnProperty(e)&&t.error("Duplicate signal name: "+e);var a=n instanceof j?n:this.add(C(n));return this.signals[e]=a},Xn.getSignal=function(e){return this.signals[e]||t.error("Unrecognized signal name: "+e),this.signals[e]},Xn.signalRef=function(e){return A(this.getSignal(e))},Xn.property=function(e){return e&&e.signal?this.signalRef(e.signal):e},Xn.addBinding=function(e,n){this.bindings||t.error("Nested signals do not support binding."),this.bindings.push(t.extend({signal:e},n))},Xn.addScaleProj=function(e,n){this.scales.hasOwnProperty(e)&&t.error("Duplicate scale or projection name: "+e),this.scales[e]=this.add(n)},Xn.addScale=function(e,t){this.addScaleProj(e,wn(t))},Xn.addProjection=function(e,t){this.addScaleProj(e,bn(t))},Xn.getScale=function(e){return this.scales[e]||t.error("Unrecognized scale name: "+e),this.scales[e]},Xn.projectionRef=Xn.scaleRef=function(e){return A(this.getScale(e))},Xn.projectionType=Xn.scaleType=function(e){return this.getScale(e).params.type},Xn.addData=function(e,n){this.data.hasOwnProperty(e)&&t.error("Duplicate data set name: "+e),this.data[e]=n},Xn.getData=function(e){return this.data[e]||t.error("Undefined data set name: "+e),this.data[e]},Xn.addDataPipeline=function(e,n){this.data.hasOwnProperty(e)&&t.error("Duplicate data set name: "+e),this.addData(e,te.fromEntries(this,n))};var Yn=function(e){var n,a=Oe();for(n in e)a[n]=t.isObject(a[n])?t.extend(a[n],e[n]):a[n]=e[n];return a},Gn=function(e,t){return we(e,new Re(Yn(t||e.config))).toRuntime()};e.parse=Gn,e.selector=Ie,e.signal=Pe,e.signalUpdates=it,e.stream=tt,e.MarkRole=yt,e.FrameRole=xt,e.ScopeRole=bt,e.AxisRole=kt,e.AxisDomainRole=St,e.AxisGridRole=wt,e.AxisLabelRole=Rt,e.AxisTickRole=zt,e.AxisTitleRole=Ot,e.LegendRole=$t,e.LegendEntryRole=Pt,e.LegendLabelRole=_t,e.LegendSymbolRole=Dt,e.LegendTitleRole=jt,e.marktypes=Ne,e.isMarkType=u,e.Scope=Re,e.DataScope=te,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-util"),require("vega-expression"),require("vega-dataflow")):"function"==typeof define&&define.amd?define(["exports","vega-util","vega-expression","vega-dataflow"],t):t(e.vega=e.vega||{},e.vega,e.vega,e.vega)}(this,function(e,t,n,a){"use strict";function i(e){return"_["+t.stringValue("$"+e)+"]"}function r(e,t,n){var a=De+e;!n.hasOwnProperty(a)&&t.getSignal(e)&&(n[a]=t.signalRef(e))}function o(e,t,n){var a=_e+e;if(!n.hasOwnProperty(a))try{n[a]=t.scaleRef(e)}catch(e){}}function l(e,t,n,a){var i=Fe+t;a.hasOwnProperty(i)||(a[i]=n.getData(e).indataRef(n,t))}function s(e,t,n){var a=Ce+e;n.hasOwnProperty(a)||(n[a]=t.getData(e).tuplesRef())}function u(e){return Ne.hasOwnProperty(e)}function d(e,t,n,a,i){for(var r,o=0,l=e.length;t<l;++t){if(r=e[t],i&&i.indexOf(r)>=0&&--o,r===n&&!o)return t;a&&a.indexOf(r)>=0&&++o}return t}function f(e){for(var t=[],n=0,a=e.length,i=0;i<a;)i=d(e,i,Ke,Je+Xe,He+Ye),t.push(e.substring(n,i).trim()),n=++i;if(0===t.length)throw"Empty event selector: "+e;return t}function c(e){return"["===e[0]?p(e):g(e)}function p(e){var t,n,a=1,i=e.length,r=1;if(r=d(e,r,He,Je),r===i)throw"Empty between selector: "+e;if(t=f(e.substring(a,r)),2!==t.length)throw"Between selector must have two elements: "+e;if(e=e.slice(r+1).trim(),e[0]!==Qe)throw"Expected '>' after between selector: "+e;return t=t.map(c),n=c(e.slice(1).trim()),n.between?{between:t,stream:n}:(n.between=t,n)}function g(e){var t,n,a={source:"view"},i=[],r=[0,0],o=0,l=0,s=e.length,f=0;if(e[s-1]===Ye){if(f=e.lastIndexOf(Xe),!(f>=0))throw"Unmatched right brace: "+e;try{r=h(e.substring(f+1,s-1))}catch(t){throw"Invalid throttle specification: "+e}e=e.slice(0,f).trim(),s=e.length,f=0}if(!s)throw e;if("@"===e[0]&&(o=++f),t=d(e,f,Ge),t<s&&(i.push(e.substring(l,t).trim()),l=f=++t),f=d(e,f,Je),f===s)i.push(e.substring(l,s).trim());else if(i.push(e.substring(l,f).trim()),n=[],l=++f,l===s)throw"Unmatched left bracket: "+e;for(;f<s;){if(f=d(e,f,He),f===s)throw"Unmatched left bracket: "+e;if(n.push(e.substring(l,f).trim()),f<s-1&&e[++f]!==Je)throw"Expected left bracket: "+e;l=++f}if(!(s=i.length)||Ze.test(i[s-1]))throw"Invalid event selector: "+e;return s>1?(a.type=i[1],o?a.markname=i[0].slice(1):u(i[0])?a.marktype=i[0]:a.source=i[0]):a.type=i[0],"!"===a.type.slice(-1)&&(a.consume=!0,a.type=a.type.slice(0,-1)),null!=n&&(a.filter=n),r[0]&&(a.throttle=r[0]),r[1]&&(a.debounce=r[1]),a}function h(e){var t=e.split(Ke);if(!e.length||t.length>2)throw e;return t.map(function(t){var n=+t;if(n!==n)throw e;return n})}function m(e,n){var a=e.merge?v:e.stream?y:e.type?b:t.error("Invalid stream specification: "+JSON.stringify(e));return a(e,n)}function v(e,t){var n=e.merge.map(function(e){return m(e,t)}),a=x({merge:n},e,t);return t.addStream(a).id}function y(e,t){var n=m(e.stream,t),a=x({stream:n},e,t);return t.addStream(a).id}function b(e,t){var n=t.event(e.source||et,e.type),a=x({stream:n},e,t);return 1===Object.keys(a).length?n:t.addStream(a).id}function x(e,n,a){var i,r;return(i=n.between)&&(2!==i.length&&t.error("Stream between parameter must have 2 entries."),e.between=[m(i[0],a),m(i[1],a)]),r=n.marktype||n.markname,(n.filter||r)&&(i=n.filter?t.array(n.filter):[],r&&i.push(k(n.marktype,n.markname)),e.filter=Me("("+i.join(")&&(")+")").$expr),null!=(i=n.throttle)&&(e.throttle=+i),null!=(i=n.debounce)&&(e.debounce=+i),n.consume&&(e.consume=!0),e}function k(e,t){var n="event.item";return n+(e&&"*"!==e?"&&"+n+".mark.marktype==='"+e+"'":"")+(t?"&&"+n+".mark.name==='"+t+"'":"")}function S(e,n){return t.isArray(e)?e.map(function(e){return S(e,n)}):t.isObject(e)?e.signal?n.signalRef(e.signal):t.error("Unsupported parameter object: "+JSON.stringify(e)):e}function w(e,n,a,i){var r,o,l;if(e.signal)r="datum",l=ut(e.signal,n,a,i);else if(e.group||e.parent){for(o=Math.max(1,e.level||1),r="item";o-- >0;)r+=".mark.group";e.parent?(l=e.parent,r+=".datum"):l=e.group}else e.datum?(r="datum",l=e.datum):t.error("Invalid field reference: "+JSON.stringify(e));return e.signal||(t.isString(l)?(i[l]=1,l=t.splitAccessPath(l).map(t.stringValue).join("][")):l=w(l,n,a,i)),r+"["+l+"]"}function R(e,n){if(!t.isString(e))return-1;var a=n.scaleType(e);return"band"===a||"point"===a?1:0}function z(e,n,a,i){var r;if(t.isString(e))r=_e+e,a.hasOwnProperty(r)||(a[r]=n.scaleRef(e)),r=t.stringValue(r);else{for(r in n.scales)a[_e+r]=n.scaleRef(r);r=t.stringValue(_e)+"+"+dt(e,n,a,i)}return"_["+r+"]"}function O(e,n,a,i){var r,o,l,s={},u="var o=item,datum=o.datum,$;";for(r in e)o=e[r],t.isArray(o)?u+=mt(r,o,i,a,s):(l=gt(r,o,i,a,s),u+=ht("o",r,l));return u+=lt(e,n),u+="return 1;",{$expr:u,$fields:Object.keys(s),$output:Object.keys(e)}}function $(e){return t.isObject(e)?e:{value:e}}function P(e,n){for(var a in n)"interactive"!==a&&(e[a]=t.extend(e[a]||{},n[a]));return e}function E(e,t,n,a,i){var r,o;i=i||{},i.encoders={$encode:r={}},e=j(e,t,n,a.config);for(o in e)r[o]=O(e[o],t,i,a);return i}function j(e,n,a,i){var r,o,l;if(i=i&&(a===yt?i.group:a===vt?i.mark&&i.mark[n]:null)){r={};for(o in i)l=D(o,e)||("fill"===o||"stroke"===o)&&(D("fill",e)||D("stroke",e)),l||(r[o]={value:i[o]});e=t.extend({},e),e.enter=t.extend(r,e.enter)}return e}function D(e,t){return t.enter&&t.enter[e]||t.update&&t.update[e]}function _(e,t,n,a){this.id=-1,this.type=e,this.value=t,this.params=n,a&&(this.parent=a)}function F(e,t,n,a){return new _(e,t,n,a)}function C(e,t){return F("Operator",e,t)}function A(e){return{$ref:e.id}}function W(e,t){return t?{$field:e,$name:t}:{$field:e}}function L(e,t){return{$compare:e,$order:t}}function M(e){return{$key:e}}function U(e){return t.isObject(e)?(e.order===tn?"-":"+")+V(e.op,e.field):""}function V(e,t){return(e&&e.signal?"$"+e.signal:e||"")+(e&&t?"_":"")+(t&&t.signal?"$"+t.signal:t||"")}function q(e){return e&&e.signal}function T(e){return function(t,n,a){return F(e,n,t||void 0,a)}}function B(e,t,n){var a,i,r,o={};for(i=0,r=e.params.length;i<r;++i)a=e.params[i],o[a.name]=N(a,t,n);return o}function N(e,n,a){var i,r=e.type;return"index"===r?J(e,n,a):"param"===r?H(e,n,a):"projection"===r?a.projectionRef(n[e.name]):(i=n[e.name],void 0===i?void(e.required&&t.error("Missing required parameter: "+e.name)):e.array&&!q(i)?i.map(function(t){return I(e,t,a)}):I(e,i,a))}function I(e,n,a){var i=e.type;if(q(n))return Q(i)?t.error("Expression references can not be signals."):Z(i)?a.fieldRef(n):ee(i)?a.compareRef(n):a.signalRef(n.signal);var r=e.expr||Z(i);return r&&Y(n)?Me(n.expr,a):r&&G(n)?W(n.field):Q(i)?Me(n,a):K(i)?A(a.getData(n).values):Z(i)?W(n):ee(i)?L(t.array(n.field),t.array(n.order)):n}function J(e,n,a){return t.isString(n.from)||t.error('Lookup "from" parameter must be a string literal.'),a.getData(n.from).lookupRef(a,n.key)}function H(e,n,a){var i=n[e.name];return e.array?(t.isArray(i)||t.error("Expected an array of sub-parameters. Instead: "+i),i.map(function(t){return X(e,t,a)})):X(e,i,a)}function X(e,n,a){var i,r,o,l,s;for(l=0,s=e.params.length;l<s;++l){r=e.params[l];for(o in r.key)if(r.key[o]!==n[o]){r=null;break}if(r)break}return r||t.error("Unsupported parameter: "+JSON.stringify(n)),i=t.extend(B(r,n,a),r.key),A(a.add(vn(i)))}function Y(e){return e&&e.expr}function G(e){return e&&e.field}function K(e){return"data"===e}function Q(e){return"expr"===e}function Z(e){return"field"===e}function ee(e){return"compare"===e}function te(e,t,n,a){this.scope=e,this.input=t,this.output=n,this.values=a,this.index={}}function ne(e){return t.isString(e)?e:null}function ae(e,t,n){var a,i=V(n.op,n.field);if(t.ops){for(var r=0,o=t.as.length;r<o;++r)if(t.as[r]===i)return}else t.ops=["count"],t.fields=[null],t.as=["count"];n.op&&(t.ops.push((a=n.op.signal)?e.signalRef(a):n.op),t.fields.push(e.fieldRef(n.field)),t.as.push(i))}function ie(e,t,n,a,i,r,o){var l,s,u=t[n]||(t[n]={}),d=U(r),f=ne(i);if(null!=f&&(e=t.scope,f+=d?"|"+d:"",l=u[f]),!l){var c=r?{field:Zt,pulse:t.countsRef(e,i,r)}:{field:e.fieldRef(i),pulse:A(t.output)};d&&(c.sort=e.sortRef(r)),s=e.add(F(a,void 0,c)),o&&(t.index[i]=s),l=A(s),null!=f&&(u[f]=l)}return l}function re(e,t){return null!=e?e:t}function oe(e,t,n){var a,i=+t.symbolSize;return a=n&&n.update&&n.update.fontSize,a||(a=n&&n.enter&&n.enter.fontSize),a&&(a=a.value),a||(a=+t.labelFontSize),e.size?{$expr:"Math.max(ceil(sqrt(_.scale(datum))),"+a+")"}:Math.max(Math.ceil(Math.sqrt(i)),a)}function le(e){return Wn.hasOwnProperty(e)}function se(e){return"quantile"===e}function ue(e,n){return t.isObject(e)?e.signal?n.signalRef(e.signal):t.error("Unsupported object: "+e):e}function de(e,n,a){if(e)return e.signal?a.signalRef(e.signal):(t.isArray(e)?fe:e.fields?pe:ce)(e,n,a)}function fe(e,t,n){return e.map(function(e){return ue(e,n)})}function ce(e,n,a){var i=a.getData(e.data);return i||t.error("Can not find data set: "+e.data),le(n.type)?i.valuesRef(a,e.field,he(e.sort,!1)):se(n.type)?i.domainRef(a,e.field):i.extentRef(a,e.field)}function pe(e,n,a){var i=e.data,r=e.fields.reduce(function(e,n){return e.push(t.isString(n)?{data:i,field:n}:n),e},[]);return(le(n.type)?ge:se(n.type)?me:ve)(e,a,r)}function ge(e,n,a){var i,r,o,l;return i=a.map(function(e){var a=n.getData(e.data);return a||t.error("Can not find data set: "+e.data),a.countsRef(n,e.field)}),r=n.add(nn({groupby:Zt,ops:["sum"],fields:[n.fieldRef("count")],as:["count"],pulse:i})),o=n.add(on({pulse:A(r)})),l=n.add(zn({field:Zt,sort:n.sortRef(he(e.sort,!0)),pulse:A(o)})),A(l)}function he(e,n){return e&&(e.field||e.op?e.field||"count"===e.op?n&&e.field?t.error("Multiple domain scales can not sort by field."):n&&e.op&&"count"!==e.op&&t.error("Multiple domain scales support op count only."):t.error("No field provided for sort aggregate op: "+e.op):t.isObject(e)?e.field="key":e={field:"key"}),e}function me(e,n,a){var i=a.map(function(e){var a=n.getData(e.data);return a||t.error("Can not find data set: "+e.data),a.domainRef(n,e.field)});return A(n.add(mn({values:i})))}function ve(e,n,a){var i=a.map(function(e){var a=n.getData(e.data);return a||t.error("Can not find data set: "+e.data),a.extentRef(n,e.field)});return A(n.add(hn({extents:i})))}function ye(e,n){var a=e.range,i=n.config.range;if(a.signal)return n.signalRef(a.signal);if(t.isString(a))i&&i.hasOwnProperty(a)?a=i[a]:"width"===a?a=[0,{signal:"width"}]:"height"===a?a=le(e.type)?[0,{signal:"height"}]:[{signal:"height"},0]:t.error("Unrecognized scale range value: "+a);else{if(le(e.type)&&!t.isArray(a))return de(a,e,n);t.isArray(a)||t.error("Unsupported range type: "+a)}return a.map(function(e){return ue(e,n)})}function be(e,t){var n=[];e.transform&&e.transform.forEach(function(e){n.push(On(e,t))}),e.on&&e.on.forEach(function(n){Dn(n,t,e.name)}),t.addDataPipeline(e.name,xe(e,t,n))}function xe(e,t,n){var a,i,r,o,l,s=[],u=null,d=!1,f=!1;for(e.values?s.push(u=ke({$ingest:e.values,$format:e.format})):e.url?s.push(u=ke({$request:e.url,$format:e.format})):e.source&&(a=t.getData(e.source),u=a.output,s.push(null)),i=0,r=n.length;i<r;++i)o=n[i],l=o.metadata,u||l.source||s.push(u=ke()),s.push(o),l.generates&&(f=!0),l.modifies&&!f&&(d=!0),l.source?u=o:l.changes&&(u=null);return a&&(s[0]=xn({derive:d,pulse:A(a.output)}),d&&s.splice(1,0,ke())),u||s.push(ke()),s.push(wn({})),s}function ke(e){var t=on({},e);return t.metadata={source:!0},t}function Se(e,t){return{scale:e.scale,range:t}}function we(e,n){var a,i,r,o,l;return n.background=e.background||n.config.background,l=A(n.root=n.add(C())),n.addSignal("width",e.width||-1),n.addSignal("height",e.height||-1),n.addSignal("padding",$e(e.padding)),t.array(e.signals).forEach(function(e){Jn[e.name]||Pe(e,n)}),i=n.add(on()),r=P({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},e.encode),r=n.add(un(E(r,Ue,yt,n,{pulse:A(i)}))),o=n.add(Rn({legendMargin:n.config.legendMargin,autosize:e.autosize||n.config.autosize,mark:l,pulse:A(r)})),n.pushState(A(r),A(o)),In(e,n,!0),a=n.add(rn({mark:l,pulse:A(o)})),a=n.add(kn({pulse:A(a)})),a=n.add(wn({pulse:A(a)})),n.addData("root",new te(n,i,i,a)),n}function Re(e){this.config=e,this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.background=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._markpath=[]}function ze(e){this.config=e.config,this.field=Object.create(e.field),this.signals=Object.create(e.signals),this.lambdas=Object.create(e.lambdas),this.scales=Object.create(e.scales),this.events=Object.create(e.events),this.data=Object.create(e.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++e._nextsub[0],this._nextsub=e._nextsub,this._parent=e._parent.slice(),this._encode=e._encode.slice(),this._markpath=e._markpath}function Oe(){return{autosize:"pad",background:null,group:null,mark:{arc:{fill:"steelblue"},area:{fill:"steelblue"},image:null,line:{stroke:"steelblue"},path:{stroke:"steelblue"},rect:{fill:"steelblue"},rule:{stroke:"#000"},shape:{stroke:"steelblue"},symbol:{fill:"steelblue",size:64},text:{fill:"#000",font:"sans-serif",fontSize:11}},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domainDefault:!0,domainWidth:1,domainColor:"#000",gridDefault:!1,gridWidth:1,gridColor:"#ddd",gridDash:[],gridOpacity:1,tickPadding:2,tickRound:!0,tickSize:5,tickWidth:1,tickColor:"#000",tickLabelColor:"#000",tickLabelFont:"sans-serif",tickLabelFontSize:10,titleAlign:"center",titlePadding:2,titleColor:"#000",titleFont:"sans-serif",titleFontSize:11,titleFontWeight:"bold"},legend:{orient:"right",offset:18,padding:0,entryPadding:5,titlePadding:5,gradientWidth:100,gradientHeight:20,gradientStrokeColor:"#ddd",gradientStrokeWidth:0,gradientLabelBaseline:"top",gradientLabelOffset:2,labelColor:"#000",labelFontSize:10,labelFont:"sans-serif",labelAlign:"left",labelBaseline:"middle",labelOffset:8,symbolType:"circle",symbolSize:100,symbolColor:"#888",symbolStrokeWidth:1.5,titleColor:"#000",titleFont:"sans-serif",titleFontSize:11,titleFontWeight:"bold",titleAlign:"left",titleBaseline:"top"},range:{category:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],symbol:["circle","cross","diamond","square","triangle-up","triangle-down","triangle-right","triangle-left"]}}}var $e=function(e){return t.isObject(e)?e:t.isNumber(e)?{top:e,bottom:e,left:e,right:e}:{top:0,left:0,bottom:0,right:0}},Pe=function(e,t){var n=t.addSignal(e.name,e.value);e.react===!1&&(n.react=!1),e.bind&&t.addBinding(e.name,e.bind)},Ee="Literal",je="Identifier",De="$",_e="%",Fe="@",Ce=":",Ae="event.vega.",We=function(e){var t=n.functions(e);return t.view=Ae+"view",t.item=Ae+"item",t.group=Ae+"group",t.xy=Ae+"xy",t.x=Ae+"x",t.y=Ae+"y",t.encode="this.encode",t.modify="this.modify",t.format="this.format",t.timeFormat="this.timeFormat",t.utcFormat="this.utcFormat",t.pad="this.pad",t.truncate="this.truncate",t.rgb="this.rgb",t.lab="this.lab",t.hcl="this.hcl",t.hsl="this.hsl",t.gradient="this.gradient",t.copy="this.scaleCopy",t.domain="this.domain",t.bandwidth="this.bandwidth",t.indata="this.indata",t.inrange="this.inrange",t.invert="this.scaleInvert",t.range="this.range",t.scale="this.scale",t.span="this.span",t.tuples="this.tuples",t.clampRange="this.clampRange",t.pinchDistance="this.pinchDistance",t.pinchAngle="this.pinchAngle",t.open="this.open",t.screen=function(){return"window.screen"},t.windowsize=function(){return"[window.innerWidth, window.innerHeight]"},t},Le=n.codegen({blacklist:["_"],whitelist:["datum","event"],fieldvar:"datum",globalvar:i,functions:We,constants:n.constants}),Me=function(e,a,i){var u,d,f={};try{u=n.parse(e)}catch(n){t.error("Expression parse error: "+e)}return u.visit(function(e){if("CallExpression"===e.type){var i=e.callee.name,r=e.arguments;switch(i){case"bandwidth":case"copy":case"domain":case"range":case"gradient":case"invert":case"scale":r[0].type===Ee?o(r[0].value,a,f):r[0].type===je&&(i=r[0].name,r[0]=new n.ASTNode(Ee),r[0].raw='{signal:"'+i+'"}');break;case"indata":r[0].type!==Ee&&t.error("First argument to indata must be a string literal."),r[1].type!==Ee&&t.error("Second argument to indata must be a string literal."),l(r[0].value,r[1].value,a,f);break;case"tuples":r[0].type!==Ee&&t.error("First argument to tuples must be a string literal."),s(r[0].value,a,f)}}}),d=Le(u),d.globals.forEach(function(e){r(e,a,f)}),{$expr:i?i+"return("+d.code+");":d.code,$fields:d.fields,$params:f}},Ue="group",Ve="rect",qe="rule",Te="symbol",Be="text",Ne=t.toSet(["*","arc","area","group","image","line","path","rect","rule","shape","symbol","text"]),Ie=function(e){return f(e.trim()).map(c)},Je="[",He="]",Xe="{",Ye="}",Ge=":",Ke=",",Qe=">",Ze=/[\[\]\{\}]/,et="view",tt=function(e,t){return e.signal?t.getSignal(e.signal).id:m(e,t)},nt="var datum=event.item&&event.item.datum;",at=function(e,n,a){var i,r=e.events,o=e.update,l=e.encode,s=[],u="";r||t.error("Signal update missing events specification."),t.isString(r)&&(r=Ie(r)),r=t.array(r).filter(function(e){return e.signal?(s.push(e),0):1}),r.length&&s.push(r.length>1?{merge:r}:r[0]),null!=l&&(o&&t.error("Signal encode and update are mutually exclusive."),o="encode(item(),"+t.stringValue(l)+")"),u=t.isString(o)?Me(o,n,nt):null!=o.expr?Me(o.expr,n,nt):null!=o.value?o.value:null!=o.signal?{$expr:"_.value",$params:{value:n.signalRef(o.signal)}}:t.error("Invalid signal update specification."),i={target:a,update:u},e.force&&(i.options={force:!0}),s.forEach(function(e){e={source:tt(e,n)},n.addUpdate(t.extend(e,i))})},it=function(e,t){var n=t.getSignal(e.name);if(e.update){var a=Me(e.update,t);n.update=a.$expr,n.params=a.$params}e.on&&e.on.forEach(function(e){at(e,t,n.id)})},rt=function(e,t){var n={};for(var a in e)"name"!==a&&(n[a]=S(e[a],t));t.addProjection(e.name,n)},ot=t.toSet(["rule"]),lt=function(e,t){var n="";return ot[t]?n:(e.x2&&(e.x?(n+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;",n+="o.width=o.x2-o.x;"):n+=e.width?"o.x=o.x2-o.width;":"o.x=o.x2;"),e.xc&&(n+=e.width?"o.x=o.xc-o.width/2;":"o.x=o.xc;"),e.y2&&(e.y?(n+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;",n+="o.height=o.y2-o.y;"):n+=e.height?"o.y=o.y2-o.height;":"o.y=o.y2;"),e.yc&&(n+=e.height?"o.y=o.yc-o.height/2;":"o.y=o.yc;"),n)},st=function(e,t,n,a){function i(e,i,r,o){var l=gt(null,i,t,n,a),s=gt(null,r,t,n,a),u=gt(null,o,t,n,a);return"this."+e+"("+[l,s,u].join(",")+").toString()"}return e.c?i("hcl",e.h,e.c,e.l):e.h||e.s?i("hsl",e.h,e.s,e.l):e.l||e.a?i("lab",e.l,e.a,e.b):e.r||e.g||e.b?i("rgb",e.r,e.g,e.b):null},ut=function(e,n,a,i){var r=Me(e,n);return r.$fields.forEach(function(e){i[e]=1}),t.extend(a,r.$params),r.$expr},dt=function(e,n,a,i){return w(t.isObject(e)?e:{datum:e},n,a,i)},ft=function(e,t,n,a,i){var r,o,l,s=z(e.scale,n,a,i);return null!=e.range?(r=+e.range,o=s+".range()",t=0===r?o+"[0]":"($="+o+","+(1===r?"$[$.length-1]":"$[0]+"+r+"*($[$.length-1]-$[0])")+")"):(t=null!=t?s+"("+t+")":null,e.band&&(l=R(e.scale,n))&&(o=s+".bandwidth",r=+e.band,r=o+"()"+(1===r?"":"*"+r),l<0&&(r="("+o+"?"+r+":0)"),t=(t?t+"+":"")+r,e.extra&&(t="(datum.extra?"+s+"(datum.extra.value):"+t+")")),null==t&&(t="0")),t},ct=function(e,n,a,i){return"this.gradient("+z(e.gradient,n,a,i)+","+t.stringValue(e.start)+","+t.stringValue(e.stop)+","+t.stringValue(e.count)+")"},pt=function(e,n,a,i){return t.isObject(e)?"("+gt(null,e,n,a,i)+")":e},gt=function(e,n,a,i,r){if(null!=n.gradient)return ct(n,a,i,r);var o=null!=n.color?st(n.color,a,i,r):null!=n.field?dt(n.field,a,i,r):null!=n.signal?ut(n.signal,a,i,r):null!=n.value?t.stringValue(n.value):null;return null!=n.scale&&(o=ft(n,o,a,i,r)),null!=n.exponent&&(o="Math.pow("+o+","+pt(n.exponent,a,i,r)+")"),null!=n.mult&&(o+="*"+pt(n.mult,a,i,r)),null!=n.offset&&(o+="+"+pt(n.offset,a,i,r)),n.round&&(o="Math.round("+o+")"),o},ht=function(e,n,a){return e+"["+t.stringValue(n)+"]="+a+";"},mt=function(e,t,n,a,i){var r="";return t.forEach(function(t){var o=gt(e,t,n,a,i);r+=t.test?ut(t.test,n,a,i)+"?"+o+":":o}),ht("o",e,r)},vt="mark",yt="frame",bt="scope",xt="axis",kt="axis-domain",St="axis-grid",wt="axis-label",Rt="axis-tick",zt="axis-title",Ot="legend",$t="legend-entry",Pt="legend-gradient",Et="legend-label",jt="legend-symbol",Dt="legend-title",_t=function(e,t,n,a,i,r){return{type:e,role:t,key:n,from:a,interactive:!(!r||!r.interactive),encode:P(i,r)}},Ft=function(e,t,n){var a={value:0},i={};return i.enter={opacity:a,x:a,y:a,width:{value:t.gradientWidth},height:{value:t.gradientHeight},stroke:{value:t.gradientStrokeColor},strokeWidth:{value:t.gradientStrokeWidth}},i.exit={opacity:a},i.update={x:a,y:a,width:{value:t.gradientWidth},height:{value:t.gradientHeight},fill:{gradient:e},opacity:{value:1}},_t(Ve,Pt,void 0,void 0,i,n)},Ct="top",At="left",Wt="right",Lt="bottom",Mt="index",Ut="label",Vt="perc",qt="size",Tt="total",Bt="value",Nt="datum."+Vt+'<=0?"left":datum.'+Vt+'>=1?"right":"center"',It=function(e,t,n,a){var i,r,o={value:0},l={};return l.enter=i={opacity:o,text:{field:Ut},fill:{value:t.labelColor},font:{value:t.labelFont},fontSize:{value:t.labelFontSize},baseline:{value:t.gradientLabelBaseline}},l.exit={opacity:o},l.update=r={opacity:{value:1}},i.x=r.x={field:Vt,mult:t.gradientWidth},i.y=r.y={value:t.gradientHeight,offset:t.gradientLabelOffset},i.align=r.align={expr:Nt},_t(Be,Et,Ut,a,l,n)},Jt=function(e,t,n,a){var i,r,o={value:0},l={};return l.enter=i={opacity:o,fill:{value:t.labelColor},text:{field:Ut},font:{value:t.labelFont},fontSize:{value:t.labelFontSize},align:{value:t.labelAlign},baseline:{value:t.labelBaseline}},l.exit={opacity:o},l.update=r={opacity:{value:1}},i.x=r.x={field:qt,offset:t.labelOffset},i.y=r.y={field:qt,mult:.5,offset:{field:Tt,offset:{field:{group:"entryPadding"},mult:{field:Mt}}}},_t(Be,Et,Ut,a,l,n)},Ht=function(e,t,n,a){var i,r,o={value:0},l={};return l.enter=i={opacity:o,shape:{value:t.symbolType},size:{value:t.symbolSize},strokeWidth:{value:t.symbolStrokeWidth}},e.fill||(i.stroke={value:t.symbolColor}),l.exit={opacity:o},l.update=r={opacity:{value:1}},i.x=r.x={field:qt,mult:.5},i.y=r.y={field:qt,mult:.5,offset:{field:Tt,offset:{field:{group:"entryPadding"},mult:{field:Mt}}}},["shape","size","fill","stroke","opacity"].forEach(function(t){e[t]&&(r[t]=i[t]={scale:e[t],field:Bt})}),_t(Te,jt,Ut,a,l,n)},Xt=function(e,t,n,a){var i={value:0},r={};return r.enter={x:{field:{group:"padding"}},y:{field:{group:"padding"}},opacity:i,fill:{value:t.titleColor},font:{value:t.titleFont},fontSize:{value:t.titleFontSize},fontWeight:{value:t.titleFontWeight},align:{value:t.titleAlign},baseline:{value:t.titleBaseline}},r.exit={opacity:i},r.update={opacity:{value:1},text:{field:"title"}},_t(Be,Dt,null,a,r,n)},Yt=function(e,t,n,a,i){return{type:Ue,role:e,from:t,interactive:n,encode:a,marks:i}},Gt=function(e){return e.role||(e.type===Ue&&(e.legends||e.axes)?bt:vt)},Kt=function(e){return{clip:e.clip||!1,interactive:e.interactive!==!1,marktype:e.type,name:e.name||void 0,role:Gt(e),zindex:+e.zindex||void 0}},Qt=function(e){return e},Zt=W("key"),en="ascending",tn="descending",nn=T("Aggregate"),an=T("AxisTicks"),rn=T("Bound"),on=T("Collect"),ln=T("Compare"),sn=T("DataJoin"),un=T("Encode"),dn=T("Facet"),fn=T("Field"),cn=T("Key"),pn=T("LegendEntries"),gn=T("Mark"),hn=T("MultiExtent"),mn=T("MultiValues"),vn=T("Params"),yn=T("PreFacet"),bn=T("Projection"),xn=T("Relay"),kn=T("Render"),Sn=T("Scale"),wn=T("Sieve"),Rn=T("ViewLayout"),zn=T("Values"),On=function(e,n){var i=a.definition(e.type);i||t.error("Unrecognized transform type: "+e.type);var r=F(i.type,null,B(i,e,n));return e.signal&&n.addSignal(e.signal,r),r.metadata=i.metadata||{},r},$n=function(e,n,a){var i,r,o,l;return e?(i=e.facet)&&(n||t.error("Only group marks can be faceted."),null!=i.field?l=A(a.getData(i.data).output):(r=a.keyRef(i.groupby),e.data||(o=On(t.extend({type:"aggregate",groupby:t.array(i.groupby)},i.aggregate)),o.params.key=r,o.params.pulse=A(a.getData(i.data).output),l=A(a.add(o))))):l=A(a.add(on(null,[{}]))),l||(l=e.$ref?e:A(e.mark?a.getData(Qt(e.mark)).output:a.getData(e.data).output)),{key:r,pulse:l}};te.fromEntries=function(e,t){var n=t.length,a=1,i=t[0],r=t[n-1],o=t[n-2];for(e.add(t[0]);a<n;++a)t[a].params.pulse=A(t[a-1]),e.add(t[a]);return new te(e,i,o,r)};var Pn=te.prototype;Pn.countsRef=function(e,t,n){var a,i,r,o=this,l=o.counts||(o.counts={}),s=ne(t);return null!=s&&(e=o.scope,a=l[s]),a?n&&n.field&&ae(e,a.agg.params,n):(r={groupby:e.fieldRef(t,"key"),pulse:A(o.output)},n&&n.field&&ae(e,r,n),i=e.add(nn(r)),a=e.add(on({pulse:A(i)})),a={agg:i,ref:A(a)},null!=s&&(l[s]=a)),a.ref},Pn.tuplesRef=function(){return A(this.values)},Pn.extentRef=function(e,t){return ie(e,this,"extent","Extent",t,!1)},Pn.domainRef=function(e,t){return ie(e,this,"domain","Values",t,!1)},Pn.valuesRef=function(e,t,n){return ie(e,this,"vals","Values",t,n||!0)},Pn.lookupRef=function(e,t){return ie(e,this,"lookup","TupleIndex",t,!1)},Pn.indataRef=function(e,t){return ie(e,this,"indata","TupleIndex",t,!0,!0)};var En=function(e,n,a){var i,r,o,l,s=e.from.facet,u=s.name,d=A(n.getData(s.data).output);s.name||t.error("Facet must have a name: "+JSON.stringify(s)),s.data||t.error("Facet must reference a data set: "+JSON.stringify(s)),s.field?l=n.add(yn({field:n.fieldRef(s.field),pulse:d})):s.groupby?l=n.add(dn({key:n.keyRef(s.groupby),group:a.pulse,pulse:d})):t.error("Facet must specify groupby or field: "+JSON.stringify(s)),i=n.fork(),r=i.add(on()),o=i.add(wn({pulse:A(r)})),i.addData(u,new te(i,r,r,o)),i.addSignal("parent",null),l.params.subflow={$subflow:In(e,i).toRuntime()}},jn=function(e,t,n){var a=t.add(yn({pulse:n.pulse})),i=t.fork();i.add(wn()),i.addSignal("parent",null),a.params.subflow={$subflow:In(e,i).toRuntime()}},Dn=function(e,t,n){var a,i,r=e.remove,o=e.insert,l=e.toggle,s=e.modify,u=e.values,d=t.add(C());a="if("+e.trigger+',modify("'+n+'",'+[o,r,l,s,u].map(function(e){return null==e?"null":e}).join(",")+"),0)",i=Me(a,t),d.update=i.$expr,d.params=i.$params},_n=function(e,n){var a,i,r,o,l,s,u,d,f,c,p=Gt(e),g=e.type===Ue,h=e.from&&e.from.facet,m=p===bt||p===yt;i=$n(e.from,g,n),a=n.add(sn(i)),a=r=n.add(on({pulse:A(a)})),a=n.add(gn({markdef:Kt(e),scenepath:{$itempath:n.markpath()},pulse:A(a)})),d=A(a),a=n.add(un(E(e.encode,e.type,p,n,{pulse:d}))),e.transform&&e.transform.forEach(function(e){var i=On(e,n);(i.metadata.generates||i.metadata.changes)&&t.error("Mark transforms should not generate new data."),i.params.pulse=A(a),n.add(a=i)}),a.params.parent=n.encode(),f=A(a),(h||m)&&(a=n.add(Rn({legendMargin:n.config.legendMargin,mark:d,pulse:f})),n.operators.pop(),n.pushState(f,A(a)),h?En(e,n,i):jn(e,n,i),n.popState(),n.operators.push(a)),o=n.add(rn({mark:d,pulse:A(a)})),c=A(o),!g||h||m||(n.pushState(f,c),p===vt?jn(e,n,i):In(e,n),n.popState()),l=n.add(kn({pulse:c})),s=n.add(wn({pulse:c},void 0,n.parent())),null!=e.name&&(u=Qt(e.name),n.addData(u,new te(n,r,l,s)),e.on&&e.on.forEach(function(e){(e.insert||e.remove||e.toggle)&&t.error("Marks only support modify triggers."),Dn(e,n,u)}))},Fn=function(e,n){var a,i,r,o,l,s,u,d,f=e.type||"symbol",c=n.config.legend,p=e.encode||{},g=!!e.interactive,h=e.size||e.shape||e.fill||e.stroke||e.opacity;return h||t.error("Missing valid scale for legend."),a={orient:re(e.orient,c.orient),title:e.title},i=A(n.add(on(null,[a]))),s=P({update:{offset:$(re(e.offset,c.offset)),padding:$(re(e.padding,c.padding)),titlePadding:$(re(e.titlePadding,c.titlePadding))}},p.legend),u={update:{x:{field:{group:"padding"}},y:{field:{group:"padding"}},entryPadding:$(re(e.entryPadding,c.entryPadding))}},"gradient"===f?(r=A(n.add(pn({type:"gradient",scale:n.scaleRef(h),count:n.property(e.count),values:n.property(e.values),formatSpecifier:n.property(e.format)}))),d=[Ft(h,c,p.gradient),It(e,c,p.labels,r)]):(r=A(n.add(pn({size:oe(e,c,p.labels),scale:n.scaleRef(h),count:n.property(e.count),values:n.property(e.values),formatSpecifier:n.property(e.formatSpecifier)}))),d=[Ht(e,c,p.symbols,r),Jt(e,c,p.labels,r)]),d=[Yt($t,i,g,u,d)],a.title&&(l=Xt(e,c,p.title,i),u.update.y.offset={field:{group:"titlePadding"},offset:l.encode.update.fontSize||l.encode.enter.fontSize},d.push(l)),o=Yt(Ot,i,g,s,d),e.zindex&&(o.zindex=e.zindex),_n(o,n)},Cn=["identity","ordinal","band","point","index","linear","pow","sqrt","log","sequential","time","utc","quantize","quantile","threshold"],An=t.toSet(Cn),Wn=t.toSet(Cn.slice(1,5)),Ln=function(e,n){var a,i,r=e.type||"linear";An.hasOwnProperty(r)||t.error("Unrecognized scale type: "+r),a={type:r,domain:de(e.domain,e,n)},null!=e.range&&(null!=e.bandSize&&t.error("Scale range and bandSize are mutually exclusive."),a.range=ye(e,n));for(i in e)a[i]||"name"===i||(a[i]=ue(e[i],n));n.addScale(e.name,a)},Mn=function(e,n){var a=n.config,i=e.orient,r=i===Ct||i===Lt?a.axisX:a.axisY,o=a["axis"+i[0].toUpperCase()+i.slice(1)],l="band"===n.scaleType(e.scale)&&a.axisBand;return r||o||l?t.extend({},a.axis,r,o,l):a.axis},Un=function(e,t,n,a){var i,r,o=e.orient,l={value:0},s={};return s.enter=i={opacity:l,stroke:{value:t.tickColor},strokeWidth:{value:t.tickWidth}},s.exit={opacity:l},s.update=r={opacity:{value:1}},o===Ct||o===Lt?(i.y=l,r.x=i.x=Se(e,0),r.x2=i.x2=Se(e,1)):(i.x=l,r.y=i.y=Se(e,0),r.y2=i.y2=Se(e,1)),_t(qe,kt,null,a,s,n)},Vn=function(e,t,n,a){var i,r,o,l,s=e.orient,u=s===At||s===Ct?1:-1,d=u*e.offset||0,f={value:0},c={};return c.enter=i={opacity:f,stroke:{value:t.gridColor},strokeWidth:{value:t.gridWidth},strokeDash:{value:t.gridDash}},c.exit=r={opacity:f},c.update=o={opacity:{value:t.gridOpacity}},l={scale:e.scale,field:Bt,band:t.bandPosition,round:t.tickRound,extra:t.tickExtra},s===Ct||s===Lt?(i.y={value:d},o.y2=i.y2={signal:"height",mult:u,offset:d},o.x=i.x=r.x=l):(i.x={value:d},o.x2=i.x2={signal:"width",mult:u,offset:d},o.y=i.y=r.y=l),_t(qe,St,Bt,a,c,n)},qn=function(e,t,n,a){var i,r,o,l,s,u=e.orient,d=u===At||u===Ct?-1:1,f=null!=e.tickSize?e.tickSize:t.tickSize,c={value:0},p={};return p.enter=i={opacity:c,stroke:{value:t.tickColor},strokeWidth:{value:t.tickWidth}},p.exit=r={opacity:c},p.update=o={opacity:{value:1}},l=$(f),l.mult=d,s={scale:e.scale,field:Bt,band:t.bandPosition,round:t.tickRound,extra:t.tickExtra},u===Ct||u===Lt?(o.y=i.y=c,o.y2=i.y2=l,o.x=i.x=r.x=s):(o.x=i.x=c,o.x2=i.x2=l,o.y=i.y=r.y=s),_t(qe,Rt,Ut,a,p,n)},Tn=function(e,t,n,a){var i,r,o,l,s,u=e.orient,d=u===At||u===Ct?-1:1,f=null!=e.tickSize?e.tickSize:t.tickSize,c=null!=e.tickPadding?e.tickPadding:t.tickPadding,p={value:0},g={};return g.enter=i={opacity:p,fill:{value:t.tickLabelColor},font:{value:t.tickLabelFont},fontSize:{value:t.tickLabelFontSize},text:{field:Ut}},g.exit=r={opacity:p},g.update=o={opacity:{value:1}},l=$(f),l.mult=d,l.offset=$(c),l.offset.mult=d,s={scale:e.scale,field:Bt,band:.5},u===Ct||u===Lt?(o.y=i.y=l,o.x=i.x=r.x=s,o.align={value:"center"},o.baseline={value:u===Ct?"bottom":"top"}):(o.x=i.x=l,o.y=i.y=r.y=s,o.align={value:u===Wt?"left":"right"},o.baseline={value:"middle"}),_t(Be,wt,Ut,a,g,n)},Bn=function(e,t,n,a){var i,r,o=e.orient,l=o===At||o===Ct?-1:1,s=o===Ct||o===Lt,u={};return u.enter={opacity:{value:0},fill:{value:t.titleColor},font:{value:t.titleFont},fontSize:{value:t.titleFontSize},fontWeight:{value:t.titleFontWeight},align:{value:t.titleAlign}},u.exit={opacity:{value:0}},u.update=i={opacity:{value:1},text:{field:"title"}},r={scale:e.scale,range:.5},s?(i.x=r,i.angle={value:0},i.baseline={value:o===Ct?"bottom":"top"}):(i.y=r,i.angle={value:90*l},i.baseline={value:"bottom"}),null!=t.titleAngle&&(i.angle={value:t.titleAngle}),null!=t.titleBaseline&&(i.baseline={value:t.titleBaseline}),null!=t.titleX?i.x={value:t.titleX}:s&&!D(n,"x")&&(u.enter.auto={value:!0}),null!=t.titleY?i.y={value:t.titleY}:s||D(n,"y")||(u.enter.auto={value:!0}),_t(Be,zt,null,a,u,n)},Nn=function(e,t){var n,a,i,r,o,l,s=Mn(e,t),u=e.encode||{},d=!!e.interactive;return n={orient:e.orient,domain:null!=e.domain?!!e.domain:s.domainDefault,grid:null!=e.grid?!!e.grid:s.gridDefault,title:e.title},a=A(t.add(on({},[n]))),o=P({update:{range:{expr:'abs(span(range("'+e.scale+'")))'},offset:$(e.offset||0),position:$(e.position||0),titlePadding:$(e.titlePadding||s.titlePadding),minExtent:$(e.minExtent||s.minExtent),maxExtent:$(e.maxExtent||s.maxExtent)}},u.axis),i=A(t.add(an({scale:t.scaleRef(e.scale),extra:s.tickExtra,count:t.property(e.count),
values:t.property(e.values),formatSpecifier:t.property(e.format)}))),l=[qn(e,s,u.ticks,i),Tn(e,s,u.labels,i)],n.grid&&l.unshift(Vn(e,s,u.grid,i)),n.domain&&l.push(Un(e,s,u.domain,a)),n.title&&l.push(Bn(e,s,u.title,a)),r=Yt(xt,a,d,o,l),e.zindex&&(r.zindex=e.zindex),_n(r,t)},In=function(e,n,a){var i=t.array(e.signals);return a||i.forEach(function(e){Pe(e,n)}),t.array(e.projections).forEach(function(e){rt(e,n)}),t.array(e.data).forEach(function(e){be(e,n)}),t.array(e.scales).forEach(function(e){Ln(e,n)}),i.forEach(function(e){it(e,n)}),n.parseLambdas(),t.array(e.axes).forEach(function(e){Nn(e,n)}),t.array(e.marks).forEach(function(e){_n(e,n)}),t.array(e.legends).forEach(function(e){Fn(e,n)}),n},Jn=t.toSet(["width","height","padding"]),Hn=Re.prototype=ze.prototype;Hn.fork=function(){return new ze(this)},Hn.toRuntime=function(){return this.finish(),{background:this.background,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings}},Hn.id=function(){return(this._subid?this._subid+":":0)+this._id++},Hn.add=function(e){return this.operators.push(e),e.id=this.id(),e},Hn.addStream=function(e){return this.streams.push(e),e.id=this.id(),e},Hn.addUpdate=function(e){return this.updates.push(e),e},Hn.finish=function(){function e(e,t,n){var a,i;e&&(a=e.data||(e.data={}),i=a[t]||(a[t]=[]),i.push(n))}var t,n;this.root&&(this.root.root=!0);for(t in this.signals)this.signals[t].signal=t;for(t in this.scales)this.scales[t].scale=t;for(t in this.data){n=this.data[t],e(n.input,t,"input"),e(n.output,t,"output"),e(n.values,t,"values");for(var a in n.index)e(n.index[a],t,"index:"+a)}return this},Hn.pushState=function(e,t){this._encode.push(A(this.add(wn({pulse:e})))),this._parent.push(t),this._markpath.push(-1)},Hn.popState=function(){this._parent.pop(),this._encode.pop(),this._markpath.pop()},Hn.parent=function(){return t.peek(this._parent)},Hn.encode=function(){return t.peek(this._encode)},Hn.markpath=function(){var e=this._markpath;return++e[e.length-1],e.slice()},Hn.fieldRef=function(e,n){if(t.isString(e))return W(e,n);e.signal||t.error("Unsupported field reference: "+JSON.stringify(e));var a,i=e.signal,r=this.field[i];return r||(a={name:this.signalRef(i)},n&&(a.as=n),this.field[i]=r=A(this.add(fn(a)))),r},Hn.compareRef=function(e){function n(e){return q(e)?(i=!0,A(a[e.signal])):e}var a=this.signals,i=!1,r=t.array(e.field).map(n),o=t.array(e.order).map(n);return i?A(this.add(ln({fields:r,orders:o}))):L(r,o)},Hn.keyRef=function(e){function n(e){return q(e)?(i=!0,A(a[e.signal])):e}var a=this.signals,i=!1;return e=t.array(e).map(n),i?A(this.add(cn({fields:e}))):M(e)},Hn.sortRef=function(e){if(!e)return e;var t=[V(e.op,e.field),"_id"],n=e.order||en;return n.signal?A(this.add(ln({fields:t,orders:[n=this.signalRef(n.signal),n]}))):L(t,[n,n])},Hn.event=function(e,t){var n=e+":"+t;if(!this.events[n]){var a=this.id();this.streams.push({id:a,source:e,type:t}),this.events[n]=a}return this.events[n]},Hn.addSignal=function(e,n){this.signals.hasOwnProperty(e)&&t.error("Duplicate signal name: "+e);var a=n instanceof _?n:this.add(C(n));return this.signals[e]=a},Hn.getSignal=function(e){return this.signals[e]||t.error("Unrecognized signal name: "+e),this.signals[e]},Hn.signalRef=function(e){return this.signals[e]?A(this.signals[e]):(this.lambdas[e]||(this.lambdas[e]=this.add(C(null))),A(this.lambdas[e]))},Hn.parseLambdas=function(){for(var e=Object.keys(this.lambdas),t=0,n=e.length;t<n;++t){var a=e[t],i=Me(a,this),r=this.lambdas[a];r.params=i.$params,r.update=i.$expr}},Hn.property=function(e){return e&&e.signal?this.signalRef(e.signal):e},Hn.addBinding=function(e,n){this.bindings||t.error("Nested signals do not support binding."),this.bindings.push(t.extend({signal:e},n))},Hn.addScaleProj=function(e,n){this.scales.hasOwnProperty(e)&&t.error("Duplicate scale or projection name: "+e),this.scales[e]=this.add(n)},Hn.addScale=function(e,t){this.addScaleProj(e,Sn(t))},Hn.addProjection=function(e,t){this.addScaleProj(e,bn(t))},Hn.getScale=function(e){return this.scales[e]||t.error("Unrecognized scale name: "+e),this.scales[e]},Hn.projectionRef=Hn.scaleRef=function(e){return A(this.getScale(e))},Hn.projectionType=Hn.scaleType=function(e){return this.getScale(e).params.type},Hn.addData=function(e,n){this.data.hasOwnProperty(e)&&t.error("Duplicate data set name: "+e),this.data[e]=n},Hn.getData=function(e){return this.data[e]||t.error("Undefined data set name: "+e),this.data[e]},Hn.addDataPipeline=function(e,n){this.data.hasOwnProperty(e)&&t.error("Duplicate data set name: "+e),this.addData(e,te.fromEntries(this,n))};var Xn=function(e){var n,a=Oe();for(n in e)a[n]=t.isObject(a[n])?t.extend(a[n],e[n]):a[n]=e[n];return a},Yn=function(e,t){return we(e,new Re(Xn(t||e.config))).toRuntime()};e.parse=Yn,e.selector=Ie,e.signal=Pe,e.signalUpdates=it,e.stream=tt,e.MarkRole=vt,e.FrameRole=yt,e.ScopeRole=bt,e.AxisRole=xt,e.AxisDomainRole=kt,e.AxisGridRole=St,e.AxisLabelRole=wt,e.AxisTickRole=Rt,e.AxisTitleRole=zt,e.LegendRole=Ot,e.LegendEntryRole=$t,e.LegendLabelRole=Et,e.LegendSymbolRole=jt,e.LegendTitleRole=Dt,e.marktypes=Ne,e.isMarkType=u,e.Scope=Re,e.DataScope=te,Object.defineProperty(e,"__esModule",{value:!0})});

@@ -234,6 +234,2 @@ (function (global, factory) {

{
"$ref": "#/refs/expr",
"required": ["expr"]
},
{
"properties": {"value": {}},

@@ -240,0 +236,0 @@ "required": ["value"]

{
"name": "vega-parser",
"version": "1.0.0-beta.2",
"version": "1.0.0-beta.3",
"description": "Parse Vega specifications to runtime dataflows.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -21,6 +21,2 @@ import {isArray} from 'vega-util';

{
"$ref": "#/refs/expr",
"required": ["expr"]
},
{
"properties": {"value": {}},

@@ -27,0 +23,0 @@ "required": ["value"]

import color from './color';
import field from './field';
import scale from './scale';
import signal from './signal';
import gradient from './gradient';

@@ -17,4 +16,3 @@ import property from './property';

: (enc.field != null) ? field(enc.field, scope, params, fields)
: (enc.signal != null) ? signal(enc.signal, scope, params)
: (enc.expr != null) ? expression(enc.expr, scope, params, fields)
: (enc.signal != null) ? expression(enc.signal, scope, params, fields)
: (enc.value != null) ? stringValue(enc.value)

@@ -21,0 +19,0 @@ : null;

@@ -1,2 +0,2 @@

import signal from './signal';
import expression from './expression';
import {error, isString, isObject, splitAccessPath, stringValue} from 'vega-util';

@@ -13,3 +13,3 @@

object = 'datum';
field = signal(ref.signal, scope, params);
field = expression(ref.signal, scope, params, fields);
} else if (ref.group || ref.parent) {

@@ -16,0 +16,0 @@ level = Math.max(1, ref.level || 1);

@@ -88,3 +88,3 @@ import {

var signalName = signalPrefix + name;
if (!params.hasOwnProperty(signalName)) {
if (!params.hasOwnProperty(signalName) && scope.getSignal(name)) {
params[signalName] = scope.signalRef(name);

@@ -91,0 +91,0 @@ }

@@ -33,2 +33,3 @@ import parseSignalUpdates from './signal-updates';

});
scope.parseLambdas();

@@ -35,0 +36,0 @@ array(spec.axes).forEach(function(_) {

@@ -16,2 +16,3 @@ import DataScope from './DataScope';

this.signals = {};
this.lambdas = {};
this.scales = {};

@@ -40,2 +41,3 @@ this.events = {};

this.signals = Object.create(scope.signals);
this.lambdas = Object.create(scope.lambdas);
this.scales = Object.create(scope.scales);

@@ -162,18 +164,12 @@ this.events = Object.create(scope.events);

if (isString(field)) return fieldRef(field, name);
if (!field.signal && !field.expr) {
if (!field.signal) {
error('Unsupported field reference: ' + JSON.stringify(field));
}
var f = this.field[field.signal || field.expr],
params, s, e, op;
var s = field.signal,
f = this.field[s],
params;
if (!f) {
if (field.expr) {
e = parseExpression(s = field.expr, this);
op = this.add(operator(null, e.$params));
op.update = e.$expr;
params = {name: ref(op)};
} else {
params = {name: ref(this.signals[s = field.signal])};
}
if (!f) { // TODO: replace with update signalRef?
params = {name: this.signalRef(s)}
if (name) params.as = name;

@@ -263,6 +259,22 @@ this.field[s] = f = ref(this.add(Field(params)));

prototype.signalRef = function(name) {
return ref(this.getSignal(name));
prototype.signalRef = function(s) {
if (this.signals[s]) {
return ref(this.signals[s]);
} else if (!this.lambdas[s]) {
this.lambdas[s] = this.add(operator(null));
}
return ref(this.lambdas[s]);
};
prototype.parseLambdas = function() {
var code = Object.keys(this.lambdas);
for (var i=0, n=code.length; i<n; ++i) {
var s = code[i],
e = parseExpression(s, this),
op = this.lambdas[s];
op.params = e.$params;
op.update = e.$expr;
}
};
prototype.property = function(spec) {

@@ -269,0 +281,0 @@ return spec && spec.signal ? this.signalRef(spec.signal) : spec;

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc