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.16 to 1.0.0-beta.17

2

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

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

"vega-expression": "2",
"vega-scale": ">=1.1",
"vega-scale": "^1.1",
"vega-scenegraph": ">=2.0.0-beta",
"vega-util": "1"
"vega-util": "^1.1"
},

@@ -43,0 +43,0 @@ "devDependencies": {

@@ -84,210 +84,212 @@ import {ASTNode, functions, constants} from 'vega-expression';

monthFormat: function(month) {
return _time(month, 1, '%B');
},
return _time(month, 1, '%B');
},
monthAbbrevFormat: function(month) {
return _time(month, 1, '%b');
},
return _time(month, 1, '%b');
},
dayFormat: function(day) {
return _time(0, 2 + day, '%A');
},
return _time(0, 2 + day, '%A');
},
dayAbbrevFormat: function(day) {
return _time(0, 2 + day, '%a');
},
return _time(0, 2 + day, '%a');
},
quarter: function(date) {
return 1 + ~~(new Date(date).getMonth() / 3);
},
return 1 + ~~(new Date(date).getMonth() / 3);
},
utcquarter: function(date) {
return 1 + ~~(new Date(date).getUTCMonth() / 3);
},
return 1 + ~~(new Date(date).getUTCMonth() / 3);
},
warn: function() {
return log(this.context.dataflow, 'warn', arguments);
},
return log(this.context.dataflow, 'warn', arguments);
},
info: function() {
return log(this.context.dataflow, 'info', arguments);
},
return log(this.context.dataflow, 'info', arguments);
},
debug: function() {
return log(this.context.dataflow, 'debug', arguments);
},
return log(this.context.dataflow, 'debug', arguments);
},
inScope: function(item) {
var group = this.context.group,
value = false;
var group = this.context.group,
value = false;
if (group) while (item) {
if (item === group) { value = true; break; }
item = item.mark.group;
}
return value;
},
if (group) while (item) {
if (item === group) { value = true; break; }
item = item.mark.group;
}
return value;
},
clampRange: function(range, min, max) {
var lo = range[0],
hi = range[1],
span;
var lo = range[0],
hi = range[1],
span;
if (hi < lo) span = hi, hi = lo, lo = span;
span = hi - lo;
if (hi < lo) span = hi, hi = lo, lo = span;
span = hi - lo;
return [
Math.min(Math.max(lo, min), max - span),
Math.min(Math.max(hi, span), max)
];
},
return [
Math.min(Math.max(lo, min), max - span),
Math.min(Math.max(hi, span), max)
];
},
pinchDistance: function() {
return 'Math.sqrt('
+ 'Math.pow(event.touches[0].clientX - event.touches[1].clientX, 2) + '
+ 'Math.pow(event.touches[0].clientY - event.touches[1].clientY, 2)'
+ ')';
},
return 'Math.sqrt('
+ 'Math.pow(event.touches[0].clientX - event.touches[1].clientX, 2) + '
+ 'Math.pow(event.touches[0].clientY - event.touches[1].clientY, 2)'
+ ')';
},
pinchAngle: function() {
return 'Math.atan2('
+ 'event.touches[1].clientY - event.touches[0].clientY,'
+ 'event.touches[1].clientX - event.touches[0].clientX'
+ ')';
},
return 'Math.atan2('
+ 'event.touches[1].clientY - event.touches[0].clientY,'
+ 'event.touches[1].clientX - event.touches[0].clientX'
+ ')';
},
open: function(uri, name) {
var df = this.context.dataflow;
if (_window && _window.open) {
df.loader().sanitize(uri, {context:'open', name:name})
.then(function(url) { _window.open(url, name); })
.catch(function(e) { df.warn('Open url failed: ' + e); });
} else {
df.warn('Open function can only be invoked in a browser.');
}
},
var df = this.context.dataflow;
if (_window && _window.open) {
df.loader().sanitize(uri, {context:'open', name:name})
.then(function(url) { _window.open(url, name); })
.catch(function(e) { df.warn('Open url failed: ' + e); });
} else {
df.warn('Open function can only be invoked in a browser.');
}
},
screen: function() {
return _window ? _window.screen : {};
},
return _window ? _window.screen : {};
},
windowsize: function() {
return _window
? [_window.innerWidth, _window.innerHeight]
: [undefined, undefined];
},
return _window
? [_window.innerWidth, _window.innerHeight]
: [undefined, undefined];
},
span: function(array) { return array[array.length-1] - array[0]; },
span: function(array) {
return array[array.length-1] - array[0];
},
range: function(name, group) {
var s = getScale(name, (group || this).context);
return s && s.range ? s.range() : [0, 0];
},
var s = getScale(name, (group || this).context);
return s && s.range ? s.range() : [0, 0];
},
domain: function(name, group) {
var s = getScale(name, (group || this).context);
return s ? s.domain() : [];
},
var s = getScale(name, (group || this).context);
return s ? s.domain() : [];
},
bandwidth: function(name, group) {
var s = getScale(name, (group || this).context);
return s && s.bandwidth ? s.bandwidth() : 0;
},
var s = getScale(name, (group || this).context);
return s && s.bandwidth ? s.bandwidth() : 0;
},
bandspace: function(count, paddingInner, paddingOuter) {
return bandSpace(count || 0, paddingInner || 0, paddingOuter || 0);
},
return bandSpace(count || 0, paddingInner || 0, paddingOuter || 0);
},
copy: function(name, group) {
var s = getScale(name, (group || this).context);
return s ? s.copy() : undefined;
},
var s = getScale(name, (group || this).context);
return s ? s.copy() : undefined;
},
scale: function(name, value, group) {
var s = getScale(name, (group || this).context);
return s ? s(value) : undefined;
},
var s = getScale(name, (group || this).context);
return s ? s(value) : undefined;
},
invert: function(name, range, group) {
var s = getScale(name, (group || this).context);
return !s ? undefined
: isArray(range) ? (s.invertRange || s.invert)(range)
: (s.invert || s.invertExtent)(range);
},
var s = getScale(name, (group || this).context);
return !s ? undefined
: isArray(range) ? (s.invertRange || s.invert)(range)
: (s.invert || s.invertExtent)(range);
},
tuples: function(name) {
var data = this.context.data[name];
return data ? data.values.value : [];
},
var data = this.context.data[name];
return data ? data.values.value : [];
},
indata: function(name, field, value) {
var index = this.context.data[name]['index:' + field],
entry = index ? index.value[value] : undefined;
return entry ? entry.count : entry;
},
var index = this.context.data[name]['index:' + field],
entry = index ? index.value.get(value) : undefined;
return entry ? entry.count : entry;
},
inrange: function(value, range) {
var r0 = range[0], r1 = range[range.length-1], t;
if (r0 > r1) t = r0, r0 = r1, r1 = t;
return r0 <= value && value <= r1;
},
var r0 = range[0], r1 = range[range.length-1], t;
if (r0 > r1) t = r0, r0 = r1, r1 = t;
return r0 <= value && value <= r1;
},
encode: function(item, name, retval) {
if (item) {
var df = this.context.dataflow,
target = item.mark.source;
df.pulse(target, df.changeset().encode(item, name));
}
return retval !== undefined ? retval : item;
},
if (item) {
var df = this.context.dataflow,
target = item.mark.source;
df.pulse(target, df.changeset().encode(item, name));
}
return retval !== undefined ? retval : item;
},
modify: function(name, insert, remove, toggle, modify, values) {
var df = this.context.dataflow,
data = this.context.data[name],
input = data.input,
changes = data.changes,
stamp = df.stamp(),
predicate, key;
var df = this.context.dataflow,
data = this.context.data[name],
input = data.input,
changes = data.changes,
stamp = df.stamp(),
predicate, key;
if (!(input.value.length || insert || toggle)) {
// nothing to do!
return 0;
}
if (!(input.value.length || insert || toggle)) {
// nothing to do!
return 0;
}
if (!changes || changes.stamp < stamp) {
data.changes = (changes = df.changeset());
changes.stamp = stamp;
df.runAfter(function() {
df.pulse(input, changes).run();
});
}
if (!changes || changes.stamp < stamp) {
data.changes = (changes = df.changeset());
changes.stamp = stamp;
df.runAfter(function() {
df.pulse(input, changes).run();
});
}
if (remove) {
predicate = remove === true ? truthy
: (isArray(remove) || remove._id != null) ? remove
: removePredicate(remove);
changes.remove(predicate);
}
if (remove) {
predicate = remove === true ? truthy
: (isArray(remove) || remove._id != null) ? remove
: removePredicate(remove);
changes.remove(predicate);
}
if (insert) {
changes.insert(insert);
}
if (insert) {
changes.insert(insert);
}
if (toggle) {
predicate = removePredicate(toggle);
if (input.value.filter(predicate).length) {
changes.remove(predicate);
} else {
changes.insert(toggle);
}
if (toggle) {
predicate = removePredicate(toggle);
if (input.value.filter(predicate).length) {
changes.remove(predicate);
} else {
changes.insert(toggle);
}
}
if (modify) {
for (key in values) {
changes.modify(modify, key, values[key]);
}
if (modify) {
for (key in values) {
changes.modify(modify, key, values[key]);
}
}
return 1;
}
return 1;
}
};

@@ -294,0 +296,0 @@

@@ -30,3 +30,7 @@ import definition from './marks/definition';

// data join to map tuples to visual items
op = scope.add(DataJoin(input));
op = scope.add(DataJoin({
key: input.key,
pulse: input.pulse,
clean: !group
}));

@@ -33,0 +37,0 @@ // collect visual items

@@ -47,3 +47,7 @@ import dataName from './data-name';

return {key: key, pulse: dataRef, parent: parent};
return {
key: key,
pulse: dataRef,
parent: parent
};
}

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