vega-parser
Advanced tools
Comparing version 6.2.1 to 6.3.0
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-util"),require("vega-functions"),require("vega-event-selector"),require("vega-scale"),require("vega-dataflow")):"function"==typeof define&&define.amd?define(["exports","vega-util","vega-functions","vega-event-selector","vega-scale","vega-dataflow"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).vega={},e.vega,e.vega,e.vega,e.vega,e.vega)}(this,(function(e,t,n,i,a,r){"use strict";function s(e){return t.isObject(e)?e:{type:e||"pad"}}const l=e=>+e||0,o=e=>({top:e,bottom:e,left:e,right:e});function u(e){return t.isObject(e)?e.signal?e:{top:l(e.top),bottom:l(e.bottom),left:l(e.left),right:l(e.right)}:o(l(e))}const c=e=>t.isObject(e)&&!t.isArray(e)?t.extend({},e):{value:e};function d(e,n,i,a){if(null!=i){return t.isObject(i)&&!t.isArray(i)||t.isArray(i)&&i.length&&t.isObject(i[0])?e.update[n]=i:e[a||"enter"][n]={value:i},1}return 0}function p(e,t,n){for(const n in t)d(e,n,t[n]);for(const t in n)d(e,t,n[t],"update")}function f(e,n,i){for(const a in n)i&&t.hasOwnProperty(i,a)||(e[a]=t.extend(e[a]||{},n[a]));return e}function g(e,t){return t&&(t.enter&&t.enter[e]||t.update&&t.update[e])}const m="mark",h="frame",y="scope",b="axis",x="axis-domain",k="axis-grid",v="axis-label",$="axis-tick",S="axis-title",O="legend",R="legend-band",j="legend-entry",w="legend-gradient",z="legend-label",D="legend-symbol",V="legend-title",E="title",P="title-text",C="title-subtitle";function W(e,t,n){e[t]=n&&n.signal?{signal:n.signal}:{value:n}}const _=e=>t.isString(e)?t.stringValue(e):e.signal?`(${e.signal})`:T(e);function L(e){if(null!=e.gradient)return function(e){const n=[e.start,e.stop,e.count].map((e=>null==e?null:t.stringValue(e)));for(;n.length&&null==t.peek(n);)n.pop();return n.unshift(_(e.gradient)),`gradient(${n.join(",")})`}(e);let n=e.signal?`(${e.signal})`:e.color?function(e){return e.c?F("hcl",e.h,e.c,e.l):e.h||e.s?F("hsl",e.h,e.s,e.l):e.l||e.a?F("lab",e.l,e.a,e.b):e.r||e.g||e.b?F("rgb",e.r,e.g,e.b):null}(e.color):null!=e.field?T(e.field):void 0!==e.value?t.stringValue(e.value):void 0;return null!=e.scale&&(n=function(e,t){const n=_(e.scale);null!=e.range?t=`lerp(_range(${n}), ${+e.range})`:(void 0!==t&&(t=`_scale(${n}, ${t})`),e.band&&(t=(t?t+"+":"")+`_bandwidth(${n})`+(1==+e.band?"":"*"+A(e.band)),e.extra&&(t=`(datum.extra ? _scale(${n}, datum.extra.value) : ${t})`)),null==t&&(t="0"));return t}(e,n)),void 0===n&&(n=null),null!=e.exponent&&(n=`pow(${n},${A(e.exponent)})`),null!=e.mult&&(n+=`*${A(e.mult)}`),null!=e.offset&&(n+=`+${A(e.offset)}`),e.round&&(n=`round(${n})`),n}const F=(e,t,n,i)=>`(${e}(${[t,n,i].map(L).join(",")})+'')`;function A(e){return t.isObject(e)?"("+L(e)+")":e}function T(e){return B(t.isObject(e)?e:{datum:e})}function B(e){let n,i,a;if(e.signal)n="datum",a=e.signal;else if(e.group||e.parent){for(i=Math.max(1,e.level||1),n="item";i-- >0;)n+=".mark.group";e.parent?(a=e.parent,n+=".datum"):a=e.group}else e.datum?(n="datum",a=e.datum):t.error("Invalid field reference: "+t.stringValue(e));return e.signal||(a=t.isString(a)?t.splitAccessPath(a).map(t.stringValue).join("]["):B(a)),n+"["+a+"]"}function U(e,n,i,a,r,s){const l={};(s=s||{}).encoders={$encode:l},e=function(e,n,i,a,r){const s={},l={};let o,u,c,d;for(u in u="lineBreak","text"!==n||null==r[u]||g(u,e)||W(s,u,r[u]),("legend"==i||String(i).startsWith("axis"))&&(i=null),d=i===h?r.group:i===m?t.extend({},r.mark,r[n]):null,d)c=g(u,e)||("fill"===u||"stroke"===u)&&(g("fill",e)||g("stroke",e)),c||W(s,u,d[u]);for(u in t.array(a).forEach((t=>{const n=r.style&&r.style[t];for(const t in n)g(t,e)||W(s,t,n[t])})),e=t.extend({},e),s)d=s[u],d.signal?(o=o||{})[u]=d:l[u]=d;return e.enter=t.extend(l,e.enter),o&&(e.update=t.extend(o,e.update)),e}(e,n,i,a,r.config);for(const t in e)l[t]=M(e[t],n,s,r);return s}function M(e,n,i,a){const r={},s={};for(const n in e)null!=e[n]&&(r[n]=q((l=e[n],t.isArray(l)?function(e){let n="";return e.forEach((e=>{const t=L(e);n+=e.test?`(${e.test})?${t}:`:t})),":"===t.peek(n)&&(n+="null"),n}(l):L(l)),a,i,s));var l;return{$expr:{marktype:n,channels:r},$fields:Object.keys(s),$output:Object.keys(e)}}function q(e,i,a,r){const s=n.parseExpression(e,i);return s.$fields.forEach((e=>r[e]=1)),t.extend(a,s.$params),s.$expr}const H="outer",I=["value","update","init","react","bind"];function X(e,n){t.error(e+' for "outer" push: '+t.stringValue(n))}function Y(e,t){const n=e.name;if(e.push===H)t.signals[n]||X("No prior signal definition",n),I.forEach((t=>{void 0!==e[t]&&X("Invalid property ",t)}));else{const i=t.addSignal(n,e.value);!1===e.react&&(i.react=!1),e.bind&&t.addBinding(n,e.bind)}}function N(e,t,n,i){this.id=-1,this.type=e,this.value=t,this.params=n,i&&(this.parent=i)}function G(e,t,n,i){return new N(e,t,n,i)}function Q(e,t){return G("operator",e,t)}function J(e){const t={$ref:e.id};return e.id<0&&(e.refs=e.refs||[]).push(t),t}function K(e,t){return t?{$field:e,$name:t}:{$field:e}}const Z=K("key");function ee(e,t){return{$compare:e,$order:t}}const te="descending";function ne(e,t){return(e&&e.signal?"$"+e.signal:e||"")+(e&&t?"_":"")+(t&&t.signal?"$"+t.signal:t||"")}const ie="scope",ae="view";function re(e){return e&&e.signal}function se(e){if(re(e))return!0;if(t.isObject(e))for(const t in e)if(se(e[t]))return!0;return!1}function le(e,t){return null!=e?e:t}function oe(e){return e&&e.signal||e}const ue="timer";function ce(e,n){return(e.merge?de:e.stream?pe:e.type?fe:t.error("Invalid stream specification: "+t.stringValue(e)))(e,n)}function de(e,t){const n=ge({merge:e.merge.map((e=>ce(e,t)))},e,t);return t.addStream(n).id}function pe(e,t){const n=ge({stream:ce(e.stream,t)},e,t);return t.addStream(n).id}function fe(e,t){let n;var i;e.type===ue?(n=t.event(ue,e.throttle),e={between:e.between,filter:e.filter}):n=t.event((i=e.source)===ie?ae:i||ae,e.type);const a=ge({stream:n},e,t);return 1===Object.keys(a).length?n:t.addStream(a).id}function ge(e,i,a){let r=i.between;return r&&(2!==r.length&&t.error('Stream "between" parameter must have 2 entries: '+t.stringValue(i)),e.between=[ce(r[0],a),ce(r[1],a)]),r=i.filter?[].concat(i.filter):[],(i.marktype||i.markname||i.markrole)&&r.push(function(e,t,n){const i="event.item";return i+(e&&"*"!==e?"&&"+i+".mark.marktype==='"+e+"'":"")+(n?"&&"+i+".mark.role==='"+n+"'":"")+(t?"&&"+i+".mark.name==='"+t+"'":"")}(i.marktype,i.markname,i.markrole)),i.source===ie&&r.push("inScope(event.item)"),r.length&&(e.filter=n.parseExpression("("+r.join(")&&(")+")",a).$expr),null!=(r=i.throttle)&&(e.throttle=+r),null!=(r=i.debounce)&&(e.debounce=+r),i.consume&&(e.consume=!0),e}const me={code:"_.$value",ast:{type:"Identifier",value:"value"}};function he(e,a,r){const s=e.encode,l={target:r};let o=e.events,u=e.update,c=[];o||t.error("Signal update missing events specification."),t.isString(o)&&(o=i.parseSelector(o,a.isSubscope()?ie:ae)),o=t.array(o).filter((e=>e.signal||e.scale?(c.push(e),0):1)),c.length>1&&(c=[ye(c)]),o.length&&c.push(o.length>1?{merge:o}:o[0]),null!=s&&(u&&t.error("Signal encode and update are mutually exclusive."),u="encode(item(),"+t.stringValue(s)+")"),l.update=t.isString(u)?n.parseExpression(u,a):null!=u.expr?n.parseExpression(u.expr,a):null!=u.value?u.value:null!=u.signal?{$expr:me,$params:{$value:a.signalRef(u.signal)}}:t.error("Invalid signal update specification."),e.force&&(l.options={force:!0}),c.forEach((e=>a.addUpdate(t.extend(function(e,t){return{source:e.signal?t.signalRef(e.signal):e.scale?t.scaleRef(e.scale):ce(e,t)}}(e,a),l))))}function ye(e){return{signal:"["+e.map((e=>e.scale?'scale("'+e.scale+'")':e.signal))+"]"}}function be(e,i){const a=i.getSignal(e.name);let r=e.update;e.init&&(r?t.error("Signals can not include both init and update expressions."):(r=e.init,a.initonly=!0)),r&&(r=n.parseExpression(r,i),a.update=r.$expr,a.params=r.$params),e.on&&e.on.forEach((e=>he(e,i,a.id)))}const xe=e=>(t,n,i)=>G(e,n,t||void 0,i),ke=xe("aggregate"),ve=xe("axisticks"),$e=xe("bound"),Se=xe("collect"),Oe=xe("compare"),Re=xe("datajoin"),je=xe("encode"),we=xe("expression"),ze=xe("facet"),De=xe("field"),Ve=xe("key"),Ee=xe("legendentries"),Pe=xe("load"),Ce=xe("mark"),We=xe("multiextent"),_e=xe("multivalues"),Le=xe("overlap"),Fe=xe("params"),Ae=xe("prefacet"),Te=xe("projection"),Be=xe("proxy"),Ue=xe("relay"),Me=xe("render"),qe=xe("scale"),He=xe("sieve"),Ie=xe("sortitems"),Xe=xe("viewlayout"),Ye=xe("values");let Ne=0;const Ge={min:"min",max:"max",count:"sum"};function Qe(e,n){const i=n.getScale(e.name).params;let a;var r;for(a in i.domain=et(e.domain,e,n),null!=e.range&&(i.range=ot(e,n,i)),null!=e.interpolate&&function(e,t){t.interpolate=Je(e.type||e),null!=e.gamma&&(t.interpolateGamma=Je(e.gamma))}(e.interpolate,i),null!=e.nice&&(i.nice=(r=e.nice,t.isObject(r)?{interval:Je(r.interval),step:Je(r.step)}:Je(r))),null!=e.bins&&(i.bins=function(e,n){return e.signal||t.isArray(e)?Ke(e,n):n.objectProperty(e)}(e.bins,n)),e)t.hasOwnProperty(i,a)||"name"===a||(i[a]=Je(e[a],n))}function Je(e,n){return t.isObject(e)?e.signal?n.signalRef(e.signal):t.error("Unsupported object: "+t.stringValue(e)):e}function Ke(e,t){return e.signal?t.signalRef(e.signal):e.map((e=>Je(e,t)))}function Ze(e){t.error("Can not find data set: "+t.stringValue(e))}function et(e,n,i){if(e)return e.signal?i.signalRef(e.signal):(t.isArray(e)?tt:e.fields?it:nt)(e,n,i);null==n.domainMin&&null==n.domainMax||t.error("No scale domain defined for domainMin/domainMax to override.")}function tt(e,t,n){return e.map((e=>Je(e,n)))}function nt(e,t,n){const i=n.getData(e.data);return i||Ze(e.data),a.isDiscrete(t.type)?i.valuesRef(n,e.field,rt(e.sort,!1)):a.isQuantile(t.type)?i.domainRef(n,e.field):i.extentRef(n,e.field)}function it(e,n,i){const r=e.data,s=e.fields.reduce(((e,n)=>(n=t.isString(n)?{data:r,field:n}:t.isArray(n)||n.signal?function(e,n){const i="_:vega:_"+Ne++,a=Se({});if(t.isArray(e))a.value={$ingest:e};else if(e.signal){const r="setdata("+t.stringValue(i)+","+e.signal+")";a.params.input=n.signalRef(r)}return n.addDataPipeline(i,[a,He({})]),{data:i,field:"data"}}(n,i):n,e.push(n),e)),[]);return(a.isDiscrete(n.type)?at:a.isQuantile(n.type)?st:lt)(e,i,s)}function at(e,t,n){const i=rt(e.sort,!0);let a,r;const s=n.map((e=>{const n=t.getData(e.data);return n||Ze(e.data),n.countsRef(t,e.field,i)})),l={groupby:Z,pulse:s};i&&(a=i.op||"count",r=i.field?ne(a,i.field):"count",l.ops=[Ge[a]],l.fields=[t.fieldRef(r)],l.as=[r]),a=t.add(ke(l));const o=t.add(Se({pulse:J(a)}));return r=t.add(Ye({field:Z,sort:t.sortRef(i),pulse:J(o)})),J(r)}function rt(e,n){return e&&(e.field||e.op?e.field||"count"===e.op?n&&e.field&&e.op&&!Ge[e.op]&&t.error("Multiple domain scales can not be sorted using "+e.op):t.error("No field provided for sort aggregate op: "+e.op):t.isObject(e)?e.field="key":e={field:"key"}),e}function st(e,t,n){const i=n.map((e=>{const n=t.getData(e.data);return n||Ze(e.data),n.domainRef(t,e.field)}));return J(t.add(_e({values:i})))}function lt(e,t,n){const i=n.map((e=>{const n=t.getData(e.data);return n||Ze(e.data),n.extentRef(t,e.field)}));return J(t.add(We({extents:i})))}function ot(e,n,i){const r=n.config.range;let s=e.range;if(s.signal)return n.signalRef(s.signal);if(t.isString(s)){if(r&&t.hasOwnProperty(r,s))return ot(e=t.extend({},e,{range:r[s]}),n,i);"width"===s?s=[0,{signal:"width"}]:"height"===s?s=a.isDiscrete(e.type)?[0,{signal:"height"}]:[{signal:"height"},0]:t.error("Unrecognized scale range value: "+t.stringValue(s))}else{if(s.scheme)return i.scheme=t.isArray(s.scheme)?Ke(s.scheme,n):Je(s.scheme,n),s.extent&&(i.schemeExtent=Ke(s.extent,n)),void(s.count&&(i.schemeCount=Je(s.count,n)));if(s.step)return void(i.rangeStep=Je(s.step,n));if(a.isDiscrete(e.type)&&!t.isArray(s))return et(s,e,n);t.isArray(s)||t.error("Unsupported range type: "+t.stringValue(s))}return s.map((e=>(t.isArray(e)?Ke:Je)(e,n)))}function ut(e,n,i){return t.isArray(e)?e.map((e=>ut(e,n,i))):t.isObject(e)?e.signal?i.signalRef(e.signal):"fit"===n?e:t.error("Unsupported parameter object: "+t.stringValue(e)):e}const ct="top",dt="left",pt="right",ft="bottom",gt="center",mt="vertical",ht="start",yt="end",bt="index",xt="label",kt="offset",vt="perc",$t="perc2",St="value",Ot="guide-label",Rt="guide-title",jt="group-title",wt="group-subtitle",zt="symbol",Dt="gradient",Vt="discrete",Et="size",Pt=[Et,"shape","fill","stroke","strokeWidth","strokeDash","opacity"],Ct={name:1,style:1,interactive:1},Wt={value:0},_t={value:1},Lt="group",Ft="rect",At="rule",Tt="symbol",Bt="text";function Ut(e){return e.type=Lt,e.interactive=e.interactive||!1,e}function Mt(e,t){const n=(n,i)=>le(e[n],le(t[n],i));return n.isVertical=n=>mt===le(e.direction,t.direction||(n?t.symbolDirection:t.gradientDirection)),n.gradientLength=()=>le(e.gradientLength,t.gradientLength||t.gradientWidth),n.gradientThickness=()=>le(e.gradientThickness,t.gradientThickness||t.gradientHeight),n.entryColumns=()=>le(e.columns,le(t.columns,+n.isVertical(!0))),n}function qt(e,t){const n=t&&(t.update&&t.update[e]||t.enter&&t.enter[e]);return n&&n.signal?n:n?n.value:null}function Ht(e,t,n){return`item.anchor === '${ht}' ? ${e} : item.anchor === '${yt}' ? ${t} : ${n}`}const It=Ht(t.stringValue(dt),t.stringValue(pt),t.stringValue(gt));function Xt(e,n){return n?e?t.isObject(e)?Object.assign({},e,{offset:Xt(e.offset,n)}):{value:e,offset:n}:n:e}function Yt(e,t){return t?(e.name=t.name,e.style=t.style||e.style,e.interactive=!!t.interactive,e.encode=f(e.encode,t,Ct)):e.interactive=!1,e}function Nt(e,n,i,a){const r=Mt(e,i),s=r.isVertical(),l=r.gradientThickness(),o=r.gradientLength();let u,d,f,g,m;s?(d=[0,1],f=[0,0],g=l,m=o):(d=[0,0],f=[1,0],g=o,m=l);const h={enter:u={opacity:Wt,x:Wt,y:Wt,width:c(g),height:c(m)},update:t.extend({},u,{opacity:_t,fill:{gradient:n,start:d,stop:f}}),exit:{opacity:Wt}};return p(h,{stroke:r("gradientStrokeColor"),strokeWidth:r("gradientStrokeWidth")},{opacity:r("gradientOpacity")}),Yt({type:Ft,role:w,encode:h},a)}function Gt(e,n,i,a,r){const s=Mt(e,i),l=s.isVertical(),o=s.gradientThickness(),u=s.gradientLength();let d,f,g,m,h="";l?(d="y",g="y2",f="x",m="width",h="1-"):(d="x",g="x2",f="y",m="height");const y={opacity:Wt,fill:{scale:n,field:St}};y[d]={signal:h+"datum."+vt,mult:u},y[f]=Wt,y[g]={signal:h+"datum."+$t,mult:u},y[m]=c(o);const b={enter:y,update:t.extend({},y,{opacity:_t}),exit:{opacity:Wt}};return p(b,{stroke:s("gradientStrokeColor"),strokeWidth:s("gradientStrokeWidth")},{opacity:s("gradientOpacity")}),Yt({type:Ft,role:R,key:St,from:r,encode:b},a)}const Qt=`datum.${vt}<=0?"${dt}":datum.${vt}>=1?"${pt}":"${gt}"`,Jt=`datum.${vt}<=0?"${ft}":datum.${vt}>=1?"${ct}":"middle"`;function Kt(e,t,n,i){const a=Mt(e,t),r=a.isVertical(),s=c(a.gradientThickness()),l=a.gradientLength();let o,u,d,f,g=a("labelOverlap"),m="";const h={enter:o={opacity:Wt},update:u={opacity:_t,text:{field:xt}},exit:{opacity:Wt}};return p(h,{fill:a("labelColor"),fillOpacity:a("labelOpacity"),font:a("labelFont"),fontSize:a("labelFontSize"),fontStyle:a("labelFontStyle"),fontWeight:a("labelFontWeight"),limit:le(e.labelLimit,t.gradientLabelLimit)}),r?(o.align={value:"left"},o.baseline=u.baseline={signal:Jt},d="y",f="x",m="1-"):(o.align=u.align={signal:Qt},o.baseline={value:"top"},d="x",f="y"),o[d]=u[d]={signal:m+"datum."+vt,mult:l},o[f]=u[f]=s,s.offset=le(e.labelOffset,t.gradientLabelOffset)||0,g=g?{separation:a("labelSeparation"),method:g,order:"datum."+bt}:void 0,Yt({type:Bt,role:z,style:Ot,key:St,from:i,encode:h,overlap:g},n)}function Zt(e,t,n,i,a){const r=Mt(e,t),s=n.entries,l=!(!s||!s.interactive),o=s?s.name:void 0,u=r("clipHeight"),d=r("symbolOffset"),g={data:"value"},m=`(${a}) ? datum.${kt} : datum.${Et}`,h=u?c(u):{field:Et},b=`datum.${bt}`,x=`max(1, ${a})`;let k,v,$,S,O;h.mult=.5,k={enter:v={opacity:Wt,x:{signal:m,mult:.5,offset:d},y:h},update:$={opacity:_t,x:v.x,y:v.y},exit:{opacity:Wt}};let R=null,j=null;e.fill||(R=t.symbolBaseFillColor,j=t.symbolBaseStrokeColor),p(k,{fill:r("symbolFillColor",R),shape:r("symbolType"),size:r("symbolSize"),stroke:r("symbolStrokeColor",j),strokeDash:r("symbolDash"),strokeDashOffset:r("symbolDashOffset"),strokeWidth:r("symbolStrokeWidth")},{opacity:r("symbolOpacity")}),Pt.forEach((t=>{e[t]&&($[t]=v[t]={scale:e[t],field:St})}));const w=Yt({type:Tt,role:D,key:St,from:g,clip:!!u||void 0,encode:k},n.symbols),V=c(d);V.offset=r("labelOffset"),k={enter:v={opacity:Wt,x:{signal:m,offset:V},y:h},update:$={opacity:_t,text:{field:xt},x:v.x,y:v.y},exit:{opacity:Wt}},p(k,{align:r("labelAlign"),baseline:r("labelBaseline"),fill:r("labelColor"),fillOpacity:r("labelOpacity"),font:r("labelFont"),fontSize:r("labelFontSize"),fontStyle:r("labelFontStyle"),fontWeight:r("labelFontWeight"),limit:r("labelLimit")});const E=Yt({type:Bt,role:z,style:Ot,key:St,from:g,encode:k},n.labels);return k={enter:{noBound:{value:!u},width:Wt,height:u?c(u):Wt,opacity:Wt},exit:{opacity:Wt},update:$={opacity:_t,row:{signal:null},column:{signal:null}}},r.isVertical(!0)?(S=`ceil(item.mark.items.length / ${x})`,$.row.signal=`${b}%${S}`,$.column.signal=`floor(${b} / ${S})`,O={field:["row",b]}):($.row.signal=`floor(${b} / ${x})`,$.column.signal=`${b} % ${x}`,O={field:b}),$.column.signal=`(${a})?${$.column.signal}:${b}`,Ut({role:y,from:i={facet:{data:i,name:"value",groupby:bt}},encode:f(k,s,Ct),marks:[w,E],name:o,interactive:l,sort:O})}const en='item.orient === "left"',tn='item.orient === "right"',nn=`(${en} || ${tn})`,an=`datum.vgrad && ${nn}`,rn=Ht('"top"','"bottom"','"middle"'),sn=`datum.vgrad && ${tn} ? (${Ht('"right"','"left"','"center"')}) : (${nn} && !(datum.vgrad && ${en})) ? "left" : ${It}`,ln=`item._anchor || (${nn} ? "middle" : "start")`,on=`${an} ? (${en} ? -90 : 90) : 0`,un=`${nn} ? (datum.vgrad ? (${tn} ? "bottom" : "top") : ${rn}) : "top"`;function cn(e,n){let i;return t.isObject(e)&&(e.signal?i=e.signal:e.path?i="pathShape("+dn(e.path)+")":e.sphere&&(i="geoShape("+dn(e.sphere)+', {type: "Sphere"})')),i?n.signalRef(i):!!e}function dn(e){return t.isObject(e)&&e.signal?e.signal:t.stringValue(e)}function pn(e){const t=e.role||"";return t.indexOf("axis")&&t.indexOf("legend")&&t.indexOf("title")?e.type===Lt?y:t||m:t}function fn(e){return{marktype:e.type,name:e.name||void 0,role:e.role||pn(e),zindex:+e.zindex||void 0,aria:e.aria,description:e.description}}function gn(e,t){return e&&e.signal?t.signalRef(e.signal):!1!==e}function mn(e,n){const i=r.definition(e.type);i||t.error("Unrecognized transform type: "+t.stringValue(e.type));const a=G(i.type.toLowerCase(),null,hn(i,e,n));return e.signal&&n.addSignal(e.signal,n.proxy(a)),a.metadata=i.metadata||{},a}function hn(e,t,n){const i={},a=e.params.length;for(let r=0;r<a;++r){const a=e.params[r];i[a.name]=yn(a,t,n)}return i}function yn(e,n,i){const a=e.type,r=n[e.name];return"index"===a?function(e,n,i){t.isString(n.from)||t.error('Lookup "from" parameter must be a string literal.');return i.getData(n.from).lookupRef(i,n.key)}(0,n,i):void 0!==r?"param"===a?function(e,n,i){const a=n[e.name];return e.array?(t.isArray(a)||t.error("Expected an array of sub-parameters. Instead: "+t.stringValue(a)),a.map((t=>xn(e,t,i)))):xn(e,a,i)}(e,n,i):"projection"===a?i.projectionRef(n[e.name]):e.array&&!re(r)?r.map((t=>bn(e,t,i))):bn(e,r,i):void(e.required&&t.error("Missing required "+t.stringValue(n.type)+" parameter: "+t.stringValue(e.name)))}function bn(e,i,a){const r=e.type;if(re(i))return Sn(r)?t.error("Expression references can not be signals."):On(r)?a.fieldRef(i):Rn(r)?a.compareRef(i):a.signalRef(i.signal);{const t=e.expr||On(r);return t&&kn(i)?a.exprRef(i.expr,i.as):t&&vn(i)?K(i.field,i.as):Sn(r)?n.parseExpression(i,a):$n(r)?J(a.getData(i).values):On(r)?K(i):Rn(r)?a.compareRef(i):i}}function xn(e,n,i){const a=e.params.length;let r;for(let t=0;t<a;++t){r=e.params[t];for(const e in r.key)if(r.key[e]!==n[e]){r=null;break}if(r)break}r||t.error("Unsupported parameter: "+t.stringValue(n));const s=t.extend(hn(r,n,i),r.key);return J(i.add(Fe(s)))}const kn=e=>e&&e.expr,vn=e=>e&&e.field,$n=e=>"data"===e,Sn=e=>"expr"===e,On=e=>"field"===e,Rn=e=>"compare"===e;function jn(e,t){return e.$ref?e:e.data&&e.data.$ref?e.data:J(t.getData(e.data).output)}function wn(e,t,n,i,a){this.scope=e,this.input=t,this.output=n,this.values=i,this.aggregate=a,this.index={}}function zn(e){return t.isString(e)?e:null}function Dn(e,t,n){const i=ne(n.op,n.field);let a;if(t.ops){for(let e=0,n=t.as.length;e<n;++e)if(t.as[e]===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 Vn(e,n,i,a,r,s,l){const o=n[i]||(n[i]={}),u=function(e){return t.isObject(e)?(e.order===te?"-":"+")+ne(e.op,e.field):""}(s);let c,d,p=zn(r);if(null!=p&&(e=n.scope,p+=u?"|"+u:"",c=o[p]),!c){const t=s?{field:Z,pulse:n.countsRef(e,r,s)}:{field:e.fieldRef(r),pulse:J(n.output)};u&&(t.sort=e.sortRef(s)),d=e.add(G(a,void 0,t)),l&&(n.index[r]=d),c=J(d),null!=p&&(o[p]=c)}return c}function En(e,t,i){const a=e.remove,r=e.insert,s=e.toggle,l=e.modify,o=e.values,u=t.add(Q()),c="if("+e.trigger+',modify("'+i+'",'+[r,a,s,l,o].map((e=>null==e?"null":e)).join(",")+"),0)",d=n.parseExpression(c,t);u.update=d.$expr,u.params=d.$params}function Pn(e,n){const i=pn(e),a=e.type===Lt,r=e.from&&e.from.facet,s=e.overlap;let l,o,u,c,d,p,f,g=e.layout||i===y||i===h;const b=i===m||g||r,x=function(e,n,i){let a,r,s,l,o;return e?(a=e.facet)&&(n||t.error("Only group marks can be faceted."),null!=a.field?l=o=jn(a,i):(e.data?o=J(i.getData(e.data).aggregate):(s=mn(t.extend({type:"aggregate",groupby:t.array(a.groupby)},a.aggregate),i),s.params.key=i.keyRef(a.groupby),s.params.pulse=jn(a,i),l=o=J(i.add(s))),r=i.keyRef(a.groupby,!0))):l=J(i.add(Se(null,[{}]))),l||(l=jn(e,i)),{key:r,pulse:l,parent:o}}(e.from,a,n);o=n.add(Re({key:x.key||(e.key?K(e.key):void 0),pulse:x.pulse,clean:!a}));const k=J(o);o=u=n.add(Se({pulse:k})),o=n.add(Ce({markdef:fn(e),interactive:gn(e.interactive,n),clip:cn(e.clip,n),context:{$context:!0},groups:n.lookup(),parent:n.signals.parent?n.signalRef("parent"):null,index:n.markpath(),pulse:J(o)}));const v=J(o);o=c=n.add(je(U(e.encode,e.type,i,e.style,n,{mod:!1,pulse:v}))),o.params.parent=n.encode(),e.transform&&e.transform.forEach((e=>{const i=mn(e,n),a=i.metadata;(a.generates||a.changes)&&t.error("Mark transforms should not generate new data."),a.nomod||(c.params.mod=!0),i.params.pulse=J(o),n.add(o=i)})),e.sort&&(o=n.add(Ie({sort:n.compareRef(e.sort),pulse:J(o)})));const $=J(o);(r||g)&&(g=n.add(Xe({layout:n.objectProperty(e.layout),legends:n.legends,mark:v,pulse:$})),p=J(g));const S=n.add($e({mark:v,pulse:p||$}));f=J(S),a&&(b&&(l=n.operators,l.pop(),g&&l.pop()),n.pushState($,p||f,k),r?function(e,n,i){const a=e.from.facet,r=a.name,s=jn(a,n);let l;a.name||t.error("Facet must have a name: "+t.stringValue(a)),a.data||t.error("Facet must reference a data set: "+t.stringValue(a)),a.field?l=n.add(Ae({field:n.fieldRef(a.field),pulse:s})):a.groupby?l=n.add(ze({key:n.keyRef(a.groupby),group:J(n.proxy(i.parent)),pulse:s})):t.error("Facet must specify groupby or field: "+t.stringValue(a));const o=n.fork(),u=o.add(Se()),c=o.add(He({pulse:J(u)}));o.addData(r,new wn(o,u,u,c)),o.addSignal("parent",null),l.params.subflow={$subflow:o.parse(e).toRuntime()}}(e,n,x):b?function(e,t,n){const i=t.add(Ae({pulse:n.pulse})),a=t.fork();a.add(He()),a.addSignal("parent",null),i.params.subflow={$subflow:a.parse(e).toRuntime()}}(e,n,x):n.parse(e),n.popState(),b&&(g&&l.push(g),l.push(S))),s&&(f=function(e,t,n){const i=e.method,a=e.bound,r=e.separation,s={separation:re(r)?n.signalRef(r.signal):r,method:re(i)?n.signalRef(i.signal):i,pulse:t};e.order&&(s.sort=n.compareRef({field:e.order}));if(a){const e=a.tolerance;s.boundTolerance=re(e)?n.signalRef(e.signal):+e,s.boundScale=n.scaleRef(a.scale),s.boundOrient=a.orient}return J(n.add(Le(s)))}(s,f,n));const O=n.add(Me({pulse:f})),R=n.add(He({pulse:J(O)},void 0,n.parent()));null!=e.name&&(d=e.name,n.addData(d,new wn(n,u,O,R)),e.on&&e.on.forEach((e=>{(e.insert||e.remove||e.toggle)&&t.error("Marks only support modify triggers."),En(e,n,d)})))}function Cn(e,i){const r=i.config.legend,s=e.encode||{},l=Mt(e,r),o=s.legend||{},u=o.name||void 0,c=o.interactive,d=o.style,g={};let m,h,y,b=0;Pt.forEach((t=>e[t]?(g[t]=e[t],b=b||e[t]):0)),b||t.error("Missing valid scale for legend.");const x=function(e,t){let n=e.type||zt;e.type||1!==function(e){return Pt.reduce(((t,n)=>t+(e[n]?1:0)),0)}(e)||!e.fill&&!e.stroke||(n=a.isContinuous(t)?Dt:a.isDiscretizing(t)?Vt:zt);return n!==Dt?n:a.isDiscretizing(t)?Vt:Dt}(e,i.scaleType(b)),k={title:null!=e.title,scales:g,type:x,vgrad:"symbol"!==x&&l.isVertical()},v=J(i.add(Se(null,[k]))),$=J(i.add(Ee(h={type:x,scale:i.scaleRef(b),count:i.objectProperty(l("tickCount")),limit:i.property(l("symbolLimit")),values:i.objectProperty(e.values),minstep:i.property(e.tickMinStep),formatType:i.property(e.formatType),formatSpecifier:i.property(e.format)})));return x===Dt?(y=[Nt(e,b,r,s.gradient),Kt(e,r,s.labels,$)],h.count=h.count||i.signalRef(`max(2,2*floor((${oe(l.gradientLength())})/100))`)):x===Vt?y=[Gt(e,b,r,s.gradient,$),Kt(e,r,s.labels,$)]:(m=function(e,t){const n=Mt(e,t);return{align:n("gridAlign"),columns:n.entryColumns(),center:{row:!0,column:!1},padding:{row:n("rowPadding"),column:n("columnPadding")}}}(e,r),y=[Zt(e,r,s,$,oe(m.columns))],h.size=function(e,t,i){const a=oe(_n("size",e,i)),r=oe(_n("strokeWidth",e,i)),s=oe(function(e,t,n){return qt("fontSize",e)||function(e,t,n){const i=t.config.style[n];return i&&i[e]}("fontSize",t,n)}(i[1].encode,t,Ot));return n.parseExpression(`max(ceil(sqrt(${a})+${r}),${s})`,t)}(e,i,y[0].marks)),y=[Ut({role:j,from:v,encode:{enter:{x:{value:0},y:{value:0}}},marks:y,layout:m,interactive:c})],k.title&&y.push(function(e,t,n,i){const a=Mt(e,t),r={enter:{opacity:Wt},update:{opacity:_t,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:Wt}};return p(r,{orient:a("titleOrient"),_anchor:a("titleAnchor"),anchor:{signal:ln},angle:{signal:on},align:{signal:sn},baseline:{signal:un},text:e.title,fill:a("titleColor"),fillOpacity:a("titleOpacity"),font:a("titleFont"),fontSize:a("titleFontSize"),fontStyle:a("titleFontStyle"),fontWeight:a("titleFontWeight"),limit:a("titleLimit"),lineHeight:a("titleLineHeight")},{align:a("titleAlign"),baseline:a("titleBaseline")}),Yt({type:Bt,role:V,style:Rt,from:i,encode:r},n)}(e,r,s.title,v)),Pn(Ut({role:O,from:v,encode:f(Wn(l,e,r),o,Ct),marks:y,aria:l("aria"),description:l("description"),zindex:l("zindex"),name:u,interactive:c,style:d}),i)}function Wn(e,t,n){const i={enter:{},update:{}};return p(i,{orient:e("orient"),offset:e("offset"),padding:e("padding"),titlePadding:e("titlePadding"),cornerRadius:e("cornerRadius"),fill:e("fillColor"),stroke:e("strokeColor"),strokeWidth:n.strokeWidth,strokeDash:n.strokeDash,x:e("legendX"),y:e("legendY"),format:t.format,formatType:t.formatType}),i}function _n(e,t,n){return t[e]?`scale("${t[e]}",datum)`:qt(e,n[0].encode)}wn.fromEntries=function(e,t){const n=t.length,i=t[n-1],a=t[n-2];let r=t[0],s=null,l=1;for(r&&"load"===r.type&&(r=t[1]),e.add(t[0]);l<n;++l)t[l].params.pulse=J(t[l-1]),e.add(t[l]),"aggregate"===t[l].type&&(s=t[l]);return new wn(e,r,a,i,s)},wn.prototype={countsRef(e,t,n){const i=this,a=i.counts||(i.counts={}),r=zn(t);let s,l,o;return null!=r&&(e=i.scope,s=a[r]),s?n&&n.field&&Dn(e,s.agg.params,n):(o={groupby:e.fieldRef(t,"key"),pulse:J(i.output)},n&&n.field&&Dn(e,o,n),l=e.add(ke(o)),s=e.add(Se({pulse:J(l)})),s={agg:l,ref:J(s)},null!=r&&(a[r]=s)),s.ref},tuplesRef(){return J(this.values)},extentRef(e,t){return Vn(e,this,"extent","extent",t,!1)},domainRef(e,t){return Vn(e,this,"domain","values",t,!1)},valuesRef(e,t,n){return Vn(e,this,"vals","values",t,n||!0)},lookupRef(e,t){return Vn(e,this,"lookup","tupleindex",t,!1)},indataRef(e,t){return Vn(e,this,"indata","tupleindex",t,!0,!0)}};const Ln=`item.orient==="${dt}"?-90:item.orient==="${pt}"?90:0`;function Fn(e,n){const i=Mt(e=t.isString(e)?{text:e}:e,n.config.title),a=e.encode||{},r=a.group||{},s=r.name||void 0,l=r.interactive,o=r.style,u=[],c=J(n.add(Se(null,[{}])));return u.push(function(e,t,n,i){const a={value:0},r=e.text,s={enter:{opacity:a},update:{opacity:{value:1}},exit:{opacity:a}};return p(s,{text:r,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:t("dx"),dy:t("dy"),fill:t("color"),font:t("font"),fontSize:t("fontSize"),fontStyle:t("fontStyle"),fontWeight:t("fontWeight"),lineHeight:t("lineHeight")},{align:t("align"),angle:t("angle"),baseline:t("baseline")}),Yt({type:Bt,role:P,style:jt,from:i,encode:s},n)}(e,i,function(e){const n=e.encode;return n&&n.title||t.extend({name:e.name,interactive:e.interactive,style:e.style},n)}(e),c)),e.subtitle&&u.push(function(e,t,n,i){const a={value:0},r=e.subtitle,s={enter:{opacity:a},update:{opacity:{value:1}},exit:{opacity:a}};return p(s,{text:r,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:t("dx"),dy:t("dy"),fill:t("subtitleColor"),font:t("subtitleFont"),fontSize:t("subtitleFontSize"),fontStyle:t("subtitleFontStyle"),fontWeight:t("subtitleFontWeight"),lineHeight:t("subtitleLineHeight")},{align:t("align"),angle:t("angle"),baseline:t("baseline")}),Yt({type:Bt,role:C,style:wt,from:i,encode:s},n)}(e,i,a.subtitle,c)),Pn(Ut({role:E,from:c,encode:An(i,r),marks:u,aria:i("aria"),description:i("description"),zindex:i("zindex"),name:s,interactive:l,style:o}),n)}function An(e,t){const n={enter:{},update:{}};return p(n,{orient:e("orient"),anchor:e("anchor"),align:{signal:It},angle:{signal:Ln},limit:e("limit"),frame:e("frame"),offset:e("offset")||0,padding:e("subtitlePadding")}),f(n,t,Ct)}function Tn(e,n){const i=[];e.transform&&e.transform.forEach((e=>{i.push(mn(e,n))})),e.on&&e.on.forEach((t=>{En(t,n,e.name)})),n.addDataPipeline(e.name,function(e,n,i){const a=[];let r,s,l,o,u,c=null,d=!1,p=!1;e.values?re(e.values)||se(e.format)?(a.push(Un(n,e)),a.push(c=Bn())):a.push(c=Bn({$ingest:e.values,$format:e.format})):e.url?se(e.url)||se(e.format)?(a.push(Un(n,e)),a.push(c=Bn())):a.push(c=Bn({$request:e.url,$format:e.format})):e.source&&(c=r=t.array(e.source).map((e=>J(n.getData(e).output))),a.push(null));for(s=0,l=i.length;s<l;++s)o=i[s],u=o.metadata,c||u.source||a.push(c=Bn()),a.push(o),u.generates&&(p=!0),u.modifies&&!p&&(d=!0),u.source?c=o:u.changes&&(c=null);r&&(l=r.length-1,a[0]=Ue({derive:d,pulse:l?r:r[0]}),(d||l)&&a.splice(1,0,Bn()));c||a.push(Bn());return a.push(He({})),a}(e,n,i))}function Bn(e){const t=Se({},e);return t.metadata={source:!0},t}function Un(e,t){return Pe({url:t.url?e.property(t.url):void 0,async:t.async?e.property(t.async):void 0,values:t.values?e.property(t.values):void 0,format:e.objectProperty(t.format)})}const Mn=e=>e===ft||e===ct,qn=(e,t,n)=>re(e)?Qn(e.signal,t,n):e===dt||e===ct?t:n,Hn=(e,t,n)=>re(e)?Nn(e.signal,t,n):Mn(e)?t:n,In=(e,t,n)=>re(e)?Gn(e.signal,t,n):Mn(e)?n:t,Xn=(e,t,n)=>re(e)?Jn(e.signal,t,n):e===ct?{value:t}:{value:n},Yn=(e,t,n)=>re(e)?Kn(e.signal,t,n):e===pt?{value:t}:{value:n},Nn=(e,t,n)=>Zn(`${e} === '${ct}' || ${e} === '${ft}'`,t,n),Gn=(e,t,n)=>Zn(`${e} !== '${ct}' && ${e} !== '${ft}'`,t,n),Qn=(e,t,n)=>ti(`${e} === '${dt}' || ${e} === '${ct}'`,t,n),Jn=(e,t,n)=>ti(`${e} === '${ct}'`,t,n),Kn=(e,t,n)=>ti(`${e} === '${pt}'`,t,n),Zn=(e,n,i)=>(n=null!=n?c(n):n,i=null!=i?c(i):i,ei(n)&&ei(i)?{signal:`${e} ? (${n=n?n.signal||t.stringValue(n.value):null}) : (${i=i?i.signal||t.stringValue(i.value):null})`}:[t.extend({test:e},n)].concat(i||[])),ei=e=>null==e||1===Object.keys(e).length,ti=(e,t,n)=>({signal:`${e} ? (${ii(t)}) : (${ii(n)})`}),ni=(e,t,n,i,a)=>({signal:(null!=i?`${e} === '${dt}' ? (${ii(i)}) : `:"")+(null!=n?`${e} === '${ft}' ? (${ii(n)}) : `:"")+(null!=a?`${e} === '${pt}' ? (${ii(a)}) : `:"")+(null!=t?`${e} === '${ct}' ? (${ii(t)}) : `:"")+"(null)"}),ii=e=>re(e)?e.signal:null==e?null:t.stringValue(e),ai=(e,t)=>0===t?0:re(e)?{signal:`(${e.signal}) * ${t}`}:{value:e*t},ri=(e,t)=>{const n=e.signal;return n&&n.endsWith("(null)")?{signal:n.slice(0,-6)+t.signal}:e};function si(e,n,i,a){let r;if(n&&t.hasOwnProperty(n,e))return n[e];if(t.hasOwnProperty(i,e))return i[e];if(e.startsWith("title")){switch(e){case"titleColor":r="fill";break;case"titleFont":case"titleFontSize":case"titleFontWeight":r=e[5].toLowerCase()+e.slice(6)}return a[Rt][r]}if(e.startsWith("label")){switch(e){case"labelColor":r="fill";break;case"labelFont":case"labelFontSize":r=e[5].toLowerCase()+e.slice(6)}return a[Ot][r]}return null}function li(e){const t={};for(const n of e)if(n)for(const e in n)t[e]=1;return Object.keys(t)}function oi(e,t){return{scale:e.scale,range:t}}function ui(e,n,i,a,r){const s=Mt(e,n),l=e.orient,o=e.gridScale,u=qn(l,1,-1),c=function(e,n){if(1===n);else if(t.isObject(e)){let i=e=t.extend({},e);for(;null!=i.mult;){if(!t.isObject(i.mult))return i.mult=re(n)?{signal:`(${i.mult}) * (${n.signal})`}:i.mult*n,e;i=i.mult=t.extend({},i.mult)}i.mult=n}else e=re(n)?{signal:`(${n.signal}) * (${e||0})`}:n*(e||0);return e}(e.offset,u);let d,f,g;const m={enter:d={opacity:Wt},update:g={opacity:_t},exit:f={opacity:Wt}};p(m,{stroke:s("gridColor"),strokeCap:s("gridCap"),strokeDash:s("gridDash"),strokeDashOffset:s("gridDashOffset"),strokeOpacity:s("gridOpacity"),strokeWidth:s("gridWidth")});const h={scale:e.scale,field:St,band:r.band,extra:r.extra,offset:r.offset,round:s("tickRound")},y=Hn(l,{signal:"height"},{signal:"width"}),b=o?{scale:o,range:0,mult:u,offset:c}:{value:0,offset:c},x=o?{scale:o,range:1,mult:u,offset:c}:t.extend(y,{mult:u,offset:c});return d.x=g.x=Hn(l,h,b),d.y=g.y=In(l,h,b),d.x2=g.x2=In(l,x),d.y2=g.y2=Hn(l,x),f.x=Hn(l,h),f.y=In(l,h),Yt({type:At,role:k,key:St,from:a,encode:m},i)}function ci(e,t,n,i,a){return{signal:'flush(range("'+e+'"), scale("'+e+'", datum.value), '+t+","+n+","+i+","+a+")"}}function di(e,n,i,a){const r=Mt(e,n),s=e.orient,l=qn(s,-1,1);let o,u;const d={enter:o={opacity:Wt,anchor:c(r("titleAnchor",null)),align:{signal:It}},update:u=t.extend({},o,{opacity:_t,text:c(e.title)}),exit:{opacity:Wt}},f={signal:`lerp(range("${e.scale}"), ${Ht(0,1,.5)})`};return u.x=Hn(s,f),u.y=In(s,f),o.angle=Hn(s,Wt,ai(l,90)),o.baseline=Hn(s,Xn(s,ft,ct),{value:ft}),u.angle=o.angle,u.baseline=o.baseline,p(d,{fill:r("titleColor"),fillOpacity:r("titleOpacity"),font:r("titleFont"),fontSize:r("titleFontSize"),fontStyle:r("titleFontStyle"),fontWeight:r("titleFontWeight"),limit:r("titleLimit"),lineHeight:r("titleLineHeight")},{align:r("titleAlign"),angle:r("titleAngle"),baseline:r("titleBaseline")}),function(e,t,n,i){const a=(e,t)=>null!=e?(n.update[t]=ri(c(e),n.update[t]),!1):!g(t,i),r=a(e("titleX"),"x"),s=a(e("titleY"),"y");n.enter.auto=s===r?c(s):Hn(t,c(s),c(r))}(r,s,d,i),d.update.align=ri(d.update.align,o.align),d.update.angle=ri(d.update.angle,o.angle),d.update.baseline=ri(d.update.baseline,o.baseline),Yt({type:Bt,role:S,style:Rt,from:a,encode:d},i)}function pi(e,n){const i=function(e,n){var i,a,r,s=n.config,l=s.style,o=s.axis,u="band"===n.scaleType(e.scale)&&s.axisBand,c=e.orient;if(re(c)){const e=li([s.axisX,s.axisY]),t=li([s.axisTop,s.axisBottom,s.axisLeft,s.axisRight]);for(r of(i={},e))i[r]=Hn(c,si(r,s.axisX,o,l),si(r,s.axisY,o,l));for(r of(a={},t))a[r]=ni(c.signal,si(r,s.axisTop,o,l),si(r,s.axisBottom,o,l),si(r,s.axisLeft,o,l),si(r,s.axisRight,o,l))}else i=c===ct||c===ft?s.axisX:s.axisY,a=s["axis"+c[0].toUpperCase()+c.slice(1)];return i||a||u?t.extend({},o,i,a,u):o}(e,n),a=e.encode||{},r=a.axis||{},s=r.name||void 0,l=r.interactive,o=r.style,u=Mt(e,i),d=function(e){const n=e("tickBand");let i,a,r=e("tickOffset");return n?n.signal?(i={signal:`(${n.signal}) === 'extent' ? 1 : 0.5`},a={signal:`(${n.signal}) === 'extent'`},t.isObject(r)||(r={signal:`(${n.signal}) === 'extent' ? 0 : ${r}`})):"extent"===n?(i=1,a=!0,r=0):(i=.5,a=!1):(i=e("bandPosition"),a=e("tickExtra")),{extra:a,band:i,offset:r}}(u),g={scale:e.scale,ticks:!!u("ticks"),labels:!!u("labels"),grid:!!u("grid"),domain:!!u("domain"),title:null!=e.title},m=J(n.add(Se({},[g]))),h=J(n.add(ve({scale:n.scaleRef(e.scale),extra:n.property(d.extra),count:n.objectProperty(e.tickCount),values:n.objectProperty(e.values),minstep:n.property(e.tickMinStep),formatType:n.property(e.formatType),formatSpecifier:n.property(e.format)}))),y=[];let k;return g.grid&&y.push(ui(e,i,a.grid,h,d)),g.ticks&&(k=u("tickSize"),y.push(function(e,t,n,i,a,r){const s=Mt(e,t),l=e.orient,o=qn(l,-1,1);let u,d,f;const g={enter:u={opacity:Wt},update:f={opacity:_t},exit:d={opacity:Wt}};p(g,{stroke:s("tickColor"),strokeCap:s("tickCap"),strokeDash:s("tickDash"),strokeDashOffset:s("tickDashOffset"),strokeOpacity:s("tickOpacity"),strokeWidth:s("tickWidth")});const m=c(a);m.mult=o;const h={scale:e.scale,field:St,band:r.band,extra:r.extra,offset:r.offset,round:s("tickRound")};return f.y=u.y=Hn(l,Wt,h),f.y2=u.y2=Hn(l,m),d.x=Hn(l,h),f.x=u.x=In(l,Wt,h),f.x2=u.x2=In(l,m),d.y=In(l,h),Yt({type:At,role:$,key:St,from:i,encode:g},n)}(e,i,a.ticks,h,k,d))),g.labels&&(k=g.ticks?k:0,y.push(function(e,t,n,i,a,r){const s=Mt(e,t),l=e.orient,o=e.scale,u=qn(l,-1,1),d=oe(s("labelFlush")),f=oe(s("labelFlushOffset")),g=s("labelAlign"),m=s("labelBaseline");let h,y=0===d||!!d;const b=c(a);b.mult=u,b.offset=c(s("labelPadding")||0),b.offset.mult=u;const x={scale:o,field:St,band:.5,offset:Xt(r.offset,s("labelOffset"))},k=Hn(l,y?ci(o,d,'"left"','"right"','"center"'):{value:"center"},Yn(l,"left","right")),$=Hn(l,Xn(l,"bottom","top"),y?ci(o,d,'"top"','"bottom"','"middle"'):{value:"middle"}),S=ci(o,d,`-(${f})`,f,0);y=y&&f;const O={opacity:Wt,x:Hn(l,x,b),y:In(l,x,b)},R={enter:O,update:h={opacity:_t,text:{field:xt},x:O.x,y:O.y,align:k,baseline:$},exit:{opacity:Wt,x:O.x,y:O.y}};p(R,{dx:!g&&y?Hn(l,S):null,dy:!m&&y?In(l,S):null}),p(R,{angle:s("labelAngle"),fill:s("labelColor"),fillOpacity:s("labelOpacity"),font:s("labelFont"),fontSize:s("labelFontSize"),fontWeight:s("labelFontWeight"),fontStyle:s("labelFontStyle"),limit:s("labelLimit"),lineHeight:s("labelLineHeight")},{align:g,baseline:m});const j=s("labelBound");let w=s("labelOverlap");return w=w||j?{separation:s("labelSeparation"),method:w,order:"datum.index",bound:j?{scale:o,orient:l,tolerance:j}:null}:void 0,h.align!==k&&(h.align=ri(h.align,k)),h.baseline!==$&&(h.baseline=ri(h.baseline,$)),Yt({type:Bt,role:v,style:Ot,key:St,from:i,encode:R,overlap:w},n)}(e,i,a.labels,h,k,d))),g.domain&&y.push(function(e,t,n,i){const a=Mt(e,t),r=e.orient;let s,l;const o={enter:s={opacity:Wt},update:l={opacity:_t},exit:{opacity:Wt}};p(o,{stroke:a("domainColor"),strokeCap:a("domainCap"),strokeDash:a("domainDash"),strokeDashOffset:a("domainDashOffset"),strokeWidth:a("domainWidth"),strokeOpacity:a("domainOpacity")});const u=oi(e,0),c=oi(e,1);return s.x=l.x=Hn(r,u,Wt),s.x2=l.x2=Hn(r,c),s.y=l.y=In(r,u,Wt),s.y2=l.y2=In(r,c),Yt({type:At,role:x,from:i,encode:o},n)}(e,i,a.domain,m)),g.title&&y.push(di(e,i,a.title,m)),Pn(Ut({role:b,from:m,encode:f(fi(u,e),r,Ct),marks:y,aria:u("aria"),description:u("description"),zindex:u("zindex"),name:s,interactive:l,style:o}),n)}function fi(e,t){const n={enter:{},update:{}};return p(n,{orient:e("orient"),offset:e("offset")||0,position:le(t.position,0),titlePadding:e("titlePadding"),minExtent:e("minExtent"),maxExtent:e("maxExtent"),range:{signal:`abs(span(range("${t.scale}")))`},translate:e("translate"),format:t.format,formatType:t.formatType}),n}function gi(e,n,i){const r=t.array(e.signals),s=t.array(e.scales);return i||r.forEach((e=>Y(e,n))),t.array(e.projections).forEach((e=>function(e,t){const n=t.config.projection||{},i={};for(const n in e)"name"!==n&&(i[n]=ut(e[n],n,t));for(const e in n)null==i[e]&&(i[e]=ut(n[e],e,t));t.addProjection(e.name,i)}(e,n))),s.forEach((e=>function(e,n){const i=e.type||"linear";a.isValidScaleType(i)||t.error("Unrecognized scale type: "+t.stringValue(i)),n.addScale(e.name,{type:i,domain:void 0})}(e,n))),t.array(e.data).forEach((e=>Tn(e,n))),s.forEach((e=>Qe(e,n))),(i||r).forEach((e=>be(e,n))),t.array(e.axes).forEach((e=>pi(e,n))),t.array(e.marks).forEach((e=>Pn(e,n))),t.array(e.legends).forEach((e=>Cn(e,n))),e.title&&Fn(e.title,n),n.parseLambdas(),n}const mi=e=>f({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},e);function hi(e,n){const i=n.config,a=J(n.root=n.add(Q())),r=function(e,n){const i=t=>le(e[t],n[t]),a=[yi("background",i("background")),yi("autosize",s(i("autosize"))),yi("padding",u(i("padding"))),yi("width",i("width")||0),yi("height",i("height")||0)],r=a.reduce(((e,t)=>(e[t.name]=t,e)),{}),l={};return t.array(e.signals).forEach((e=>{t.hasOwnProperty(r,e.name)?e=t.extend(r[e.name],e):a.push(e),l[e.name]=e})),t.array(n.signals).forEach((e=>{t.hasOwnProperty(l,e.name)||t.hasOwnProperty(r,e.name)||a.push(e)})),a}(e,i);r.forEach((e=>Y(e,n))),n.description=e.description||i.description,n.eventConfig=i.events,n.legends=n.objectProperty(i.legend&&i.legend.layout),n.locale=i.locale;const l=n.add(Se()),o=n.add(je(U(mi(e.encode),Lt,h,e.style,n,{pulse:J(l)}))),c=n.add(Xe({layout:n.objectProperty(e.layout),legends:n.legends,autosize:n.signalRef("autosize"),mark:a,pulse:J(o)}));n.operators.pop(),n.pushState(J(o),J(c),null),gi(e,n,r),n.operators.push(c);let d=n.add($e({mark:a,pulse:J(c)}));return d=n.add(Me({pulse:J(d)})),d=n.add(He({pulse:J(d)})),n.addData("root",new wn(n,l,l,d)),n}function yi(e,t){return t&&t.signal?{name:e,update:t.signal}:{name:e,value:t}}function bi(e,t){this.config=e||{},this.options=t||{},this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.eventConfig=null,this.locale=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function xi(e){this.config=e.config,this.options=e.options,this.legends=e.legends,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._lookup=e._lookup.slice(),this._markpath=e._markpath}function ki(e){return(t.isArray(e)?vi:$i)(e)}function vi(e){const n=e.length;let i="[";for(let a=0;a<n;++a){const n=e[a];i+=(a>0?",":"")+(t.isObject(n)?n.signal||ki(n):t.stringValue(n))}return i+"]"}function $i(e){let n,i,a="{",r=0;for(n in e)i=e[n],a+=(++r>1?",":"")+t.stringValue(n)+":"+(t.isObject(i)?i.signal||ki(i):t.stringValue(i));return a+"}"}function Si(){const e="sans-serif",t="#4c78a8",n="#000",i="#888",a="#ddd";return{description:"Vega visualization",padding:0,autosize:"pad",background:null,events:{defaults:{allow:["wheel"]}},group:null,mark:null,arc:{fill:t},area:{fill:t},image:null,line:{stroke:t,strokeWidth:2},path:{stroke:t},rect:{fill:t},rule:{stroke:n},shape:{stroke:t},symbol:{fill:t,size:64},text:{fill:n,font:e,fontSize:11},trail:{fill:t,size:2},style:{"guide-label":{fill:n,font:e,fontSize:10},"guide-title":{fill:n,font:e,fontSize:11,fontWeight:"bold"},"group-title":{fill:n,font:e,fontSize:13,fontWeight:"bold"},"group-subtitle":{fill:n,font:e,fontSize:12},point:{size:30,strokeWidth:2,shape:"circle"},circle:{size:30,strokeWidth:2},square:{size:30,strokeWidth:2,shape:"square"},cell:{fill:"transparent",stroke:a},view:{fill:"transparent"}},title:{orient:"top",anchor:"middle",offset:4,subtitlePadding:3},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:i,grid:!1,gridWidth:1,gridColor:a,labels:!0,labelAngle:0,labelLimit:180,labelOffset:0,labelPadding:2,ticks:!0,tickColor:i,tickOffset:0,tickRound:!0,tickSize:5,tickWidth:1,titlePadding:4},axisBand:{tickOffset:-.5},projection:{type:"mercator"},legend:{orient:"right",padding:0,gridAlign:"each",columnPadding:10,rowPadding:2,symbolDirection:"vertical",gradientDirection:"vertical",gradientLength:200,gradientThickness:16,gradientStrokeColor:a,gradientStrokeWidth:0,gradientLabelOffset:2,labelAlign:"left",labelBaseline:"middle",labelLimit:160,labelOffset:4,labelOverlap:!0,symbolLimit:30,symbolType:"circle",symbolSize:100,symbolOffset:0,symbolStrokeWidth:1.5,symbolBaseFillColor:"transparent",symbolBaseStrokeColor:i,titleLimit:180,titleOrient:"top",titlePadding:5,layout:{offset:18,direction:"horizontal",left:{direction:"vertical"},right:{direction:"vertical"}}},range:{category:{scheme:"tableau10"},ordinal:{scheme:"blues"},heatmap:{scheme:"yellowgreenblue"},ramp:{scheme:"blues"},diverging:{scheme:"blueorange",extent:[1,0]},symbol:["circle","square","triangle-up","cross","diamond","triangle-right","triangle-down","triangle-left"]}}}bi.prototype=xi.prototype={parse(e){return gi(e,this)},fork(){return new xi(this)},isSubscope(){return this._subid>0},toRuntime(){return this.finish(),{description:this.description,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig,locale:this.locale}},id(){return(this._subid?this._subid+":":0)+this._id++},add(e){return this.operators.push(e),e.id=this.id(),e.refs&&(e.refs.forEach((t=>{t.$ref=e.id})),e.refs=null),e},proxy(e){const t=e instanceof N?J(e):e;return this.add(Be({value:t}))},addStream(e){return this.streams.push(e),e.id=this.id(),e},addUpdate(e){return this.updates.push(e),e},finish(){let e,t;for(e in this.root&&(this.root.root=!0),this.signals)this.signals[e].signal=e;for(e in this.scales)this.scales[e].scale=e;function n(e,t,n){let i,a;e&&(i=e.data||(e.data={}),a=i[t]||(i[t]=[]),a.push(n))}for(e in this.data){t=this.data[e],n(t.input,e,"input"),n(t.output,e,"output"),n(t.values,e,"values");for(const i in t.index)n(t.index[i],e,"index:"+i)}return this},pushState(e,t,n){this._encode.push(J(this.add(He({pulse:e})))),this._parent.push(t),this._lookup.push(n?J(this.proxy(n)):null),this._markpath.push(-1)},popState(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},parent(){return t.peek(this._parent)},encode(){return t.peek(this._encode)},lookup(){return t.peek(this._lookup)},markpath(){const e=this._markpath;return++e[e.length-1]},fieldRef(e,n){if(t.isString(e))return K(e,n);e.signal||t.error("Unsupported field reference: "+t.stringValue(e));const i=e.signal;let a=this.field[i];if(!a){const e={name:this.signalRef(i)};n&&(e.as=n),this.field[i]=a=J(this.add(De(e)))}return a},compareRef(e){let n=!1;const i=e=>re(e)?(n=!0,this.signalRef(e.signal)):function(e){return e&&e.expr}(e)?(n=!0,this.exprRef(e.expr)):e,a=t.array(e.field).map(i),r=t.array(e.order).map(i);return n?J(this.add(Oe({fields:a,orders:r}))):ee(a,r)},keyRef(e,n){let i=!1;const a=this.signals;return e=t.array(e).map((e=>re(e)?(i=!0,J(a[e.signal])):e)),i?J(this.add(Ve({fields:e,flat:n}))):function(e,t){const n={$key:e};return t&&(n.$flat=!0),n}(e,n)},sortRef(e){if(!e)return e;const t=ne(e.op,e.field),n=e.order||"ascending";return n.signal?J(this.add(Oe({fields:t,orders:this.signalRef(n.signal)}))):ee(t,n)},event(e,t){const n=e+":"+t;if(!this.events[n]){const i=this.id();this.streams.push({id:i,source:e,type:t}),this.events[n]=i}return this.events[n]},hasOwnSignal(e){return t.hasOwnProperty(this.signals,e)},addSignal(e,n){this.hasOwnSignal(e)&&t.error("Duplicate signal name: "+t.stringValue(e));const i=n instanceof N?n:this.add(Q(n));return this.signals[e]=i},getSignal(e){return this.signals[e]||t.error("Unrecognized signal name: "+t.stringValue(e)),this.signals[e]},signalRef(e){return this.signals[e]?J(this.signals[e]):(t.hasOwnProperty(this.lambdas,e)||(this.lambdas[e]=this.add(Q(null))),J(this.lambdas[e]))},parseLambdas(){const e=Object.keys(this.lambdas);for(let t=0,i=e.length;t<i;++t){const i=e[t],a=n.parseExpression(i,this),r=this.lambdas[i];r.params=a.$params,r.update=a.$expr}},property(e){return e&&e.signal?this.signalRef(e.signal):e},objectProperty(e){return e&&t.isObject(e)?this.signalRef(e.signal||ki(e)):e},exprRef(e,t){const i={expr:n.parseExpression(e,this)};return t&&(i.expr.$name=t),J(this.add(we(i)))},addBinding(e,n){this.bindings||t.error("Nested signals do not support binding: "+t.stringValue(e)),this.bindings.push(t.extend({signal:e},n))},addScaleProj(e,n){t.hasOwnProperty(this.scales,e)&&t.error("Duplicate scale or projection name: "+t.stringValue(e)),this.scales[e]=this.add(n)},addScale(e,t){this.addScaleProj(e,qe(t))},addProjection(e,t){this.addScaleProj(e,Te(t))},getScale(e){return this.scales[e]||t.error("Unrecognized scale name: "+t.stringValue(e)),this.scales[e]},scaleRef(e){return J(this.getScale(e))},scaleType(e){return this.getScale(e).params.type},projectionRef(e){return this.scaleRef(e)},projectionType(e){return this.scaleType(e)},addData(e,n){return t.hasOwnProperty(this.data,e)&&t.error("Duplicate data set name: "+t.stringValue(e)),this.data[e]=n},getData(e){return this.data[e]||t.error("Undefined data set name: "+t.stringValue(e)),this.data[e]},addDataPipeline(e,n){return t.hasOwnProperty(this.data,e)&&t.error("Duplicate data set name: "+t.stringValue(e)),this.addData(e,wn.fromEntries(this,n))}},e.AxisDomainRole=x,e.AxisGridRole=k,e.AxisLabelRole=v,e.AxisRole=b,e.AxisTickRole=$,e.AxisTitleRole=S,e.DataScope=wn,e.FrameRole=h,e.LegendEntryRole=j,e.LegendLabelRole=z,e.LegendRole=O,e.LegendSymbolRole=D,e.LegendTitleRole=V,e.MarkRole=m,e.Scope=bi,e.ScopeRole=y,e.config=Si,e.parse=function(e,n,i){return t.isObject(e)||t.error("Input Vega specification must be an object."),hi(e,new bi(n=t.mergeConfig(Si(),n,e.config),i)).toRuntime()},e.signal=Y,e.signalUpdates=be,e.stream=ce})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-util"),require("vega-functions"),require("vega-event-selector"),require("vega-scale"),require("vega-dataflow")):"function"==typeof define&&define.amd?define(["exports","vega-util","vega-functions","vega-event-selector","vega-scale","vega-dataflow"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).vega={},e.vega,e.vega,e.vega,e.vega,e.vega)}(this,(function(e,t,n,i,a,r){"use strict";function s(e){return t.isObject(e)?e:{type:e||"pad"}}const l=e=>+e||0,o=e=>({top:e,bottom:e,left:e,right:e});function u(e){return t.isObject(e)?e.signal?e:{top:l(e.top),bottom:l(e.bottom),left:l(e.left),right:l(e.right)}:o(l(e))}const c=e=>t.isObject(e)&&!t.isArray(e)?t.extend({},e):{value:e};function d(e,n,i,a){if(null!=i){return t.isObject(i)&&!t.isArray(i)||t.isArray(i)&&i.length&&t.isObject(i[0])?e.update[n]=i:e[a||"enter"][n]={value:i},1}return 0}function p(e,t,n){for(const n in t)d(e,n,t[n]);for(const t in n)d(e,t,n[t],"update")}function f(e,n,i){for(const a in n)i&&t.hasOwnProperty(i,a)||(e[a]=t.extend(e[a]||{},n[a]));return e}function g(e,t){return t&&(t.enter&&t.enter[e]||t.update&&t.update[e])}const m="mark",h="frame",y="scope",b="axis",x="axis-domain",k="axis-grid",v="axis-label",$="axis-tick",S="axis-title",O="legend",R="legend-band",j="legend-entry",w="legend-gradient",z="legend-label",D="legend-symbol",V="legend-title",W="title",E="title-text",P="title-subtitle";function C(e,t,n){e[t]=n&&n.signal?{signal:n.signal}:{value:n}}const _=e=>t.isString(e)?t.stringValue(e):e.signal?`(${e.signal})`:T(e);function L(e){if(null!=e.gradient)return function(e){const n=[e.start,e.stop,e.count].map((e=>null==e?null:t.stringValue(e)));for(;n.length&&null==t.peek(n);)n.pop();return n.unshift(_(e.gradient)),`gradient(${n.join(",")})`}(e);let n=e.signal?`(${e.signal})`:e.color?function(e){return e.c?F("hcl",e.h,e.c,e.l):e.h||e.s?F("hsl",e.h,e.s,e.l):e.l||e.a?F("lab",e.l,e.a,e.b):e.r||e.g||e.b?F("rgb",e.r,e.g,e.b):null}(e.color):null!=e.field?T(e.field):void 0!==e.value?t.stringValue(e.value):void 0;return null!=e.scale&&(n=function(e,t){const n=_(e.scale);null!=e.range?t=`lerp(_range(${n}), ${+e.range})`:(void 0!==t&&(t=`_scale(${n}, ${t})`),e.band&&(t=(t?t+"+":"")+`_bandwidth(${n})`+(1==+e.band?"":"*"+A(e.band)),e.extra&&(t=`(datum.extra ? _scale(${n}, datum.extra.value) : ${t})`)),null==t&&(t="0"));return t}(e,n)),void 0===n&&(n=null),null!=e.exponent&&(n=`pow(${n},${A(e.exponent)})`),null!=e.mult&&(n+=`*${A(e.mult)}`),null!=e.offset&&(n+=`+${A(e.offset)}`),e.round&&(n=`round(${n})`),n}const F=(e,t,n,i)=>`(${e}(${[t,n,i].map(L).join(",")})+'')`;function A(e){return t.isObject(e)?"("+L(e)+")":e}function T(e){return B(t.isObject(e)?e:{datum:e})}function B(e){let n,i,a;if(e.signal)n="datum",a=e.signal;else if(e.group||e.parent){for(i=Math.max(1,e.level||1),n="item";i-- >0;)n+=".mark.group";e.parent?(a=e.parent,n+=".datum"):a=e.group}else e.datum?(n="datum",a=e.datum):t.error("Invalid field reference: "+t.stringValue(e));return e.signal||(a=t.isString(a)?t.splitAccessPath(a).map(t.stringValue).join("]["):B(a)),n+"["+a+"]"}function U(e,n,i,a,r,s){const l={};(s=s||{}).encoders={$encode:l},e=function(e,n,i,a,r){const s={},l={};let o,u,c,d;for(u in u="lineBreak","text"!==n||null==r[u]||g(u,e)||C(s,u,r[u]),("legend"==i||String(i).startsWith("axis"))&&(i=null),d=i===h?r.group:i===m?t.extend({},r.mark,r[n]):null,d)c=g(u,e)||("fill"===u||"stroke"===u)&&(g("fill",e)||g("stroke",e)),c||C(s,u,d[u]);for(u in t.array(a).forEach((t=>{const n=r.style&&r.style[t];for(const t in n)g(t,e)||C(s,t,n[t])})),e=t.extend({},e),s)d=s[u],d.signal?(o=o||{})[u]=d:l[u]=d;return e.enter=t.extend(l,e.enter),o&&(e.update=t.extend(o,e.update)),e}(e,n,i,a,r.config);for(const t in e)l[t]=M(e[t],n,s,r);return s}function M(e,n,i,a){const r={},s={};for(const n in e)null!=e[n]&&(r[n]=q((l=e[n],t.isArray(l)?function(e){let n="";return e.forEach((e=>{const t=L(e);n+=e.test?`(${e.test})?${t}:`:t})),":"===t.peek(n)&&(n+="null"),n}(l):L(l)),a,i,s));var l;return{$expr:{marktype:n,channels:r},$fields:Object.keys(s),$output:Object.keys(e)}}function q(e,i,a,r){const s=n.parseExpression(e,i);return s.$fields.forEach((e=>r[e]=1)),t.extend(a,s.$params),s.$expr}const H="outer",I=["value","update","init","react","bind"];function X(e,n){t.error(e+' for "outer" push: '+t.stringValue(n))}function Y(e,t){const n=e.name;if(e.push===H)t.signals[n]||X("No prior signal definition",n),I.forEach((t=>{void 0!==e[t]&&X("Invalid property ",t)}));else{const i=t.addSignal(n,e.value);!1===e.react&&(i.react=!1),e.bind&&t.addBinding(n,e.bind)}}function N(e,t,n,i){this.id=-1,this.type=e,this.value=t,this.params=n,i&&(this.parent=i)}function G(e,t,n,i){return new N(e,t,n,i)}function Q(e,t){return G("operator",e,t)}function J(e){const t={$ref:e.id};return e.id<0&&(e.refs=e.refs||[]).push(t),t}function K(e,t){return t?{$field:e,$name:t}:{$field:e}}const Z=K("key");function ee(e,t){return{$compare:e,$order:t}}const te="descending";function ne(e,t){return(e&&e.signal?"$"+e.signal:e||"")+(e&&t?"_":"")+(t&&t.signal?"$"+t.signal:t||"")}const ie="scope",ae="view";function re(e){return e&&e.signal}function se(e){if(re(e))return!0;if(t.isObject(e))for(const t in e)if(se(e[t]))return!0;return!1}function le(e,t){return null!=e?e:t}function oe(e){return e&&e.signal||e}const ue="timer";function ce(e,n){return(e.merge?de:e.stream?pe:e.type?fe:t.error("Invalid stream specification: "+t.stringValue(e)))(e,n)}function de(e,t){const n=ge({merge:e.merge.map((e=>ce(e,t)))},e,t);return t.addStream(n).id}function pe(e,t){const n=ge({stream:ce(e.stream,t)},e,t);return t.addStream(n).id}function fe(e,t){let n;var i;e.type===ue?(n=t.event(ue,e.throttle),e={between:e.between,filter:e.filter}):n=t.event((i=e.source)===ie?ae:i||ae,e.type);const a=ge({stream:n},e,t);return 1===Object.keys(a).length?n:t.addStream(a).id}function ge(e,i,a){let r=i.between;return r&&(2!==r.length&&t.error('Stream "between" parameter must have 2 entries: '+t.stringValue(i)),e.between=[ce(r[0],a),ce(r[1],a)]),r=i.filter?[].concat(i.filter):[],(i.marktype||i.markname||i.markrole)&&r.push(function(e,t,n){const i="event.item";return i+(e&&"*"!==e?"&&"+i+".mark.marktype==='"+e+"'":"")+(n?"&&"+i+".mark.role==='"+n+"'":"")+(t?"&&"+i+".mark.name==='"+t+"'":"")}(i.marktype,i.markname,i.markrole)),i.source===ie&&r.push("inScope(event.item)"),r.length&&(e.filter=n.parseExpression("("+r.join(")&&(")+")",a).$expr),null!=(r=i.throttle)&&(e.throttle=+r),null!=(r=i.debounce)&&(e.debounce=+r),i.consume&&(e.consume=!0),e}const me={code:"_.$value",ast:{type:"Identifier",value:"value"}};function he(e,a,r){const s=e.encode,l={target:r};let o=e.events,u=e.update,c=[];o||t.error("Signal update missing events specification."),t.isString(o)&&(o=i.parseSelector(o,a.isSubscope()?ie:ae)),o=t.array(o).filter((e=>e.signal||e.scale?(c.push(e),0):1)),c.length>1&&(c=[ye(c)]),o.length&&c.push(o.length>1?{merge:o}:o[0]),null!=s&&(u&&t.error("Signal encode and update are mutually exclusive."),u="encode(item(),"+t.stringValue(s)+")"),l.update=t.isString(u)?n.parseExpression(u,a):null!=u.expr?n.parseExpression(u.expr,a):null!=u.value?u.value:null!=u.signal?{$expr:me,$params:{$value:a.signalRef(u.signal)}}:t.error("Invalid signal update specification."),e.force&&(l.options={force:!0}),c.forEach((e=>a.addUpdate(t.extend(function(e,t){return{source:e.signal?t.signalRef(e.signal):e.scale?t.scaleRef(e.scale):ce(e,t)}}(e,a),l))))}function ye(e){return{signal:"["+e.map((e=>e.scale?'scale("'+e.scale+'")':e.signal))+"]"}}function be(e,i){const a=i.getSignal(e.name);let r=e.update;e.init&&(r?t.error("Signals can not include both init and update expressions."):(r=e.init,a.initonly=!0)),r&&(r=n.parseExpression(r,i),a.update=r.$expr,a.params=r.$params),e.on&&e.on.forEach((e=>he(e,i,a.id)))}const xe=e=>(t,n,i)=>G(e,n,t||void 0,i),ke=xe("aggregate"),ve=xe("axisticks"),$e=xe("bound"),Se=xe("collect"),Oe=xe("compare"),Re=xe("datajoin"),je=xe("encode"),we=xe("expression"),ze=xe("facet"),De=xe("field"),Ve=xe("key"),We=xe("legendentries"),Ee=xe("load"),Pe=xe("mark"),Ce=xe("multiextent"),_e=xe("multivalues"),Le=xe("overlap"),Fe=xe("params"),Ae=xe("prefacet"),Te=xe("projection"),Be=xe("proxy"),Ue=xe("relay"),Me=xe("render"),qe=xe("scale"),He=xe("sieve"),Ie=xe("sortitems"),Xe=xe("viewlayout"),Ye=xe("values");let Ne=0;const Ge={min:"min",max:"max",count:"sum"};function Qe(e,n){const i=n.getScale(e.name).params;let a;for(a in i.domain=et(e.domain,e,n),null!=e.range&&(i.range=ot(e,n,i)),null!=e.interpolate&&function(e,t){t.interpolate=Je(e.type||e),null!=e.gamma&&(t.interpolateGamma=Je(e.gamma))}(e.interpolate,i),null!=e.nice&&(i.nice=function(e,n){return e.signal?n.signalRef(e.signal):t.isObject(e)?{interval:Je(e.interval),step:Je(e.step)}:Je(e)}(e.nice,n)),null!=e.bins&&(i.bins=function(e,n){return e.signal||t.isArray(e)?Ke(e,n):n.objectProperty(e)}(e.bins,n)),e)t.hasOwnProperty(i,a)||"name"===a||(i[a]=Je(e[a],n))}function Je(e,n){return t.isObject(e)?e.signal?n.signalRef(e.signal):t.error("Unsupported object: "+t.stringValue(e)):e}function Ke(e,t){return e.signal?t.signalRef(e.signal):e.map((e=>Je(e,t)))}function Ze(e){t.error("Can not find data set: "+t.stringValue(e))}function et(e,n,i){if(e)return e.signal?i.signalRef(e.signal):(t.isArray(e)?tt:e.fields?it:nt)(e,n,i);null==n.domainMin&&null==n.domainMax||t.error("No scale domain defined for domainMin/domainMax to override.")}function tt(e,t,n){return e.map((e=>Je(e,n)))}function nt(e,t,n){const i=n.getData(e.data);return i||Ze(e.data),a.isDiscrete(t.type)?i.valuesRef(n,e.field,rt(e.sort,!1)):a.isQuantile(t.type)?i.domainRef(n,e.field):i.extentRef(n,e.field)}function it(e,n,i){const r=e.data,s=e.fields.reduce(((e,n)=>(n=t.isString(n)?{data:r,field:n}:t.isArray(n)||n.signal?function(e,n){const i="_:vega:_"+Ne++,a=Se({});if(t.isArray(e))a.value={$ingest:e};else if(e.signal){const r="setdata("+t.stringValue(i)+","+e.signal+")";a.params.input=n.signalRef(r)}return n.addDataPipeline(i,[a,He({})]),{data:i,field:"data"}}(n,i):n,e.push(n),e)),[]);return(a.isDiscrete(n.type)?at:a.isQuantile(n.type)?st:lt)(e,i,s)}function at(e,t,n){const i=rt(e.sort,!0);let a,r;const s=n.map((e=>{const n=t.getData(e.data);return n||Ze(e.data),n.countsRef(t,e.field,i)})),l={groupby:Z,pulse:s};i&&(a=i.op||"count",r=i.field?ne(a,i.field):"count",l.ops=[Ge[a]],l.fields=[t.fieldRef(r)],l.as=[r]),a=t.add(ke(l));const o=t.add(Se({pulse:J(a)}));return r=t.add(Ye({field:Z,sort:t.sortRef(i),pulse:J(o)})),J(r)}function rt(e,n){return e&&(e.field||e.op?e.field||"count"===e.op?n&&e.field&&e.op&&!Ge[e.op]&&t.error("Multiple domain scales can not be sorted using "+e.op):t.error("No field provided for sort aggregate op: "+e.op):t.isObject(e)?e.field="key":e={field:"key"}),e}function st(e,t,n){const i=n.map((e=>{const n=t.getData(e.data);return n||Ze(e.data),n.domainRef(t,e.field)}));return J(t.add(_e({values:i})))}function lt(e,t,n){const i=n.map((e=>{const n=t.getData(e.data);return n||Ze(e.data),n.extentRef(t,e.field)}));return J(t.add(Ce({extents:i})))}function ot(e,n,i){const r=n.config.range;let s=e.range;if(s.signal)return n.signalRef(s.signal);if(t.isString(s)){if(r&&t.hasOwnProperty(r,s))return ot(e=t.extend({},e,{range:r[s]}),n,i);"width"===s?s=[0,{signal:"width"}]:"height"===s?s=a.isDiscrete(e.type)?[0,{signal:"height"}]:[{signal:"height"},0]:t.error("Unrecognized scale range value: "+t.stringValue(s))}else{if(s.scheme)return i.scheme=t.isArray(s.scheme)?Ke(s.scheme,n):Je(s.scheme,n),s.extent&&(i.schemeExtent=Ke(s.extent,n)),void(s.count&&(i.schemeCount=Je(s.count,n)));if(s.step)return void(i.rangeStep=Je(s.step,n));if(a.isDiscrete(e.type)&&!t.isArray(s))return et(s,e,n);t.isArray(s)||t.error("Unsupported range type: "+t.stringValue(s))}return s.map((e=>(t.isArray(e)?Ke:Je)(e,n)))}function ut(e,n,i){return t.isArray(e)?e.map((e=>ut(e,n,i))):t.isObject(e)?e.signal?i.signalRef(e.signal):"fit"===n?e:t.error("Unsupported parameter object: "+t.stringValue(e)):e}const ct="top",dt="left",pt="right",ft="bottom",gt="center",mt="vertical",ht="start",yt="end",bt="index",xt="label",kt="offset",vt="perc",$t="perc2",St="value",Ot="guide-label",Rt="guide-title",jt="group-title",wt="group-subtitle",zt="symbol",Dt="gradient",Vt="discrete",Wt="size",Et=[Wt,"shape","fill","stroke","strokeWidth","strokeDash","opacity"],Pt={name:1,style:1,interactive:1},Ct={value:0},_t={value:1},Lt="group",Ft="rect",At="rule",Tt="symbol",Bt="text";function Ut(e){return e.type=Lt,e.interactive=e.interactive||!1,e}function Mt(e,t){const n=(n,i)=>le(e[n],le(t[n],i));return n.isVertical=n=>mt===le(e.direction,t.direction||(n?t.symbolDirection:t.gradientDirection)),n.gradientLength=()=>le(e.gradientLength,t.gradientLength||t.gradientWidth),n.gradientThickness=()=>le(e.gradientThickness,t.gradientThickness||t.gradientHeight),n.entryColumns=()=>le(e.columns,le(t.columns,+n.isVertical(!0))),n}function qt(e,t){const n=t&&(t.update&&t.update[e]||t.enter&&t.enter[e]);return n&&n.signal?n:n?n.value:null}function Ht(e,t,n){return`item.anchor === '${ht}' ? ${e} : item.anchor === '${yt}' ? ${t} : ${n}`}const It=Ht(t.stringValue(dt),t.stringValue(pt),t.stringValue(gt));function Xt(e,n){return n?e?t.isObject(e)?Object.assign({},e,{offset:Xt(e.offset,n)}):{value:e,offset:n}:n:e}function Yt(e,t){return t?(e.name=t.name,e.style=t.style||e.style,e.interactive=!!t.interactive,e.encode=f(e.encode,t,Pt)):e.interactive=!1,e}function Nt(e,n,i,a){const r=Mt(e,i),s=r.isVertical(),l=r.gradientThickness(),o=r.gradientLength();let u,d,f,g,m;s?(d=[0,1],f=[0,0],g=l,m=o):(d=[0,0],f=[1,0],g=o,m=l);const h={enter:u={opacity:Ct,x:Ct,y:Ct,width:c(g),height:c(m)},update:t.extend({},u,{opacity:_t,fill:{gradient:n,start:d,stop:f}}),exit:{opacity:Ct}};return p(h,{stroke:r("gradientStrokeColor"),strokeWidth:r("gradientStrokeWidth")},{opacity:r("gradientOpacity")}),Yt({type:Ft,role:w,encode:h},a)}function Gt(e,n,i,a,r){const s=Mt(e,i),l=s.isVertical(),o=s.gradientThickness(),u=s.gradientLength();let d,f,g,m,h="";l?(d="y",g="y2",f="x",m="width",h="1-"):(d="x",g="x2",f="y",m="height");const y={opacity:Ct,fill:{scale:n,field:St}};y[d]={signal:h+"datum."+vt,mult:u},y[f]=Ct,y[g]={signal:h+"datum."+$t,mult:u},y[m]=c(o);const b={enter:y,update:t.extend({},y,{opacity:_t}),exit:{opacity:Ct}};return p(b,{stroke:s("gradientStrokeColor"),strokeWidth:s("gradientStrokeWidth")},{opacity:s("gradientOpacity")}),Yt({type:Ft,role:R,key:St,from:r,encode:b},a)}const Qt=`datum.${vt}<=0?"${dt}":datum.${vt}>=1?"${pt}":"${gt}"`,Jt=`datum.${vt}<=0?"${ft}":datum.${vt}>=1?"${ct}":"middle"`;function Kt(e,t,n,i){const a=Mt(e,t),r=a.isVertical(),s=c(a.gradientThickness()),l=a.gradientLength();let o,u,d,f,g=a("labelOverlap"),m="";const h={enter:o={opacity:Ct},update:u={opacity:_t,text:{field:xt}},exit:{opacity:Ct}};return p(h,{fill:a("labelColor"),fillOpacity:a("labelOpacity"),font:a("labelFont"),fontSize:a("labelFontSize"),fontStyle:a("labelFontStyle"),fontWeight:a("labelFontWeight"),limit:le(e.labelLimit,t.gradientLabelLimit)}),r?(o.align={value:"left"},o.baseline=u.baseline={signal:Jt},d="y",f="x",m="1-"):(o.align=u.align={signal:Qt},o.baseline={value:"top"},d="x",f="y"),o[d]=u[d]={signal:m+"datum."+vt,mult:l},o[f]=u[f]=s,s.offset=le(e.labelOffset,t.gradientLabelOffset)||0,g=g?{separation:a("labelSeparation"),method:g,order:"datum."+bt}:void 0,Yt({type:Bt,role:z,style:Ot,key:St,from:i,encode:h,overlap:g},n)}function Zt(e,t,n,i,a){const r=Mt(e,t),s=n.entries,l=!(!s||!s.interactive),o=s?s.name:void 0,u=r("clipHeight"),d=r("symbolOffset"),g={data:"value"},m=`(${a}) ? datum.${kt} : datum.${Wt}`,h=u?c(u):{field:Wt},b=`datum.${bt}`,x=`max(1, ${a})`;let k,v,$,S,O;h.mult=.5,k={enter:v={opacity:Ct,x:{signal:m,mult:.5,offset:d},y:h},update:$={opacity:_t,x:v.x,y:v.y},exit:{opacity:Ct}};let R=null,j=null;e.fill||(R=t.symbolBaseFillColor,j=t.symbolBaseStrokeColor),p(k,{fill:r("symbolFillColor",R),shape:r("symbolType"),size:r("symbolSize"),stroke:r("symbolStrokeColor",j),strokeDash:r("symbolDash"),strokeDashOffset:r("symbolDashOffset"),strokeWidth:r("symbolStrokeWidth")},{opacity:r("symbolOpacity")}),Et.forEach((t=>{e[t]&&($[t]=v[t]={scale:e[t],field:St})}));const w=Yt({type:Tt,role:D,key:St,from:g,clip:!!u||void 0,encode:k},n.symbols),V=c(d);V.offset=r("labelOffset"),k={enter:v={opacity:Ct,x:{signal:m,offset:V},y:h},update:$={opacity:_t,text:{field:xt},x:v.x,y:v.y},exit:{opacity:Ct}},p(k,{align:r("labelAlign"),baseline:r("labelBaseline"),fill:r("labelColor"),fillOpacity:r("labelOpacity"),font:r("labelFont"),fontSize:r("labelFontSize"),fontStyle:r("labelFontStyle"),fontWeight:r("labelFontWeight"),limit:r("labelLimit")});const W=Yt({type:Bt,role:z,style:Ot,key:St,from:g,encode:k},n.labels);return k={enter:{noBound:{value:!u},width:Ct,height:u?c(u):Ct,opacity:Ct},exit:{opacity:Ct},update:$={opacity:_t,row:{signal:null},column:{signal:null}}},r.isVertical(!0)?(S=`ceil(item.mark.items.length / ${x})`,$.row.signal=`${b}%${S}`,$.column.signal=`floor(${b} / ${S})`,O={field:["row",b]}):($.row.signal=`floor(${b} / ${x})`,$.column.signal=`${b} % ${x}`,O={field:b}),$.column.signal=`(${a})?${$.column.signal}:${b}`,Ut({role:y,from:i={facet:{data:i,name:"value",groupby:bt}},encode:f(k,s,Pt),marks:[w,W],name:o,interactive:l,sort:O})}const en='item.orient === "left"',tn='item.orient === "right"',nn=`(${en} || ${tn})`,an=`datum.vgrad && ${nn}`,rn=Ht('"top"','"bottom"','"middle"'),sn=`datum.vgrad && ${tn} ? (${Ht('"right"','"left"','"center"')}) : (${nn} && !(datum.vgrad && ${en})) ? "left" : ${It}`,ln=`item._anchor || (${nn} ? "middle" : "start")`,on=`${an} ? (${en} ? -90 : 90) : 0`,un=`${nn} ? (datum.vgrad ? (${tn} ? "bottom" : "top") : ${rn}) : "top"`;function cn(e,n){let i;return t.isObject(e)&&(e.signal?i=e.signal:e.path?i="pathShape("+dn(e.path)+")":e.sphere&&(i="geoShape("+dn(e.sphere)+', {type: "Sphere"})')),i?n.signalRef(i):!!e}function dn(e){return t.isObject(e)&&e.signal?e.signal:t.stringValue(e)}function pn(e){const t=e.role||"";return t.startsWith("axis")||t.startsWith("legend")||t.startsWith("title")?t:e.type===Lt?y:t||m}function fn(e){return{marktype:e.type,name:e.name||void 0,role:e.role||pn(e),zindex:+e.zindex||void 0,aria:e.aria,description:e.description}}function gn(e,t){return e&&e.signal?t.signalRef(e.signal):!1!==e}function mn(e,n){const i=r.definition(e.type);i||t.error("Unrecognized transform type: "+t.stringValue(e.type));const a=G(i.type.toLowerCase(),null,hn(i,e,n));return e.signal&&n.addSignal(e.signal,n.proxy(a)),a.metadata=i.metadata||{},a}function hn(e,t,n){const i={},a=e.params.length;for(let r=0;r<a;++r){const a=e.params[r];i[a.name]=yn(a,t,n)}return i}function yn(e,n,i){const a=e.type,r=n[e.name];return"index"===a?function(e,n,i){t.isString(n.from)||t.error('Lookup "from" parameter must be a string literal.');return i.getData(n.from).lookupRef(i,n.key)}(0,n,i):void 0!==r?"param"===a?function(e,n,i){const a=n[e.name];return e.array?(t.isArray(a)||t.error("Expected an array of sub-parameters. Instead: "+t.stringValue(a)),a.map((t=>xn(e,t,i)))):xn(e,a,i)}(e,n,i):"projection"===a?i.projectionRef(n[e.name]):e.array&&!re(r)?r.map((t=>bn(e,t,i))):bn(e,r,i):void(e.required&&t.error("Missing required "+t.stringValue(n.type)+" parameter: "+t.stringValue(e.name)))}function bn(e,i,a){const r=e.type;if(re(i))return Sn(r)?t.error("Expression references can not be signals."):On(r)?a.fieldRef(i):Rn(r)?a.compareRef(i):a.signalRef(i.signal);{const t=e.expr||On(r);return t&&kn(i)?a.exprRef(i.expr,i.as):t&&vn(i)?K(i.field,i.as):Sn(r)?n.parseExpression(i,a):$n(r)?J(a.getData(i).values):On(r)?K(i):Rn(r)?a.compareRef(i):i}}function xn(e,n,i){const a=e.params.length;let r;for(let t=0;t<a;++t){r=e.params[t];for(const e in r.key)if(r.key[e]!==n[e]){r=null;break}if(r)break}r||t.error("Unsupported parameter: "+t.stringValue(n));const s=t.extend(hn(r,n,i),r.key);return J(i.add(Fe(s)))}const kn=e=>e&&e.expr,vn=e=>e&&e.field,$n=e=>"data"===e,Sn=e=>"expr"===e,On=e=>"field"===e,Rn=e=>"compare"===e;function jn(e,t){return e.$ref?e:e.data&&e.data.$ref?e.data:J(t.getData(e.data).output)}function wn(e,t,n,i,a){this.scope=e,this.input=t,this.output=n,this.values=i,this.aggregate=a,this.index={}}function zn(e){return t.isString(e)?e:null}function Dn(e,t,n){const i=ne(n.op,n.field);let a;if(t.ops){for(let e=0,n=t.as.length;e<n;++e)if(t.as[e]===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 Vn(e,n,i,a,r,s,l){const o=n[i]||(n[i]={}),u=function(e){return t.isObject(e)?(e.order===te?"-":"+")+ne(e.op,e.field):""}(s);let c,d,p=zn(r);if(null!=p&&(e=n.scope,p+=u?"|"+u:"",c=o[p]),!c){const t=s?{field:Z,pulse:n.countsRef(e,r,s)}:{field:e.fieldRef(r),pulse:J(n.output)};u&&(t.sort=e.sortRef(s)),d=e.add(G(a,void 0,t)),l&&(n.index[r]=d),c=J(d),null!=p&&(o[p]=c)}return c}function Wn(e,t,i){const a=e.remove,r=e.insert,s=e.toggle,l=e.modify,o=e.values,u=t.add(Q()),c="if("+e.trigger+',modify("'+i+'",'+[r,a,s,l,o].map((e=>null==e?"null":e)).join(",")+"),0)",d=n.parseExpression(c,t);u.update=d.$expr,u.params=d.$params}function En(e,n){const i=pn(e),a=e.type===Lt,r=e.from&&e.from.facet,s=e.overlap;let l,o,u,c,d,p,f,g=e.layout||i===y||i===h;const b=i===m||g||r,x=function(e,n,i){let a,r,s,l,o;return e?(a=e.facet)&&(n||t.error("Only group marks can be faceted."),null!=a.field?l=o=jn(a,i):(e.data?o=J(i.getData(e.data).aggregate):(s=mn(t.extend({type:"aggregate",groupby:t.array(a.groupby)},a.aggregate),i),s.params.key=i.keyRef(a.groupby),s.params.pulse=jn(a,i),l=o=J(i.add(s))),r=i.keyRef(a.groupby,!0))):l=J(i.add(Se(null,[{}]))),l||(l=jn(e,i)),{key:r,pulse:l,parent:o}}(e.from,a,n);o=n.add(Re({key:x.key||(e.key?K(e.key):void 0),pulse:x.pulse,clean:!a}));const k=J(o);o=u=n.add(Se({pulse:k})),o=n.add(Pe({markdef:fn(e),interactive:gn(e.interactive,n),clip:cn(e.clip,n),context:{$context:!0},groups:n.lookup(),parent:n.signals.parent?n.signalRef("parent"):null,index:n.markpath(),pulse:J(o)}));const v=J(o);o=c=n.add(je(U(e.encode,e.type,i,e.style,n,{mod:!1,pulse:v}))),o.params.parent=n.encode(),e.transform&&e.transform.forEach((e=>{const i=mn(e,n),a=i.metadata;(a.generates||a.changes)&&t.error("Mark transforms should not generate new data."),a.nomod||(c.params.mod=!0),i.params.pulse=J(o),n.add(o=i)})),e.sort&&(o=n.add(Ie({sort:n.compareRef(e.sort),pulse:J(o)})));const $=J(o);(r||g)&&(g=n.add(Xe({layout:n.objectProperty(e.layout),legends:n.legends,mark:v,pulse:$})),p=J(g));const S=n.add($e({mark:v,pulse:p||$}));f=J(S),a&&(b&&(l=n.operators,l.pop(),g&&l.pop()),n.pushState($,p||f,k),r?function(e,n,i){const a=e.from.facet,r=a.name,s=jn(a,n);let l;a.name||t.error("Facet must have a name: "+t.stringValue(a)),a.data||t.error("Facet must reference a data set: "+t.stringValue(a)),a.field?l=n.add(Ae({field:n.fieldRef(a.field),pulse:s})):a.groupby?l=n.add(ze({key:n.keyRef(a.groupby),group:J(n.proxy(i.parent)),pulse:s})):t.error("Facet must specify groupby or field: "+t.stringValue(a));const o=n.fork(),u=o.add(Se()),c=o.add(He({pulse:J(u)}));o.addData(r,new wn(o,u,u,c)),o.addSignal("parent",null),l.params.subflow={$subflow:o.parse(e).toRuntime()}}(e,n,x):b?function(e,t,n){const i=t.add(Ae({pulse:n.pulse})),a=t.fork();a.add(He()),a.addSignal("parent",null),i.params.subflow={$subflow:a.parse(e).toRuntime()}}(e,n,x):n.parse(e),n.popState(),b&&(g&&l.push(g),l.push(S))),s&&(f=function(e,t,n){const i=e.method,a=e.bound,r=e.separation,s={separation:re(r)?n.signalRef(r.signal):r,method:re(i)?n.signalRef(i.signal):i,pulse:t};e.order&&(s.sort=n.compareRef({field:e.order}));if(a){const e=a.tolerance;s.boundTolerance=re(e)?n.signalRef(e.signal):+e,s.boundScale=n.scaleRef(a.scale),s.boundOrient=a.orient}return J(n.add(Le(s)))}(s,f,n));const O=n.add(Me({pulse:f})),R=n.add(He({pulse:J(O)},void 0,n.parent()));null!=e.name&&(d=e.name,n.addData(d,new wn(n,u,O,R)),e.on&&e.on.forEach((e=>{(e.insert||e.remove||e.toggle)&&t.error("Marks only support modify triggers."),Wn(e,n,d)})))}function Pn(e,i){const r=i.config.legend,s=e.encode||{},l=Mt(e,r),o=s.legend||{},u=o.name||void 0,c=o.interactive,d=o.style,g={};let m,h,y,b=0;Et.forEach((t=>e[t]?(g[t]=e[t],b=b||e[t]):0)),b||t.error("Missing valid scale for legend.");const x=function(e,t){let n=e.type||zt;e.type||1!==function(e){return Et.reduce(((t,n)=>t+(e[n]?1:0)),0)}(e)||!e.fill&&!e.stroke||(n=a.isContinuous(t)?Dt:a.isDiscretizing(t)?Vt:zt);return n!==Dt?n:a.isDiscretizing(t)?Vt:Dt}(e,i.scaleType(b)),k={title:null!=e.title,scales:g,type:x,vgrad:"symbol"!==x&&l.isVertical()},v=J(i.add(Se(null,[k]))),$=J(i.add(We(h={type:x,scale:i.scaleRef(b),count:i.objectProperty(l("tickCount")),limit:i.property(l("symbolLimit")),values:i.objectProperty(e.values),minstep:i.property(e.tickMinStep),formatType:i.property(e.formatType),formatSpecifier:i.property(e.format)})));return x===Dt?(y=[Nt(e,b,r,s.gradient),Kt(e,r,s.labels,$)],h.count=h.count||i.signalRef(`max(2,2*floor((${oe(l.gradientLength())})/100))`)):x===Vt?y=[Gt(e,b,r,s.gradient,$),Kt(e,r,s.labels,$)]:(m=function(e,t){const n=Mt(e,t);return{align:n("gridAlign"),columns:n.entryColumns(),center:{row:!0,column:!1},padding:{row:n("rowPadding"),column:n("columnPadding")}}}(e,r),y=[Zt(e,r,s,$,oe(m.columns))],h.size=function(e,t,i){const a=oe(_n("size",e,i)),r=oe(_n("strokeWidth",e,i)),s=oe(function(e,t,n){return qt("fontSize",e)||function(e,t,n){const i=t.config.style[n];return i&&i[e]}("fontSize",t,n)}(i[1].encode,t,Ot));return n.parseExpression(`max(ceil(sqrt(${a})+${r}),${s})`,t)}(e,i,y[0].marks)),y=[Ut({role:j,from:v,encode:{enter:{x:{value:0},y:{value:0}}},marks:y,layout:m,interactive:c})],k.title&&y.push(function(e,t,n,i){const a=Mt(e,t),r={enter:{opacity:Ct},update:{opacity:_t,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:Ct}};return p(r,{orient:a("titleOrient"),_anchor:a("titleAnchor"),anchor:{signal:ln},angle:{signal:on},align:{signal:sn},baseline:{signal:un},text:e.title,fill:a("titleColor"),fillOpacity:a("titleOpacity"),font:a("titleFont"),fontSize:a("titleFontSize"),fontStyle:a("titleFontStyle"),fontWeight:a("titleFontWeight"),limit:a("titleLimit"),lineHeight:a("titleLineHeight")},{align:a("titleAlign"),baseline:a("titleBaseline")}),Yt({type:Bt,role:V,style:Rt,from:i,encode:r},n)}(e,r,s.title,v)),En(Ut({role:O,from:v,encode:f(Cn(l,e,r),o,Pt),marks:y,aria:l("aria"),description:l("description"),zindex:l("zindex"),name:u,interactive:c,style:d}),i)}function Cn(e,t,n){const i={enter:{},update:{}};return p(i,{orient:e("orient"),offset:e("offset"),padding:e("padding"),titlePadding:e("titlePadding"),cornerRadius:e("cornerRadius"),fill:e("fillColor"),stroke:e("strokeColor"),strokeWidth:n.strokeWidth,strokeDash:n.strokeDash,x:e("legendX"),y:e("legendY"),format:t.format,formatType:t.formatType}),i}function _n(e,t,n){return t[e]?`scale("${t[e]}",datum)`:qt(e,n[0].encode)}wn.fromEntries=function(e,t){const n=t.length,i=t[n-1],a=t[n-2];let r=t[0],s=null,l=1;for(r&&"load"===r.type&&(r=t[1]),e.add(t[0]);l<n;++l)t[l].params.pulse=J(t[l-1]),e.add(t[l]),"aggregate"===t[l].type&&(s=t[l]);return new wn(e,r,a,i,s)},wn.prototype={countsRef(e,t,n){const i=this,a=i.counts||(i.counts={}),r=zn(t);let s,l,o;return null!=r&&(e=i.scope,s=a[r]),s?n&&n.field&&Dn(e,s.agg.params,n):(o={groupby:e.fieldRef(t,"key"),pulse:J(i.output)},n&&n.field&&Dn(e,o,n),l=e.add(ke(o)),s=e.add(Se({pulse:J(l)})),s={agg:l,ref:J(s)},null!=r&&(a[r]=s)),s.ref},tuplesRef(){return J(this.values)},extentRef(e,t){return Vn(e,this,"extent","extent",t,!1)},domainRef(e,t){return Vn(e,this,"domain","values",t,!1)},valuesRef(e,t,n){return Vn(e,this,"vals","values",t,n||!0)},lookupRef(e,t){return Vn(e,this,"lookup","tupleindex",t,!1)},indataRef(e,t){return Vn(e,this,"indata","tupleindex",t,!0,!0)}};const Ln=`item.orient==="${dt}"?-90:item.orient==="${pt}"?90:0`;function Fn(e,n){const i=Mt(e=t.isString(e)?{text:e}:e,n.config.title),a=e.encode||{},r=a.group||{},s=r.name||void 0,l=r.interactive,o=r.style,u=[],c=J(n.add(Se(null,[{}])));return u.push(function(e,t,n,i){const a={value:0},r=e.text,s={enter:{opacity:a},update:{opacity:{value:1}},exit:{opacity:a}};return p(s,{text:r,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:t("dx"),dy:t("dy"),fill:t("color"),font:t("font"),fontSize:t("fontSize"),fontStyle:t("fontStyle"),fontWeight:t("fontWeight"),lineHeight:t("lineHeight")},{align:t("align"),angle:t("angle"),baseline:t("baseline")}),Yt({type:Bt,role:E,style:jt,from:i,encode:s},n)}(e,i,function(e){const n=e.encode;return n&&n.title||t.extend({name:e.name,interactive:e.interactive,style:e.style},n)}(e),c)),e.subtitle&&u.push(function(e,t,n,i){const a={value:0},r=e.subtitle,s={enter:{opacity:a},update:{opacity:{value:1}},exit:{opacity:a}};return p(s,{text:r,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:t("dx"),dy:t("dy"),fill:t("subtitleColor"),font:t("subtitleFont"),fontSize:t("subtitleFontSize"),fontStyle:t("subtitleFontStyle"),fontWeight:t("subtitleFontWeight"),lineHeight:t("subtitleLineHeight")},{align:t("align"),angle:t("angle"),baseline:t("baseline")}),Yt({type:Bt,role:P,style:wt,from:i,encode:s},n)}(e,i,a.subtitle,c)),En(Ut({role:W,from:c,encode:An(i,r),marks:u,aria:i("aria"),description:i("description"),zindex:i("zindex"),name:s,interactive:l,style:o}),n)}function An(e,t){const n={enter:{},update:{}};return p(n,{orient:e("orient"),anchor:e("anchor"),align:{signal:It},angle:{signal:Ln},limit:e("limit"),frame:e("frame"),offset:e("offset")||0,padding:e("subtitlePadding")}),f(n,t,Pt)}function Tn(e,n){const i=[];e.transform&&e.transform.forEach((e=>{i.push(mn(e,n))})),e.on&&e.on.forEach((t=>{Wn(t,n,e.name)})),n.addDataPipeline(e.name,function(e,n,i){const a=[];let r,s,l,o,u,c=null,d=!1,p=!1;e.values?re(e.values)||se(e.format)?(a.push(Un(n,e)),a.push(c=Bn())):a.push(c=Bn({$ingest:e.values,$format:e.format})):e.url?se(e.url)||se(e.format)?(a.push(Un(n,e)),a.push(c=Bn())):a.push(c=Bn({$request:e.url,$format:e.format})):e.source&&(c=r=t.array(e.source).map((e=>J(n.getData(e).output))),a.push(null));for(s=0,l=i.length;s<l;++s)o=i[s],u=o.metadata,c||u.source||a.push(c=Bn()),a.push(o),u.generates&&(p=!0),u.modifies&&!p&&(d=!0),u.source?c=o:u.changes&&(c=null);r&&(l=r.length-1,a[0]=Ue({derive:d,pulse:l?r:r[0]}),(d||l)&&a.splice(1,0,Bn()));c||a.push(Bn());return a.push(He({})),a}(e,n,i))}function Bn(e){const t=Se({},e);return t.metadata={source:!0},t}function Un(e,t){return Ee({url:t.url?e.property(t.url):void 0,async:t.async?e.property(t.async):void 0,values:t.values?e.property(t.values):void 0,format:e.objectProperty(t.format)})}const Mn=e=>e===ft||e===ct,qn=(e,t,n)=>re(e)?Qn(e.signal,t,n):e===dt||e===ct?t:n,Hn=(e,t,n)=>re(e)?Nn(e.signal,t,n):Mn(e)?t:n,In=(e,t,n)=>re(e)?Gn(e.signal,t,n):Mn(e)?n:t,Xn=(e,t,n)=>re(e)?Jn(e.signal,t,n):e===ct?{value:t}:{value:n},Yn=(e,t,n)=>re(e)?Kn(e.signal,t,n):e===pt?{value:t}:{value:n},Nn=(e,t,n)=>Zn(`${e} === '${ct}' || ${e} === '${ft}'`,t,n),Gn=(e,t,n)=>Zn(`${e} !== '${ct}' && ${e} !== '${ft}'`,t,n),Qn=(e,t,n)=>ti(`${e} === '${dt}' || ${e} === '${ct}'`,t,n),Jn=(e,t,n)=>ti(`${e} === '${ct}'`,t,n),Kn=(e,t,n)=>ti(`${e} === '${pt}'`,t,n),Zn=(e,n,i)=>(n=null!=n?c(n):n,i=null!=i?c(i):i,ei(n)&&ei(i)?{signal:`${e} ? (${n=n?n.signal||t.stringValue(n.value):null}) : (${i=i?i.signal||t.stringValue(i.value):null})`}:[t.extend({test:e},n)].concat(i||[])),ei=e=>null==e||1===Object.keys(e).length,ti=(e,t,n)=>({signal:`${e} ? (${ii(t)}) : (${ii(n)})`}),ni=(e,t,n,i,a)=>({signal:(null!=i?`${e} === '${dt}' ? (${ii(i)}) : `:"")+(null!=n?`${e} === '${ft}' ? (${ii(n)}) : `:"")+(null!=a?`${e} === '${pt}' ? (${ii(a)}) : `:"")+(null!=t?`${e} === '${ct}' ? (${ii(t)}) : `:"")+"(null)"}),ii=e=>re(e)?e.signal:null==e?null:t.stringValue(e),ai=(e,t)=>0===t?0:re(e)?{signal:`(${e.signal}) * ${t}`}:{value:e*t},ri=(e,t)=>{const n=e.signal;return n&&n.endsWith("(null)")?{signal:n.slice(0,-6)+t.signal}:e};function si(e,n,i,a){let r;if(n&&t.hasOwnProperty(n,e))return n[e];if(t.hasOwnProperty(i,e))return i[e];if(e.startsWith("title")){switch(e){case"titleColor":r="fill";break;case"titleFont":case"titleFontSize":case"titleFontWeight":r=e[5].toLowerCase()+e.slice(6)}return a[Rt][r]}if(e.startsWith("label")){switch(e){case"labelColor":r="fill";break;case"labelFont":case"labelFontSize":r=e[5].toLowerCase()+e.slice(6)}return a[Ot][r]}return null}function li(e){const t={};for(const n of e)if(n)for(const e in n)t[e]=1;return Object.keys(t)}function oi(e,t){return{scale:e.scale,range:t}}function ui(e,n,i,a,r){const s=Mt(e,n),l=e.orient,o=e.gridScale,u=qn(l,1,-1),c=function(e,n){if(1===n);else if(t.isObject(e)){let i=e=t.extend({},e);for(;null!=i.mult;){if(!t.isObject(i.mult))return i.mult=re(n)?{signal:`(${i.mult}) * (${n.signal})`}:i.mult*n,e;i=i.mult=t.extend({},i.mult)}i.mult=n}else e=re(n)?{signal:`(${n.signal}) * (${e||0})`}:n*(e||0);return e}(e.offset,u);let d,f,g;const m={enter:d={opacity:Ct},update:g={opacity:_t},exit:f={opacity:Ct}};p(m,{stroke:s("gridColor"),strokeCap:s("gridCap"),strokeDash:s("gridDash"),strokeDashOffset:s("gridDashOffset"),strokeOpacity:s("gridOpacity"),strokeWidth:s("gridWidth")});const h={scale:e.scale,field:St,band:r.band,extra:r.extra,offset:r.offset,round:s("tickRound")},y=Hn(l,{signal:"height"},{signal:"width"}),b=o?{scale:o,range:0,mult:u,offset:c}:{value:0,offset:c},x=o?{scale:o,range:1,mult:u,offset:c}:t.extend(y,{mult:u,offset:c});return d.x=g.x=Hn(l,h,b),d.y=g.y=In(l,h,b),d.x2=g.x2=In(l,x),d.y2=g.y2=Hn(l,x),f.x=Hn(l,h),f.y=In(l,h),Yt({type:At,role:k,key:St,from:a,encode:m},i)}function ci(e,t,n,i,a){return{signal:'flush(range("'+e+'"), scale("'+e+'", datum.value), '+t+","+n+","+i+","+a+")"}}function di(e,n,i,a){const r=Mt(e,n),s=e.orient,l=qn(s,-1,1);let o,u;const d={enter:o={opacity:Ct,anchor:c(r("titleAnchor",null)),align:{signal:It}},update:u=t.extend({},o,{opacity:_t,text:c(e.title)}),exit:{opacity:Ct}},f={signal:`lerp(range("${e.scale}"), ${Ht(0,1,.5)})`};return u.x=Hn(s,f),u.y=In(s,f),o.angle=Hn(s,Ct,ai(l,90)),o.baseline=Hn(s,Xn(s,ft,ct),{value:ft}),u.angle=o.angle,u.baseline=o.baseline,p(d,{fill:r("titleColor"),fillOpacity:r("titleOpacity"),font:r("titleFont"),fontSize:r("titleFontSize"),fontStyle:r("titleFontStyle"),fontWeight:r("titleFontWeight"),limit:r("titleLimit"),lineHeight:r("titleLineHeight")},{align:r("titleAlign"),angle:r("titleAngle"),baseline:r("titleBaseline")}),function(e,t,n,i){const a=(e,t)=>null!=e?(n.update[t]=ri(c(e),n.update[t]),!1):!g(t,i),r=a(e("titleX"),"x"),s=a(e("titleY"),"y");n.enter.auto=s===r?c(s):Hn(t,c(s),c(r))}(r,s,d,i),d.update.align=ri(d.update.align,o.align),d.update.angle=ri(d.update.angle,o.angle),d.update.baseline=ri(d.update.baseline,o.baseline),Yt({type:Bt,role:S,style:Rt,from:a,encode:d},i)}function pi(e,n){const i=function(e,n){var i,a,r,s=n.config,l=s.style,o=s.axis,u="band"===n.scaleType(e.scale)&&s.axisBand,c=e.orient;if(re(c)){const e=li([s.axisX,s.axisY]),t=li([s.axisTop,s.axisBottom,s.axisLeft,s.axisRight]);for(r of(i={},e))i[r]=Hn(c,si(r,s.axisX,o,l),si(r,s.axisY,o,l));for(r of(a={},t))a[r]=ni(c.signal,si(r,s.axisTop,o,l),si(r,s.axisBottom,o,l),si(r,s.axisLeft,o,l),si(r,s.axisRight,o,l))}else i=c===ct||c===ft?s.axisX:s.axisY,a=s["axis"+c[0].toUpperCase()+c.slice(1)];return i||a||u?t.extend({},o,i,a,u):o}(e,n),a=e.encode||{},r=a.axis||{},s=r.name||void 0,l=r.interactive,o=r.style,u=Mt(e,i),d=function(e){const n=e("tickBand");let i,a,r=e("tickOffset");return n?n.signal?(i={signal:`(${n.signal}) === 'extent' ? 1 : 0.5`},a={signal:`(${n.signal}) === 'extent'`},t.isObject(r)||(r={signal:`(${n.signal}) === 'extent' ? 0 : ${r}`})):"extent"===n?(i=1,a=!0,r=0):(i=.5,a=!1):(i=e("bandPosition"),a=e("tickExtra")),{extra:a,band:i,offset:r}}(u),g={scale:e.scale,ticks:!!u("ticks"),labels:!!u("labels"),grid:!!u("grid"),domain:!!u("domain"),title:null!=e.title},m=J(n.add(Se({},[g]))),h=J(n.add(ve({scale:n.scaleRef(e.scale),extra:n.property(d.extra),count:n.objectProperty(e.tickCount),values:n.objectProperty(e.values),minstep:n.property(e.tickMinStep),formatType:n.property(e.formatType),formatSpecifier:n.property(e.format)}))),y=[];let k;return g.grid&&y.push(ui(e,i,a.grid,h,d)),g.ticks&&(k=u("tickSize"),y.push(function(e,t,n,i,a,r){const s=Mt(e,t),l=e.orient,o=qn(l,-1,1);let u,d,f;const g={enter:u={opacity:Ct},update:f={opacity:_t},exit:d={opacity:Ct}};p(g,{stroke:s("tickColor"),strokeCap:s("tickCap"),strokeDash:s("tickDash"),strokeDashOffset:s("tickDashOffset"),strokeOpacity:s("tickOpacity"),strokeWidth:s("tickWidth")});const m=c(a);m.mult=o;const h={scale:e.scale,field:St,band:r.band,extra:r.extra,offset:r.offset,round:s("tickRound")};return f.y=u.y=Hn(l,Ct,h),f.y2=u.y2=Hn(l,m),d.x=Hn(l,h),f.x=u.x=In(l,Ct,h),f.x2=u.x2=In(l,m),d.y=In(l,h),Yt({type:At,role:$,key:St,from:i,encode:g},n)}(e,i,a.ticks,h,k,d))),g.labels&&(k=g.ticks?k:0,y.push(function(e,t,n,i,a,r){const s=Mt(e,t),l=e.orient,o=e.scale,u=qn(l,-1,1),d=oe(s("labelFlush")),f=oe(s("labelFlushOffset")),g=s("labelAlign"),m=s("labelBaseline");let h,y=0===d||!!d;const b=c(a);b.mult=u,b.offset=c(s("labelPadding")||0),b.offset.mult=u;const x={scale:o,field:St,band:.5,offset:Xt(r.offset,s("labelOffset"))},k=Hn(l,y?ci(o,d,'"left"','"right"','"center"'):{value:"center"},Yn(l,"left","right")),$=Hn(l,Xn(l,"bottom","top"),y?ci(o,d,'"top"','"bottom"','"middle"'):{value:"middle"}),S=ci(o,d,`-(${f})`,f,0);y=y&&f;const O={opacity:Ct,x:Hn(l,x,b),y:In(l,x,b)},R={enter:O,update:h={opacity:_t,text:{field:xt},x:O.x,y:O.y,align:k,baseline:$},exit:{opacity:Ct,x:O.x,y:O.y}};p(R,{dx:!g&&y?Hn(l,S):null,dy:!m&&y?In(l,S):null}),p(R,{angle:s("labelAngle"),fill:s("labelColor"),fillOpacity:s("labelOpacity"),font:s("labelFont"),fontSize:s("labelFontSize"),fontWeight:s("labelFontWeight"),fontStyle:s("labelFontStyle"),limit:s("labelLimit"),lineHeight:s("labelLineHeight")},{align:g,baseline:m});const j=s("labelBound");let w=s("labelOverlap");return w=w||j?{separation:s("labelSeparation"),method:w,order:"datum.index",bound:j?{scale:o,orient:l,tolerance:j}:null}:void 0,h.align!==k&&(h.align=ri(h.align,k)),h.baseline!==$&&(h.baseline=ri(h.baseline,$)),Yt({type:Bt,role:v,style:Ot,key:St,from:i,encode:R,overlap:w},n)}(e,i,a.labels,h,k,d))),g.domain&&y.push(function(e,t,n,i){const a=Mt(e,t),r=e.orient;let s,l;const o={enter:s={opacity:Ct},update:l={opacity:_t},exit:{opacity:Ct}};p(o,{stroke:a("domainColor"),strokeCap:a("domainCap"),strokeDash:a("domainDash"),strokeDashOffset:a("domainDashOffset"),strokeWidth:a("domainWidth"),strokeOpacity:a("domainOpacity")});const u=oi(e,0),c=oi(e,1);return s.x=l.x=Hn(r,u,Ct),s.x2=l.x2=Hn(r,c),s.y=l.y=In(r,u,Ct),s.y2=l.y2=In(r,c),Yt({type:At,role:x,from:i,encode:o},n)}(e,i,a.domain,m)),g.title&&y.push(di(e,i,a.title,m)),En(Ut({role:b,from:m,encode:f(fi(u,e),r,Pt),marks:y,aria:u("aria"),description:u("description"),zindex:u("zindex"),name:s,interactive:l,style:o}),n)}function fi(e,t){const n={enter:{},update:{}};return p(n,{orient:e("orient"),offset:e("offset")||0,position:le(t.position,0),titlePadding:e("titlePadding"),minExtent:e("minExtent"),maxExtent:e("maxExtent"),range:{signal:`abs(span(range("${t.scale}")))`},translate:e("translate"),format:t.format,formatType:t.formatType}),n}function gi(e,n,i){const r=t.array(e.signals),s=t.array(e.scales);return i||r.forEach((e=>Y(e,n))),t.array(e.projections).forEach((e=>function(e,t){const n=t.config.projection||{},i={};for(const n in e)"name"!==n&&(i[n]=ut(e[n],n,t));for(const e in n)null==i[e]&&(i[e]=ut(n[e],e,t));t.addProjection(e.name,i)}(e,n))),s.forEach((e=>function(e,n){const i=e.type||"linear";a.isValidScaleType(i)||t.error("Unrecognized scale type: "+t.stringValue(i)),n.addScale(e.name,{type:i,domain:void 0})}(e,n))),t.array(e.data).forEach((e=>Tn(e,n))),s.forEach((e=>Qe(e,n))),(i||r).forEach((e=>be(e,n))),t.array(e.axes).forEach((e=>pi(e,n))),t.array(e.marks).forEach((e=>En(e,n))),t.array(e.legends).forEach((e=>Pn(e,n))),e.title&&Fn(e.title,n),n.parseLambdas(),n}const mi=e=>f({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},e);function hi(e,n){const i=n.config,a=J(n.root=n.add(Q())),r=function(e,n){const i=t=>le(e[t],n[t]),a=[yi("background",i("background")),yi("autosize",s(i("autosize"))),yi("padding",u(i("padding"))),yi("width",i("width")||0),yi("height",i("height")||0)],r=a.reduce(((e,t)=>(e[t.name]=t,e)),{}),l={};return t.array(e.signals).forEach((e=>{t.hasOwnProperty(r,e.name)?e=t.extend(r[e.name],e):a.push(e),l[e.name]=e})),t.array(n.signals).forEach((e=>{t.hasOwnProperty(l,e.name)||t.hasOwnProperty(r,e.name)||a.push(e)})),a}(e,i);r.forEach((e=>Y(e,n))),n.description=e.description||i.description,n.eventConfig=i.events,n.legends=n.objectProperty(i.legend&&i.legend.layout),n.locale=i.locale;const l=n.add(Se()),o=n.add(je(U(mi(e.encode),Lt,h,e.style,n,{pulse:J(l)}))),c=n.add(Xe({layout:n.objectProperty(e.layout),legends:n.legends,autosize:n.signalRef("autosize"),mark:a,pulse:J(o)}));n.operators.pop(),n.pushState(J(o),J(c),null),gi(e,n,r),n.operators.push(c);let d=n.add($e({mark:a,pulse:J(c)}));return d=n.add(Me({pulse:J(d)})),d=n.add(He({pulse:J(d)})),n.addData("root",new wn(n,l,l,d)),n}function yi(e,t){return t&&t.signal?{name:e,update:t.signal}:{name:e,value:t}}function bi(e,t){this.config=e||{},this.options=t||{},this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.eventConfig=null,this.locale=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function xi(e){this.config=e.config,this.options=e.options,this.legends=e.legends,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._lookup=e._lookup.slice(),this._markpath=e._markpath}function ki(e){return(t.isArray(e)?vi:$i)(e)}function vi(e){const n=e.length;let i="[";for(let a=0;a<n;++a){const n=e[a];i+=(a>0?",":"")+(t.isObject(n)?n.signal||ki(n):t.stringValue(n))}return i+"]"}function $i(e){let n,i,a="{",r=0;for(n in e)i=e[n],a+=(++r>1?",":"")+t.stringValue(n)+":"+(t.isObject(i)?i.signal||ki(i):t.stringValue(i));return a+"}"}function Si(){const e="sans-serif",t="#4c78a8",n="#000",i="#888",a="#ddd";return{description:"Vega visualization",padding:0,autosize:"pad",background:null,events:{defaults:{allow:["wheel"]}},group:null,mark:null,arc:{fill:t},area:{fill:t},image:null,line:{stroke:t,strokeWidth:2},path:{stroke:t},rect:{fill:t},rule:{stroke:n},shape:{stroke:t},symbol:{fill:t,size:64},text:{fill:n,font:e,fontSize:11},trail:{fill:t,size:2},style:{"guide-label":{fill:n,font:e,fontSize:10},"guide-title":{fill:n,font:e,fontSize:11,fontWeight:"bold"},"group-title":{fill:n,font:e,fontSize:13,fontWeight:"bold"},"group-subtitle":{fill:n,font:e,fontSize:12},point:{size:30,strokeWidth:2,shape:"circle"},circle:{size:30,strokeWidth:2},square:{size:30,strokeWidth:2,shape:"square"},cell:{fill:"transparent",stroke:a},view:{fill:"transparent"}},title:{orient:"top",anchor:"middle",offset:4,subtitlePadding:3},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:i,grid:!1,gridWidth:1,gridColor:a,labels:!0,labelAngle:0,labelLimit:180,labelOffset:0,labelPadding:2,ticks:!0,tickColor:i,tickOffset:0,tickRound:!0,tickSize:5,tickWidth:1,titlePadding:4},axisBand:{tickOffset:-.5},projection:{type:"mercator"},legend:{orient:"right",padding:0,gridAlign:"each",columnPadding:10,rowPadding:2,symbolDirection:"vertical",gradientDirection:"vertical",gradientLength:200,gradientThickness:16,gradientStrokeColor:a,gradientStrokeWidth:0,gradientLabelOffset:2,labelAlign:"left",labelBaseline:"middle",labelLimit:160,labelOffset:4,labelOverlap:!0,symbolLimit:30,symbolType:"circle",symbolSize:100,symbolOffset:0,symbolStrokeWidth:1.5,symbolBaseFillColor:"transparent",symbolBaseStrokeColor:i,titleLimit:180,titleOrient:"top",titlePadding:5,layout:{offset:18,direction:"horizontal",left:{direction:"vertical"},right:{direction:"vertical"}}},range:{category:{scheme:"tableau10"},ordinal:{scheme:"blues"},heatmap:{scheme:"yellowgreenblue"},ramp:{scheme:"blues"},diverging:{scheme:"blueorange",extent:[1,0]},symbol:["circle","square","triangle-up","cross","diamond","triangle-right","triangle-down","triangle-left"]}}}bi.prototype=xi.prototype={parse(e){return gi(e,this)},fork(){return new xi(this)},isSubscope(){return this._subid>0},toRuntime(){return this.finish(),{description:this.description,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig,locale:this.locale}},id(){return(this._subid?this._subid+":":0)+this._id++},add(e){return this.operators.push(e),e.id=this.id(),e.refs&&(e.refs.forEach((t=>{t.$ref=e.id})),e.refs=null),e},proxy(e){const t=e instanceof N?J(e):e;return this.add(Be({value:t}))},addStream(e){return this.streams.push(e),e.id=this.id(),e},addUpdate(e){return this.updates.push(e),e},finish(){let e,t;for(e in this.root&&(this.root.root=!0),this.signals)this.signals[e].signal=e;for(e in this.scales)this.scales[e].scale=e;function n(e,t,n){let i,a;e&&(i=e.data||(e.data={}),a=i[t]||(i[t]=[]),a.push(n))}for(e in this.data){t=this.data[e],n(t.input,e,"input"),n(t.output,e,"output"),n(t.values,e,"values");for(const i in t.index)n(t.index[i],e,"index:"+i)}return this},pushState(e,t,n){this._encode.push(J(this.add(He({pulse:e})))),this._parent.push(t),this._lookup.push(n?J(this.proxy(n)):null),this._markpath.push(-1)},popState(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},parent(){return t.peek(this._parent)},encode(){return t.peek(this._encode)},lookup(){return t.peek(this._lookup)},markpath(){const e=this._markpath;return++e[e.length-1]},fieldRef(e,n){if(t.isString(e))return K(e,n);e.signal||t.error("Unsupported field reference: "+t.stringValue(e));const i=e.signal;let a=this.field[i];if(!a){const e={name:this.signalRef(i)};n&&(e.as=n),this.field[i]=a=J(this.add(De(e)))}return a},compareRef(e){let n=!1;const i=e=>re(e)?(n=!0,this.signalRef(e.signal)):function(e){return e&&e.expr}(e)?(n=!0,this.exprRef(e.expr)):e,a=t.array(e.field).map(i),r=t.array(e.order).map(i);return n?J(this.add(Oe({fields:a,orders:r}))):ee(a,r)},keyRef(e,n){let i=!1;const a=this.signals;return e=t.array(e).map((e=>re(e)?(i=!0,J(a[e.signal])):e)),i?J(this.add(Ve({fields:e,flat:n}))):function(e,t){const n={$key:e};return t&&(n.$flat=!0),n}(e,n)},sortRef(e){if(!e)return e;const t=ne(e.op,e.field),n=e.order||"ascending";return n.signal?J(this.add(Oe({fields:t,orders:this.signalRef(n.signal)}))):ee(t,n)},event(e,t){const n=e+":"+t;if(!this.events[n]){const i=this.id();this.streams.push({id:i,source:e,type:t}),this.events[n]=i}return this.events[n]},hasOwnSignal(e){return t.hasOwnProperty(this.signals,e)},addSignal(e,n){this.hasOwnSignal(e)&&t.error("Duplicate signal name: "+t.stringValue(e));const i=n instanceof N?n:this.add(Q(n));return this.signals[e]=i},getSignal(e){return this.signals[e]||t.error("Unrecognized signal name: "+t.stringValue(e)),this.signals[e]},signalRef(e){return this.signals[e]?J(this.signals[e]):(t.hasOwnProperty(this.lambdas,e)||(this.lambdas[e]=this.add(Q(null))),J(this.lambdas[e]))},parseLambdas(){const e=Object.keys(this.lambdas);for(let t=0,i=e.length;t<i;++t){const i=e[t],a=n.parseExpression(i,this),r=this.lambdas[i];r.params=a.$params,r.update=a.$expr}},property(e){return e&&e.signal?this.signalRef(e.signal):e},objectProperty(e){return e&&t.isObject(e)?this.signalRef(e.signal||ki(e)):e},exprRef(e,t){const i={expr:n.parseExpression(e,this)};return t&&(i.expr.$name=t),J(this.add(we(i)))},addBinding(e,n){this.bindings||t.error("Nested signals do not support binding: "+t.stringValue(e)),this.bindings.push(t.extend({signal:e},n))},addScaleProj(e,n){t.hasOwnProperty(this.scales,e)&&t.error("Duplicate scale or projection name: "+t.stringValue(e)),this.scales[e]=this.add(n)},addScale(e,t){this.addScaleProj(e,qe(t))},addProjection(e,t){this.addScaleProj(e,Te(t))},getScale(e){return this.scales[e]||t.error("Unrecognized scale name: "+t.stringValue(e)),this.scales[e]},scaleRef(e){return J(this.getScale(e))},scaleType(e){return this.getScale(e).params.type},projectionRef(e){return this.scaleRef(e)},projectionType(e){return this.scaleType(e)},addData(e,n){return t.hasOwnProperty(this.data,e)&&t.error("Duplicate data set name: "+t.stringValue(e)),this.data[e]=n},getData(e){return this.data[e]||t.error("Undefined data set name: "+t.stringValue(e)),this.data[e]},addDataPipeline(e,n){return t.hasOwnProperty(this.data,e)&&t.error("Duplicate data set name: "+t.stringValue(e)),this.addData(e,wn.fromEntries(this,n))}},e.AxisDomainRole=x,e.AxisGridRole=k,e.AxisLabelRole=v,e.AxisRole=b,e.AxisTickRole=$,e.AxisTitleRole=S,e.DataScope=wn,e.FrameRole=h,e.LegendEntryRole=j,e.LegendLabelRole=z,e.LegendRole=O,e.LegendSymbolRole=D,e.LegendTitleRole=V,e.MarkRole=m,e.Scope=bi,e.ScopeRole=y,e.config=Si,e.parse=function(e,n,i){return t.isObject(e)||t.error("Input Vega specification must be an object."),hi(e,new bi(n=t.mergeConfig(Si(),n,e.config),i)).toRuntime()},e.signal=Y,e.signalUpdates=be,e.stream=ce})); | ||
//# sourceMappingURL=vega-parser.min.js.map |
{ | ||
"name": "vega-parser", | ||
"version": "6.2.1", | ||
"version": "6.3.0", | ||
"description": "Parse Vega specifications to runtime dataflows.", | ||
@@ -31,3 +31,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "3580b28ec9b89d0a042707c168080931e7745fb3" | ||
"gitHead": "175b2485248834953a65f4bc192b45ee78dc3f50" | ||
} |
@@ -6,5 +6,5 @@ import {GroupMark} from './marktypes'; | ||
const role = spec.role || ''; | ||
return (!role.indexOf('axis') || !role.indexOf('legend') || !role.indexOf('title')) | ||
return (role.startsWith('axis') || role.startsWith('legend') || role.startsWith('title')) | ||
? role | ||
: spec.type === GroupMark ? ScopeRole : (role || MarkRole); | ||
} |
@@ -43,3 +43,3 @@ import { | ||
if (spec.nice != null) { | ||
params.nice = parseScaleNice(spec.nice); | ||
params.nice = parseScaleNice(spec.nice, scope); | ||
} | ||
@@ -217,4 +217,6 @@ | ||
function parseScaleNice(nice) { | ||
return isObject(nice) | ||
function parseScaleNice(nice, scope) { | ||
return nice.signal | ||
? scope.signalRef(nice.signal) | ||
: isObject(nice) | ||
? { | ||
@@ -221,0 +223,0 @@ interval: parseLiteral(nice.interval), |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
589470
11101
1